Skip to content

Commit e866921

Browse files
committed
Initial Release
0 parents  commit e866921

42 files changed

Lines changed: 663 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

6 KB
Binary file not shown.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015-2016 Slack Technologies, Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.rst

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
Slack Events API adapter for Python
2+
===================================
3+
4+
The Slack Events Adapter is a Python-based solution to receive and parse events
5+
from Slack’s Events API. This library uses an event emitter framework to allow
6+
you to easily process Slack events by simply attaching functions
7+
to event listeners.
8+
9+
🤖 Installation
10+
------------
11+
12+
.. code::
13+
14+
pip install slackeventsapi
15+
16+
🤖 App Setup
17+
--------------------
18+
19+
Before you can use the `Events API`_ you must
20+
`create a Slack App`_, and turn on
21+
`Event Subscriptions`_.
22+
23+
.. _Events API: https://api.slack.com/events-api
24+
.. _create a Slack App: https://api.slack.com/apps/new
25+
.. _Event Subscriptions: https://api.slack.com/events-api#subscriptions
26+
27+
💡 When you add the Request URL to your app's Event Subscription settings,
28+
Slack will send a request containing a `challenge` code to verify that your
29+
server is alive. This package handles that URL Verification event for you, so
30+
all you need to do is start the example app, start ngrok and configure your
31+
URL accordingly.
32+
33+
✅ Once you have your `Request URL` verified, your app is ready to start
34+
receiving Team Events.
35+
36+
🔑 Your server will begin receiving Events form Slack's Events API as soon as a
37+
user has authorized your app.
38+
39+
🤖 Development workflow:
40+
------------------------------
41+
42+
(1) Create a Slack app on https://api.slack.com/apps/
43+
(2) Add a `bot user` for your app
44+
(3) Start the example app on your **Request URL** endpoint
45+
(4) Start ngrok and copy the **HTTPS** URL
46+
(5) Add your **Request URL** and subscribe your app to events
47+
(6) Go to your ngrok URL (e.g. https://myapp12.ngrok.com/) and auth your app
48+
49+
**🎉 Once your app has been authorized, you will begin receiving Slack Events**
50+
51+
⚠️ We strongly discourage using ngrok for
52+
anything but development. It’s not well-suited for production use.
53+
54+
💡 See the example app included in this repository for more information
55+
on implementing OAuth.
56+
57+
🤖 Usage
58+
-----
59+
**⚠️ Keep your app's credentials safe!**
60+
61+
- For development, keep them in virtualenv variables.
62+
63+
- For production, use a secure data store.
64+
65+
- Never post your app's credentials to github.
66+
67+
.. code:: python
68+
69+
SLACK_VERIFICATION_TOKEN = os.environ["SLACK_VERIFICATION_TOKEN"]
70+
71+
Create a Slack Event Adapter for receiving actions via the Events API
72+
73+
.. code:: python
74+
75+
from slackeventsapi import SlackEventAdapter
76+
77+
slack_events_adapter = SlackEventAdapter(SLACK_VERIFICATION_TOKEN, endpoint="/slack_events")
78+
79+
Create an event listener for "reaction_added" events and print the emoji name
80+
81+
.. code:: python
82+
83+
@slack_events_adapter.on("reaction_added")
84+
def reaction_added(event):
85+
emoji = event.get("reaction")
86+
print(emoji)
87+
88+
89+
Start the server on port 3000
90+
91+
.. code-block:: python
92+
93+
slack_events_adapter.start(port=3000)
94+
95+
For a comprehensive list of available Slack `Events` and more information on
96+
`Scopes`, see https://api.slack.com/events-api
97+
98+
🤖 Examples
99+
--------
100+
101+
See `example.py`_ for usage examples. This example also utilizes OAuth and the
102+
SlackClient Web API client.
103+
104+
.. _example.py: /example/
105+
106+
🤔 Support
107+
-------
108+
109+
Need help? Join `dev4slack`_ and talk to us in `#slack-api`_.
110+
111+
You can also `create an Issue`_ right here on GitHub.
112+
113+
.. _Events API: https://api.slack.com/events-api
114+
.. _create a Slack App: https://api.slack.com/apps/new
115+
.. _Event Subscriptions: https://api.slack.com/events-api#subscriptions
116+
.. _dev4slack: http://dev4slack.xoxco.com/
117+
.. _#slack-api: https://dev4slack.slack.com/messages/slack-api/
118+
.. _create an Issue: https://github.com/slackapi/python-slack-events-api/issues/new

__init__.py

Whitespace-only changes.

dist/slackeventsapi-0.1.0.tar.gz

3.61 KB
Binary file not shown.

dist/slackeventsapi-1.0.0.tar.gz

3.61 KB
Binary file not shown.
3.61 KB
Binary file not shown.
3.61 KB
Binary file not shown.

dist/slackeventsapi-1.0.1.tar.gz

3.61 KB
Binary file not shown.

dist/slackeventsapi-1.0.2.tar.gz

3.61 KB
Binary file not shown.

0 commit comments

Comments
 (0)