This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# Djangobot

Djangobot is a bridge between Slack and a [Channels]( Django app.

Specifically, it is a protocol server that produces and consumes messages for channels-based apps.

It is built atop [autobahn]( and [twisted](

## Installation & Usage

To install, simply use pip.

$ pip install djangobot

Djangobot should be installed in the virtual environment of your application as it needs to be able to import one of the specified channel layers defined in your ``.

Then, assuming your django project is named `myapp`, the ASGI file is named `` and you've created a channel layer in it named `channel_layer`, run this command:

$ DJANGOBOT_TOKEN=[your slack token] djangobot myapp.asgi:channel_layer

In production, you'll want to keep this process alive with [supervisor](, [circus]( or a similar tool.

## What's it doing?

When beginning `djangobot`, it will:

1. Connect to the Slack API and request users and channels for your team.
2. Initiate a [Real-Time Messaging Connection](
3. Forward any RTM events onto the `slack.{type}` channel. For example, message events
(whose `type` is `message`) are sent along the `slack.message` channel.
4. Send any messages on the `slack.send` channel back to slack.

## Receiving events in your application

In your ``, you'll need to specify consumer functions to handle events on the slack
channels like so:

channel_routing = {
'websocket.receive': '',
'websocket.connect': '',
'websocket.disconnect': '',

# Slack channels
'slack.message': '',
'slack.hello': 'handle.when.djangobot.connects',
# and so forth

## Sending messages to slack

To send messages to slack, simply send a dictionary at least a `text` key. You may optionally include the `channel` on which to post the message. This can be the human-readable version or a channel id. Note that `djangobot` necessarily posts messages as the user tied to your Slack API token.

For example:

import channels

channels.Channel('slack.send').send({'text': 'Why hello there!', 'channel': 'general'})

Of course, part of the beauty of channels is that this can be done from anywhere.

# Why is this useful?

This simply bridges your slack team to your production application in real-time. On it's own, it does nothing else. Implementing actual features is up to you. Off the top of my head, some ideas:

1. Make Slack a logging destination.
2. 2FA to approve certain tasks.
3. Chat through Slack to users.

# Contributing

1. Fork this repository.
2. Create a branch with your feature or bug fix.
3. Work on it, push commits.
4. Submit a Pull Request.

# Todo

1. Testing: I would appreciate help testing twisted clients.
2. Setting up the reply channel: Right now the
2. Logging: Djangobot could `logger.debug` a lot more.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
djangobot-0.1.macosx-10.10-x86_64.tar.gz (9.9 kB) Copy SHA256 Checksum SHA256 any Dumb Binary Apr 11, 2016
djangobot-0.1-py2.py3-none-any.whl (9.4 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Apr 11, 2016
djangobot-0.1.tar.gz (5.9 kB) Copy SHA256 Checksum SHA256 Source Apr 11, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting