{"id":15019288,"url":"https://github.com/djangobot/djangobot","last_synced_at":"2025-07-20T08:33:14.059Z","repository":{"id":57419145,"uuid":"55930258","full_name":"djangobot/djangobot","owner":"djangobot","description":"Bridge between Slack and Django, via Channels","archived":false,"fork":false,"pushed_at":"2017-11-16T18:31:55.000Z","size":10,"stargazers_count":66,"open_issues_count":3,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-31T00:33:19.403Z","etag":null,"topics":["channels","django","slack","twisted"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djangobot.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-11T00:35:54.000Z","updated_at":"2021-07-20T06:54:23.000Z","dependencies_parsed_at":"2022-09-13T15:31:57.419Z","dependency_job_id":null,"html_url":"https://github.com/djangobot/djangobot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djangobot%2Fdjangobot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djangobot%2Fdjangobot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djangobot%2Fdjangobot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djangobot%2Fdjangobot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djangobot","download_url":"https://codeload.github.com/djangobot/djangobot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237944057,"owners_count":19391588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["channels","django","slack","twisted"],"created_at":"2024-09-24T19:53:16.653Z","updated_at":"2025-02-09T11:30:42.233Z","avatar_url":"https://github.com/djangobot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Djangobot\n\nDjangobot is a bridge between Slack and a [Channels](https://channels.readthedocs.org)-enabled Django app.\n\nSpecifically, it is a protocol server that produces and consumes messages for channels-based apps.\n\nIt is built atop [autobahn](http://autobahn.ws/python/) and [twisted](http://twistedmatrix.com/trac/).\n\n## Installation \u0026 Usage\n\nTo install, simply use pip.\n\n```shell\n$ pip install djangobot\n```\n\nDjangobot 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 `settings.py`.\n\nThen, assuming your django project is named `myapp`, the ASGI file is named `asgi.py` and you've created a channel layer in it named `channel_layer`, run this command:\n\n```shell\n$ DJANGOBOT_TOKEN=[your slack token] djangobot myapp.asgi:channel_layer\n```\n\nIn production, you'll want to keep this process alive with [supervisor](http://supervisord.org/), [circus](https://circus.readthedocs.org/en/latest/) or a similar tool.\n\n## What's it doing?\n\nWhen beginning `djangobot`, it will:\n\n1. Connect to the Slack API and request users and channels for your team.\n2. Initiate a [Real-Time Messaging Connection](https://api.slack.com/rtm).\n3. Forward any RTM events onto the `slack.{type}` channel. For example, message events\n  (whose `type` is `message`) are sent along the `slack.message` channel.\n4. Send any messages on the `slack.send` channel back to slack.\n\n## Receiving events in your application\n\nIn your `routing.py`, you'll need to specify consumer functions to handle events on the slack\nchannels like so:\n\n```python\nchannel_routing = {\n    'websocket.receive': 'path.to.my.consumer',\n    'websocket.connect': 'path.to.another.consumer',\n    'websocket.disconnect': 'path.to.yet.another.consumer',\n\n    # Slack channels\n    'slack.message': 'function.to.handle.slack.messages',\n    'slack.hello': 'handle.when.djangobot.connects',\n    # and so forth\n```\n\n## Sending messages to slack\n\nTo 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.\n\nFor example:\n\n```python\nimport channels\n\nchannels.Channel('slack.send').send({'text': 'Why hello there!', 'channel': 'general'})\n```\n\nOf course, part of the beauty of channels is that this can be done from anywhere.\n\n# Why is this useful?\n\nThis 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:\n\n1. Make Slack a logging destination.\n2. 2FA to approve certain tasks.\n3. Chat through Slack to users.\n\n# Contributing\n\n1. Fork this repository.\n2. Create a branch with your feature or bug fix.\n3. Work on it, push commits.\n4. Submit a Pull Request.\n\n# Todo\n\n1. Testing: I would appreciate help testing twisted clients.\n2. Setting up the reply channel: Right now both djangobot and applications must hard-code the `slack.send` outgoing channel name which isn't ideal.\n2. Logging: Djangobot could `logger.debug` a lot more.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjangobot%2Fdjangobot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjangobot%2Fdjangobot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjangobot%2Fdjangobot/lists"}