Skip to main content

django-slack-tools

License: MIT codecov PyPI - Version

Little helpers for working with Slack bots 🤖 in Django.

This project aims to implement helpful features for Slack bots and to provide reusable Django apps with database integration.

✨ Features

  • Reusable Django app for Slack messaging with various messaging backends for different environments
  • Database-backed Slack messaging policies with simple dictionary-based templates
  • Message histories
  • Built-in admin for managing Slack workspace integrations
  • Celery support for messaging backends, management tasks, and shortcut workflows
  • Django template support

And more on the future roadmap...

  • New Django apps and helpers for Slack features such as modals, event subscriptions, etc.
  • Better templating experience
  • A more complete working example with richer documentation

Currently it is focused on messaging features. In the future, we hope to add more helpful Slack bot features across the ecosystem, such as event subscriptions, modals, and bot interactions.

🚀 Quick start

[!WARNING] This project is still in early development and not recommended for production use.

Install the package:

$ pip install django-slack-tools

Add the app to your Django settings:

INSTALLED_APPS = [
    ...
    "django.contrib.messages", # Used in admin
    "django_slack_tools.slack_messages",
    ...
]

Add configuration for the application (the Slack app should already be configured):

DJANGO_SLACK_TOOLS = {
    "slack_app": "<module.path.to.your-slack-app>",
    "messengers": {
        "default": {
            "class": "django_slack_tools.messenger.shortcuts.Messenger",
            "kwargs": {
                "template_loaders": [
                    "django_slack_tools.slack_messages.messenger.DjangoTemplateLoader",
                ],
                "middlewares": [],
                "messaging_backend": {
                    "class": "django_slack_tools.messenger.shortcuts.SlackBackend",
                    "kwargs": {
                        "slack_app": "<module.path.to.your-slack-app>",
                    },
                },
            },
        },
    }
}

Then run the database migration and create a greet.xml file in your templates/ directory:

<root>
    <block type="section">
        <text type="mrkdwn">
            {{ greet }}
        </text>
    </block>
</root>

Send a message:

from django_slack_tools.slack_messages.shortcuts import slack_message

message = slack_message(
    "<channel-id>",
    template="greet.xml",
    context={"greet": "Hello, World!"},
)

Please check the documentation for more examples and details.

💖 Contributing

All contributions and help are welcome. Please check the CONTRIBUTING.md file for contribution guides.

📜 License

This project is licensed under the terms of the MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_slack_tools-0.5.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_slack_tools-0.5.0-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file django_slack_tools-0.5.0.tar.gz.

File metadata

  • Download URL: django_slack_tools-0.5.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for django_slack_tools-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c37490422086303d2ccf7b8f1d45fabcaf9739010d2c725d084bc42dfb651320
MD5 41b3ed171301cc42aa706a5369d4c8a1
BLAKE2b-256 d2098ce104dee802eebffca36052c99c51e2a68b7fbd8ca7433bf18ff5be4fe2

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_slack_tools-0.5.0.tar.gz:

Publisher: release.yaml on lasuillard-s/django-slack-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_slack_tools-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_slack_tools-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab9ac2607b8dd2e421be18cd1ffb14d532b737873ab8c607fec94a09a9558f31
MD5 5af08a4d1d7defee19ac93e0cc7c492b
BLAKE2b-256 adb26efb09be53149280b56c4a3da775f9ddd77ab50e9e8536b3641f955cf407

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_slack_tools-0.5.0-py3-none-any.whl:

Publisher: release.yaml on lasuillard-s/django-slack-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.1

2 files

This release

0.5.0 This release

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.2

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page