forked from slackapi/bolt-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (23 loc) · 770 Bytes
/
main.py
File metadata and controls
36 lines (23 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import logging
import os
from slack_bolt import App
logging.basicConfig(level=logging.DEBUG)
bolt_app = App()
@bolt_app.command("/hey-google-app-engine")
def hello(body, ack):
user_id = body["user_id"]
ack(f"Hi <@{user_id}>!")
from flask import Flask, request
from slack_bolt.adapter.flask import SlackRequestHandler
app = Flask(__name__)
handler = SlackRequestHandler(bolt_app)
@app.route("/_ah/warmup")
def warmup():
# Handle your warmup logic here, e.g. set up a database connection pool
return "", 200, {}
@app.route("/slack/events", methods=["POST"])
def slack_events():
return handler.handle(request)
# Only for local debug
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 3000)))