You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+74-35Lines changed: 74 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,15 @@ Whether you're building a custom app for your team, or integrating a third party
25
25
service into your Slack workflows, Slack Developer Kit for Python allows you to leverage the flexibility
26
26
of Python to get your project up and running as quickly as possible.
27
27
28
+
Documentation
29
+
***************
30
+
31
+
For comprehensive method information and usage examples, see the `full documentation <http://slackapi.github.io/python-slackclient>`_.
32
+
33
+
If you're building a project to receive content and events from Slack, check out the `Python Slack Events API Adapter <https://github.com/slackapi/python-slack-events-api/>`_ library.
34
+
35
+
You may also review our `Development Roadmap <https://github.com/slackapi/python-slackclient/wiki/Slack-Python-SDK-Roadmap>`_ in the project wiki.
36
+
28
37
29
38
Requirements and Installation
30
39
******************************
@@ -43,16 +52,8 @@ by pulling down the source code directly into your project:
print("Access Token expires in (ms): {}".format(update_data["expires_in"]))
336
+
337
+
# When creating an instance of the client, pass the client details and token update callback
338
+
sc = SlackClient(
339
+
refresh_token=slack_refresh_token,
340
+
client_id=slack_client_id,
341
+
client_secret=slack_client_secret,
342
+
token_update_callback=token_update_callback
343
+
)
344
+
345
+
346
+
Slack will send your callback function the **app's access token**, **token expiration TTL**, **team ID**, and **enterprise ID** (for enterprise workspaces)
347
+
348
+
349
+
See `Tokens & Authentication <http://slackapi.github.io/python-slackclient/auth.html#handling-tokens>`_ for API token handling best practices.
Copy file name to clipboardExpand all lines: docs-src/auth.rst
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,25 @@ Tokens & Authentication
5
5
6
6
Handling tokens and other sensitive data
7
7
----------------------------------------
8
-
Slack tokens are the keys to your—or your customers’—teams. Keep them secret. Keep them safe. One way to do that is to never explicitly hardcode them.
8
+
⚠️ **Slack tokens are the keys to your—or your customers’—data.Keep them secret. Keep them safe.**
9
+
10
+
One way to do that is to never explicitly hardcode them.
9
11
10
12
Try to avoid this when possible:
11
13
12
14
.. code-block:: python
13
15
14
16
token ='xoxb-abc-1232'
15
17
16
-
If you commit this code to GitHub, the world gains access to this token’s team. Rather, we recommend you pass tokens in as environment variables, or persist them in a database that is accessed at runtime. You can add a token to the environment by starting your app as:
18
+
⚠️ **Never share test tokens with other users or applications. Do not publish test tokens in public code repositories.**
19
+
20
+
We recommend you pass tokens in as environment variables, or persist them in a database that is accessed at runtime. You can add a token to the environment by starting your app as:
17
21
18
22
.. code-block:: python
19
23
20
24
SLACK_BOT_TOKEN="xoxb-abc-1232" python myapp.py
21
25
22
-
Then in your code retrieve the key with:
26
+
Then retrieve the key with:
23
27
24
28
.. code-block:: python
25
29
@@ -34,13 +38,15 @@ You can use the same technique for other kinds of sensitive data that ne’er-do
34
38
35
39
For additional information, please see our `Safely Storing Credentials <https://api.slack.com/docs/oauth-safety>`_ page.
36
40
37
-
Test Tokens
41
+
Single-Workspace Apps
38
42
-----------------------
39
-
During development (prior to implementing OAuth) you can use a test token provided by the `Test Token Generator <https://api.slack.com/docs/oauth-test-tokens>`_. These tokens provide access to your private data and that of your team.
43
+
If you're building an application for a single Slack workspace, there's no need to build out the entire OAuth flow.
40
44
41
-
**Tester tokens are not intended to replace OAuth 2.0 tokens.** Once your app is ready for users, replace this token with a proper OAuth token implementation.
45
+
Once you've setup your features, click on the **Install App to Team** button found on the **Install App** page.
46
+
If you add new permission scopes or Slack app features after an app has been installed, you must reinstall the app to
47
+
your workspace for changes to take effect.
42
48
43
-
**Never share test tokens with other users or applications. Do not publish test tokens in public code repositories.**
49
+
For additional information, see the `Installing Apps <https://api.slack.com/slack-apps#installing_apps>`_ of our `Building Slack apps <https://api.slack.com/slack-apps#installing_apps>`_ page.
Copy file name to clipboardExpand all lines: docs/about.html
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@
47
47
<liclass="toctree-l1"><aclass="reference internal" href="index.html">Slack Developer Kit for Python</a></li>
48
48
<liclass="toctree-l1"><aclass="reference internal" href="auth.html">Tokens & Authentication</a><ul>
49
49
<liclass="toctree-l2"><aclass="reference internal" href="auth.html#handling-tokens-and-other-sensitive-data">Handling tokens and other sensitive data</a></li>
<liclass="toctree-l1"><aclass="reference internal" href="real_time_messaging.html">Real Time Messaging</a><ul>
79
-
<liclass="toctree-l2"><aclass="reference internal" href="real_time_messaging.html#connecting-to-the-real-time-messaging-api">Connecting to the Real Time Messaging API</a></li>
78
+
<liclass="toctree-l1"><aclass="reference internal" href="real_time_messaging.html">Real Time Messaging (RTM)</a><ul>
79
+
<liclass="toctree-l2"><aclass="reference internal" href="real_time_messaging.html#connecting-to-the-rtm-api">Connecting to the RTM API</a></li>
80
80
<liclass="toctree-l2"><aclass="reference internal" href="real_time_messaging.html#rtm-start-vs-rtm-connect">rtm.start vs rtm.connect</a></li>
<liclass="toctree-l2"><aclass="reference internal" href="real_time_messaging.html#sending-messages-via-the-rtm-api">Sending messages via the RTM API</a></li>
0 commit comments