10/22/2023 0 Comments Django slack bot![]() ![]() Put the following to your slack.py inside your app's directory. If you already have a bot that you want to use with django-slack. ( 'example', require_linked_account = True ) def scrumie_staging_command ( request, slack_user_mapping, slack_workspace ): print ( slack_user_mapping, slack_workspace ) return JsonResponse () Slack Interactivity This project provides easy-to-use integration between Django projects and the Slack. If you want to create a new Slack command with name /example, configure your Request URL as /slack/commands/example/ and put the following code into slack.py inside your app's directory. (Optional) Configure your Slash commands's Request URL as /slack/commands// (Optional) Put /slack/interactivity/ as your Request URL in Interactive Components section Update your settings.py SLACK_CLIENT_ID = "" SLACK_CLIENT_SECRET = "" SLACK_SIGNING_SECRET = "" SLACK_LOGIN_OAUTH_REDIRECT_URL = "" SLACK_INSTALL_OAUTH_REDIRECT_URL = ""Īdd following URLs to your Slack app's Redirect URLs (OAuth & Permissions) /slack/oauthcallback/ Run python manage.py migrate to create the slack_app models.Īdd slack_app.auth_backends.SlackAuthenticationBackend to your AUTHENTICATION_BACKENDS AUTHENTICATION_BACKENDS = Include the urls in your project urls.py like this: path('slack/', include('slack_app.urls')), Views - OAuth callbacks for "Add To Slack" and "Login With Slack" actionsĪdd 'slack_app' to your INSTALLED_APPS setting like this: INSTALLED_APPS =.Authorisation backend - allows you to pair your existing user model with your Slack users.Decorators - help you to write implementation of your Slack endpoints.Models - needed to keep information from Slack API.This application helps you to integrate your existing Django application with Slack. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |