Skip to main content

Channels Slack Notificaitons

https://img.shields.io/pypi/v/channels-slack-notifications.svg

If you want to asyncronously send low priority messages to a Slack channel using Django Channels this is the 3rd party library for you.

Partially inspired by django-slack https://github.com/lamby/django-slack. Adding support for channels and simplying the interface.

Requirements

  1. Django 1.8+

  2. channels

  3. requests

Quick Start

Add to INSTALLED_APPS and set your slack token:

INSTALLED_APPS = (
  # ...
  'channels_slack_notifications',
  # ...
)

CHANNELS_SLACK_TOKEN = 'yourtokenhere'

You can generate a tokens here: https://api.slack.com/web#authentication

Add to your routing.py:

from channels.routing import include
from channels_slack_notifications.routing import slack_routing

channels_routing = [
    include(slack_routing),
]

Send your first notification:

from channels import Channel

message = dict(
    text = 'this is a test',
)
Channel('slack-notifications').send(message)

This uses a bunch of defaults which you can override per setting, or just in the message dict.

You can use this management command to test your settings:

python manage.py test_slack_notification

Settings

CHANNELS_SL ACK_TOKEN ~~~~~~~~~~~~~~~~~~~~~~~~

Default: None

Your Slack authentication token.

You can generate a tokens here: https://api.slack.com/web#authentication

CHANNELS_SLACK_CHANNEL

Default: #general

Use this setting to set a default channel of the room the message should appear in.

You can override on a per-message level by specifying channel in your message dict.

CHANNELS_SLACK_USERNAME

Default: bot

Use this setting to set a default name the message will appear be sent from.

You can override on a per-message level by specifying username in your message dict.

CHANNELS_SLACK_ICON_EMOJI

Default: :robot:

Use this setting to set a default icon emoji.

You can override on a per-message level by specifying icon_emoji in your message dict.

CHANNELS_SLACK_BACKEND

Default: 'channels_slack_notifications.backends.console'

A string pointing to the eventual backend class that will actually send the message to the Slack API.

Use 'channels_slack_notifications.backends.default' in product which uses the requests library.

Metadata

Release files for channels-slack-notifications 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for channels-slack-notifications 0.0.2
File Size Uploaded
channels-slack-notifications-0.0.2.tar.gz 3.5 kB Details

Release files / channels-slack-notifications-0.0.2.tar.gz

Download URL channels-slack-notifications-0.0.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
75b5afceef5adf6e59b5e4ab3626a8075440d6ff70c1b99a0fe340ff5c1ed063
BLAKE2b-256 checksum
How to use checksums
03618e61b774803d1787d5feccef5f8ce536d8914feefb44ffa0f0eed855ac27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page