forked from slackapi/bolt-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
40 lines (29 loc) · 1.01 KB
/
app.py
File metadata and controls
40 lines (29 loc) · 1.01 KB
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
38
39
40
# ------------------------------------------------
# instead of slack_bolt in requirements.txt
import sys
sys.path.insert(1, "../..")
# ------------------------------------------------
import logging
from slack_bolt import App
from slack_bolt.adapter.pyramid.handler import SlackRequestHandler
logging.basicConfig(level=logging.DEBUG)
app = App()
@app.event("app_mention")
def event_test(body, say, logger):
logger.info(body)
say("What's up?")
handler = SlackRequestHandler(app)
if __name__ == "__main__":
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
with Configurator() as config:
config.add_route("slack_events", "/slack/events")
config.add_view(
handler.handle, route_name="slack_events", request_method="POST"
)
pyramid_app = config.make_wsgi_app()
server = make_server("0.0.0.0", 3000, pyramid_app)
server.serve_forever()
# export SLACK_SIGNING_SECRET=***
# export SLACK_BOT_TOKEN=xoxb-***
# python app.py