-
Notifications
You must be signed in to change notification settings - Fork 288
Expand file tree
/
Copy pathapp.py
More file actions
29 lines (18 loc) · 716 Bytes
/
app.py
File metadata and controls
29 lines (18 loc) · 716 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
from slack_bolt import App
from slack_bolt.adapter.starlette import SlackRequestHandler
app = App()
@app.event("app_mention")
def handle_app_mentions(body, say, logger):
logger.info(body)
say("What's up?")
app_handler = SlackRequestHandler(app)
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.routing import Route
async def endpoint(req: Request):
return await app_handler.handle(req)
api = Starlette(debug=True, routes=[Route("/slack/events", endpoint=endpoint, methods=["POST"])])
# pip install -r requirements.txt
# export SLACK_SIGNING_SECRET=***
# export SLACK_BOT_TOKEN=xoxb-***
# uvicorn app:api --reload --port 3000 --log-level debug