forked from slackapi/bolt-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoauth_sqlite3_app.py
More file actions
37 lines (27 loc) · 820 Bytes
/
oauth_sqlite3_app.py
File metadata and controls
37 lines (27 loc) · 820 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
37
import logging
logging.basicConfig(level=logging.DEBUG)
from slack_bolt import App
from slack_bolt.oauth import OAuthFlow
app = App(
oauth_flow=OAuthFlow.sqlite3(
database="./slackapp.db",
token_rotation_expiration_minutes=60 * 24, # for testing
)
)
@app.event("app_mention")
def handle_app_mentions(body, say, logger):
logger.info(body)
say("What's up?")
@app.command("/token-rotation-modal")
def handle_some_command(ack, body, logger):
ack()
logger.info(body)
if __name__ == "__main__":
app.start(3000)
# pip install slack_bolt
# export SLACK_SIGNING_SECRET=***
# export SLACK_BOT_TOKEN=xoxb-***
# export SLACK_CLIENT_ID=111.111
# export SLACK_CLIENT_SECRET=***
# export SLACK_SCOPES=app_mentions:read,channels:history,im:history,chat:write
# python oauth_app.py