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.1.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.1-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for django_slack_tools-0.5.1.tar.gz
Algorithm Hash digest
SHA256 e9107f7d9c22db8e77c15deaf4bd24b5201cfc5eefd1983b2c214ce827e84a62
MD5 10e52a124c47ae121dce7d4042bb7b07
BLAKE2b-256 e7fceba2eb0c5c33530014b2dfdc4ad067f1992ac0ce015872087be4f7014951

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_slack_tools-0.5.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_slack_tools-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3826568bd0d377251303a60cda696cb3e0a896d6c1e36c8619245aad6d5c1c26
MD5 d2785158007d8b2cb2f3876e426fb2f3
BLAKE2b-256 bc793b5bcec05bad9991541524cee222b93eb1802e4d73cc27b99ae2712db0a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_slack_tools-0.5.1-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

This release

0.5.1 This release

2 files

0.5.0

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