File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ web : gunicorn --bind :$PORT --workers 1 --threads 2 --timeout 0 main:flask_app
Original file line number Diff line number Diff line change 1+ import logging
2+
3+ from slack_bolt import App
4+
5+ logging .basicConfig (level = logging .DEBUG )
6+ app = App ()
7+
8+
9+ @app .command ("/hello-bolt-python-heroku" )
10+ def hello (payload , ack ):
11+ user_id = payload ["user_id" ]
12+ ack (f"Hi <@{ user_id } >!" )
13+
14+
15+ from flask import Flask , request
16+ from slack_bolt .adapter .flask import SlackRequestHandler
17+
18+ flask_app = Flask (__name__ )
19+ handler = SlackRequestHandler (app )
20+
21+
22+ @flask_app .route ("/slack/events" , methods = ["POST" ])
23+ def slack_events ():
24+ return handler .handle (request )
25+
26+ # heroku login
27+ # heroku create
28+ # git remote add heroku https://git.heroku.com/xxx.git
29+
30+ # export $SLACK_BOT_TOKEN=xxx
31+ # export SLACK_SIGNING_SECRET=xxx
32+ # heroku config:set SLACK_BOT_TOKEN=$SLACK_BOT_TOKEN
33+ # heroku config:set SLACK_SIGNING_SECRET=$SLACK_SIGNING_SECRET
34+ # git push heroku main
Original file line number Diff line number Diff line change 1+ slack_bolt
2+ Flask >= 1.1
3+ gunicorn >= 20
You can’t perform that action at this time.
0 commit comments