11Example Slack events API bot
2- ============================
2+ =============================
33
44This example app shows how easy it is to implement the Slack Events API Adapter
55to receive Slack Events, extend it to handle the OAuth flow and respond to
66messages using Slack's Web API via python-slackclient.
77
88🤖 Setup and running the app
9- ------------
9+ ------------------------------
1010
1111**Set up your Python environment: **
1212
@@ -30,20 +30,45 @@ See `virtualenv`_ docs for more info.
3030
3131Create a Slack app on https://api.slack.com/apps/
3232
33- .. image :: https://cloud.githubusercontent.com/assets/32463/20549718/afdd98d0-b0e3-11e6-8d83-8ad7053deb80 .png
33+ .. image :: https://cloud.githubusercontent.com/assets/32463/24877733/32979776-1de5-11e7-87d4-b5dc9e3e7973 .png
3434
35- Add a ** bot user ** for your app
35+ ** 🤖 Add a bot user to your app**
3636
37- .. image :: https://cloud.githubusercontent.com/assets/32463/20371297/9044e2a0-ac18-11e6-8f25-3ffbd8a3bf58 .png
37+ .. image :: https://cloud.githubusercontent.com/assets/32463/24877750/47a16034-1de5-11e7-989b-2a90b9d8e7e3 .png
3838
39- **🤖 Run the app: **
39+ **🤖 Install your app on your team **
4040
41- You'll need to have your server and ngrok running to complete your app's Event
42- Subscription setup
41+ Visit your app's **Install App ** page and click **Install App to Team **.
42+
43+ .. image :: https://cloud.githubusercontent.com/assets/32463/24877770/61804c36-1de5-11e7-91ef-5cf2e0845729.png
44+
45+ Authorize your app
46+
47+ .. image :: https://cloud.githubusercontent.com/assets/32463/24877792/774ed94c-1de5-11e7-8857-ac8d662c5b27.png
48+
49+ **🤖 Save your app's credentials **
50+
51+ Once you've authorized your app, you'll be presented with your app's tokens.
52+
53+ .. image :: https://cloud.githubusercontent.com/assets/32463/24877652/d8eebbb4-1de4-11e7-8f75-2cfb1e9d45ee.png
54+
55+ Copy your app's **Bot User OAuth Access Token ** and add it to your python environmental variables
4356
4457.. code ::
4558
46- python example.py
59+ export SLACK_BOT_TOKEN=xxxXXxxXXxXXxXXXXxxxX.xXxxxXxxxx
60+
61+ Next, go back to your app's **Basic Information ** page
62+
63+ .. image :: https://cloud.githubusercontent.com/assets/32463/24877833/950dd53c-1de5-11e7-984f-deb26e8b9482.png
64+
65+ Add your app's **Client ID **, **Client Secret ** and **Verification Token ** to your python environmental variables
66+
67+ .. code ::
68+
69+ export SLACK_CLIENT_ID=xxxxxxxxxxx.xxxxxxxxxxxxx
70+ export SLACK_CLIENT_SECRET=XxxxXxxXXXxxXxxXX
71+ export SLACK_VERIFICATION_TOKEN=xxxxxxxxXxxXxxXxXXXxxXxxx
4772
4873 **🤖 Start ngrok **
4974
@@ -71,48 +96,24 @@ Run ngrok and copy the **HTTPS** URL
7196 Forwarding http://h7465j.ngrok.io -> localhost:9292
7297 Forwarding https://h7465j.ngrok.io -> localhost:9292
7398
74- **🤖 Subscribe your app to events **
75-
76- Add your **Request URL ** (your ngrok URL + ``/slack/events ``) and subscribe your app to `message.channels ` under bot events. **Save ** and toggle **Enable Events ** to `on `
77-
78- .. image :: https://cloud.githubusercontent.com/assets/32463/20366593/b40d14a4-ac00-11e6-8413-b473c16ef997.png
79-
80- .. image :: https://cloud.githubusercontent.com/assets/32463/20549612/e7ee2ed4-b0e2-11e6-8b9c-01ed08057c7c.png
81-
82- **🤖 Save your app's credentials **
83-
84- Go to your app's **Basic Information ** page and save your app's **Client ID **, **Client Secret ** and **Verification Token ** to environmental variables
85-
86- .. image :: https://cloud.githubusercontent.com/assets/32463/20445302/61ddfc54-ad89-11e6-8523-245a60c875b0.png
87-
88- **🤖 Add your OAuth URL **
89-
90- Add your OAuth redirect URL (your ngrok URL + ``/auth/slack/callback ``)
91-
92- .. image :: https://cloud.githubusercontent.com/assets/32463/20543629/63e41a26-b0bb-11e6-8eee-90c6f4f1dbb1.png
93-
94- **🤖 Assign your app's credentials to environment variables: **
95-
96- .. code ::
97-
98- export SLACK_CLIENT_ID=xxxxxxxxxxx.xxxxxxxxxxxxx
99- export SLACK_CLIENT_SECRET=XxxxXxxXXXxxXxxXX
100- export SLACK_VERIFICATION_TOKEN=xxxxxxxxXxxXxxXxXXXxxXxxx
99+ **🤖 Run the app: **
101100
102- **🤖 Restart your app to load it's credentials **
101+ You'll need to have your server and ngrok running to complete your app's Event
102+ Subscription setup
103103
104104.. code ::
105105
106106 python example.py
107107
108+ **🤖 Subscribe your app to events **
108109
109- ** 🤖 Auth your app**
110+ Add your ** Request URL ** (your ngrok URL + `` /slack/events ``) and subscribe your app to ` message.channels ` under bot events. ** Save ** and toggle ** Enable Events ** to ` on `
110111
111- Go to your ngrok URL (e.g. https://myapp12.ngrok .com/) and auth your app.
112+ .. image :: https://cloud.githubusercontent .com/assets/32463/24877867/b39d4384-1de5-11e7-9676-9e47ea7db4e7.png
112113
113- .. image :: https://cloud.githubusercontent.com/assets/32463/20575277/789c0c5a-b16d-11e6-86fd-e30c3a0d2e61.gif
114+ .. image :: https://cloud.githubusercontent.com/assets/32463/24877931/e119181a-1de5-11e7-8b0c-fcbc3419bad7.png
114115
115- **🎉 Once your app has been authorized , you will begin receiving Slack events **
116+ **🎉 Once your app has been installed and subscribed to Bot Events , you will begin receiving event data from Slack **
116117
117118**👋 Interact with your bot: **
118119
@@ -123,15 +124,12 @@ Invite your bot to a public channel, then say hi and your bot will respond
123124.. image :: https://cloud.githubusercontent.com/assets/32463/23047918/964defec-f467-11e6-87c3-9c7da11fc810.gif
124125
125126🤔 Support
126- -------
127+ ------------
127128
128129Need help? Join `Bot Developer Hangout `_ and talk to us in `#slack-api `_.
129130
130131You can also `create an Issue `_ right here on GitHub.
131132
132- .. _Events API : https://api.slack.com/events-api
133- .. _create a Slack App : https://api.slack.com/apps/new
134- .. _Event Subscriptions : https://api.slack.com/events-api#subscriptions
135133.. _Bot Developer Hangout : http://dev4slack.xoxco.com/
136134.. _#slack-api : https://dev4slack.slack.com/messages/slack-api/
137135.. _create an Issue : https://github.com/slackapi/node-slack-events-api/issues/new
0 commit comments