Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jordaneremieff/django-rest-slack
Easily handle Slack API events and commands using Django
https://github.com/jordaneremieff/django-rest-slack
aws-lambda django django-rest-framework slack slack-api
Last synced: 21 days ago
JSON representation
Easily handle Slack API events and commands using Django
- Host: GitHub
- URL: https://github.com/jordaneremieff/django-rest-slack
- Owner: jordaneremieff
- License: mit
- Created: 2018-03-03T13:52:10.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2020-06-13T05:21:24.000Z (over 4 years ago)
- Last Synced: 2024-10-12T18:57:33.193Z (26 days ago)
- Topics: aws-lambda, django, django-rest-framework, slack, slack-api
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# django-rest-slack
A simple, reusable Django app for handling and storing Slack events and slash commands.
## Requirements
- Python 3.6
- PostgreSQL
- Django 2.0+
- DRF## Setup
- `pip install django django-rest-framework django-rest-slack psycopg2-binary`
- Include the following to your settings.py:
```
INSTALLED_APPS = [
'rest_framework',
'rest_slack',
]
```- Include the following to your urls.py:
```
from django.conf.urls import include
from rest_slack.views import DRSEventView, DRSCommandViewapi_patterns = ([
path('events/', DRSEventView.as_view()),
path('commands/', DRSCommandView.as_view()),
], 'api')urlpatterns += [
path('api/v1/', include(api_patterns)),
]
```- Add your environment variables:
```
export SLACK_CLIENT_ID='your-credential'
export SLACK_CLIENT_SECRET='your-credential'
export SLACK_VERIFICATION_TOKEN='your-credential'
export SLACK_BOT_USER_TOKEN='your-credential'
```## Running with Zappa
- `pip install zappa`
- `zappa init`
- Create a Postgres DB in AWS RDS
- Update your zappa_settings.json with the `vpc_config` information:
```
"vpc_config" : {
"SubnetIds": [ "subnet-","subnet-" ],
"SecurityGroupIds": [ "sg-" ]
}
```- `zappa deploy `
- Update your settings.py with the hostname created in AWS
```
ALLOWED_HOSTS = ['host.name']
```- `zappa update `
## Todo
- More detailed instructions / examples