Skip to main content

django-slack-notifications

Extremely simple and easy slack integration with django.

Overview

Requirements

Installation

Install using pip

pip install django-slack-notifications

Add django-slack-notifications to your INSTALLED_APPS setting.

INSTALLED_APPS = (
    ...
    'django-slack-notifications',
)

Add SLACK_NOTIFICATIONS to your settings.py

SLACK_NOTIFICATIONS = {
    'WEBHOOK_URL': '{your slack webhook url}'
    'CHANNEL': '{default slack channel that you want to send message.}',
    'USERNAME': '{default message sender name}',
    'ICON_EMOJI': '{default sender emoticon}',
}

WEBHOOK URL is required. You can get your webhook url from slack. See https://api.slack.com/custom-integrations

CHANNEL, USERNAME, ICON_EMOJI is optional parameters. If default value is set, you don’t need to pass parameter to your send_message method. See below.

Usage

In your python code,

from django-slack-notifications.utils import send_message

send_message(channel='#general', username='test', text="Hi, I'm a test message.")

send_message returns default slack response. If succeed, it returns 200.

If you set default values CHANNEL, USERNAME, you can call send_message like…

from django-slack-notifications.utils import send_message

send_message(text="Hi, I'm a test message.")

channel and username is set default value that you defined in settings.py

if ICON_EMOJI is not set, it uses default slack webhook integrations settings that you’ve defined at https://prnd.slack.com/apps/manage/custom-integrations

Release files for django-slack-notification 1.0.0

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

Source distribution (sdist)

Source distribution for django-slack-notification 1.0.0
File Size Uploaded
django-slack-notification-1.0.0.tar.gz 3.0 kB Details

Release files / django-slack-notification-1.0.0.tar.gz

Download URL django-slack-notification-1.0.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4182ad6558e685744b4c5974e0b03b13d417f05476b7ae020251805f82a35793
BLAKE2b-256 checksum
How to use checksums
4eb717a429ce4f278b9fff81d3c47e5b39bf16b1683482fa3c767262055a5aaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.0 This release

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