I'm trying to learn how to crate Slack Apps using the Slack Bolt Framewok, so I'm studying this tutorial (https://api.slack.com/start/building/bolt-python). I followed all the steps but my bot is not listening to the events.
The python class:
import os
from slack_bolt import App
app = App(
token = 'xoxb-xxxxxxxx-2463004875172-0pnMlWzr30pFg2vFGtt52wzx',
signing_secret = 'xxxxxxx3eba2b1fc11bf6076'
)
# Start your app
if __name__ == "__main__":
app.start(port=int(os.environ.get("PORT", 3000)))
@app.event("message")
def handle_message_events(body, logger):
logger.info(body)
The response I get when I write a message to the bot: response
The response in the ngrok: ngrok response
The bot events subscriptions subscriptions
Does anyone know what I am forgetting to do?
As per the official documentation, functionality goes before you start the app.
https://github.com/slackapi/bolt-python#creating-an-app
app = App()
# Add functionality here
if __name__ == "__main__":
app.start(3000) # POST http://localhost:3000/slack/events
Can you move following code accordingly, and check?
@app.event("message")
def handle_message_events(body, logger):
logger.info(body)