This is a django wrapper to handle slack events and slash commands.
Project description
DJANGO SLACK EVENT WRAPPER
This is a django wrapper to handle slack events and slash commands. It also verifies incoming events using x-slack-signature and x-slack-timestamp. It receives slack events, slash commands and delivers gracefully with the events.
CONFIGURATION AND SETUP
>settings.py
INSTALLED_APPS = [
'django_slack_event_wrapper',
...
]
CONFIGURATIONS
=============
VERIFICATION_TOKEN = XXXXXXXXXXXXXXXXXXXXX
SIGNING_SECRET = XXXXXXXXXXXXXXXXXXXXX
APP_ID = XXXXXXXXXXXXXXXXXXXXX
OAUTH_TOKEN = XXXXXXXXXXXXXXXXXXXXX
BOT_ID = XXXXXXXXXXXXXXXXXXXXX
>urls.py
open your projects urls.py file and add the following
urlpatterns = [
path('slack-app/', include('django_slack_event_wrapper.urls')),
....
]
Note: you can change the name from slack-app to whatever you like.
When registering your webhook urls to slack, you use the following:
1. For Events: http[s]://yourdomain.name/slack-app/events [If you changed the root url name, you but that instead of slack-app]
2. For Slash Commands: http[s]://yourdomain.name/slack-app/slash-commands [If you changed the root url name, you but that instead of slack-app]
EXAMPLE
NOTE: Create A slack.py file
from django_slack_event_wrapper.dispatcher import slack_event_emitter, slash_command_emitter
from rest_framework.response import Response
EVENT
@slack_event_emitter("message")
def on_message(event, **kwargs):
print(event)
# have fun
SLASH COMMAND
@slash_command_emitter('/message-count')
def message_count(user_id, channel_id, slash_event_data, **kwargs):
print(user_id, channel_id)
# have fun
Change Log
==========
0.1.12(11-10-2021)
- First Release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django_slack_event_wrapper-0.1.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c298f80526e5c2f49a1e9446adaa2034f9c0c76cd1f8645dac6418c8094d4f99 |
|
MD5 | a043e9190802dd54200db4cf2522fa7b |
|
BLAKE2b-256 | a98de466db25b4ce545dd1f942503846545421324057733e5ff8e670279ce038 |