Question

How To Build a Slackbot in Python on Ubuntu 20.04 error

Hello I am following your steps using Mac os 14 (for environment variables, I have modified the steps where mac is different from ubuntu). I have setup the secret token, bot token and setup tunnel using ngrok. The event channel is verified on the slack page. I run the python app.py, the app starts properly but is unable to handle requests. I have not modified the script in any way. The error I get is

Exception on /slack/events [POST]
Traceback (most recent call last):
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/slackeventsapi/server.py", line 102, in event
    self.emitter.emit('error', slack_exception)
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pyee/_base.py", line 111, in emit
    self._emit_handle_potential_error(event, args[0] if args else None)
  File "/Users/wang.shuochen/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pyee/_base.py", line 83, in _emit_handle_potential_error
    raise error
slackeventsapi.server.SlackEventAdapterException: Invalid request signature
127.0.0.1 - - [10/Nov/2020 16:38:23] "POST /slack/events HTTP/1.1" 500 -

Any help is appreciated.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer