{ "info": { "author": "Scott Burns", "author_email": "scott.s.burns@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# 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 & 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\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 the \n2. Logging: Djangobot could `logger.debug` a lot more.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/djangobot/djangobot", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "djangobot", "package_url": "https://pypi.org/project/djangobot/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/djangobot/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/djangobot/djangobot" }, "release_url": "https://pypi.org/project/djangobot/0.1/", "requires_dist": null, "requires_python": null, "summary": "Bridge between Slack and Channels-based Django apps", "version": "0.1" }, "last_serial": 2057625, "releases": { "0.1": [ { "comment_text": "built for Darwin-15.4.0", "digests": { "md5": "8e44e61956b2cedf467952cb36107fc5", "sha256": "b7a293ee46406eec32243b4350740caea5bc13a151b321bfdf52777fa37a6128" }, "downloads": -1, "filename": "djangobot-0.1.macosx-10.10-x86_64.tar.gz", "has_sig": false, "md5_digest": "8e44e61956b2cedf467952cb36107fc5", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 9946, "upload_time": "2016-04-11T00:44:50", "url": "https://files.pythonhosted.org/packages/b1/35/df94ef550b808eed33deff746b97f47564573f3da890d72e8c038ddce9d0/djangobot-0.1.macosx-10.10-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "21b0dcf695f2656f676bbfa71f0f6c65", "sha256": "b3c02e57b57b82c8197e35c8f1707b7347d32d0e436205930f7f44f281b97bd1" }, "downloads": -1, "filename": "djangobot-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "21b0dcf695f2656f676bbfa71f0f6c65", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9384, "upload_time": "2016-04-11T12:37:55", "url": "https://files.pythonhosted.org/packages/aa/24/9eb240ec868f7bfaa8b503afb8c9bc3093ac7c8c1d6d23697386d6a30b50/djangobot-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ac7a9feb3cb2cba7cb2f5b617cdc2feb", "sha256": "14a4084602afb9b7349b450baf67237b22b1695ed77b17a7ef55c646680741d3" }, "downloads": -1, "filename": "djangobot-0.1.tar.gz", "has_sig": false, "md5_digest": "ac7a9feb3cb2cba7cb2f5b617cdc2feb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5893, "upload_time": "2016-04-11T00:43:03", "url": "https://files.pythonhosted.org/packages/5b/90/4dde11498506de70c897d74dd2aaaee93da341ff84e50e84dbe12d65e8d8/djangobot-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "built for Darwin-15.4.0", "digests": { "md5": "8e44e61956b2cedf467952cb36107fc5", "sha256": "b7a293ee46406eec32243b4350740caea5bc13a151b321bfdf52777fa37a6128" }, "downloads": -1, "filename": "djangobot-0.1.macosx-10.10-x86_64.tar.gz", "has_sig": false, "md5_digest": "8e44e61956b2cedf467952cb36107fc5", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 9946, "upload_time": "2016-04-11T00:44:50", "url": "https://files.pythonhosted.org/packages/b1/35/df94ef550b808eed33deff746b97f47564573f3da890d72e8c038ddce9d0/djangobot-0.1.macosx-10.10-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "21b0dcf695f2656f676bbfa71f0f6c65", "sha256": "b3c02e57b57b82c8197e35c8f1707b7347d32d0e436205930f7f44f281b97bd1" }, "downloads": -1, "filename": "djangobot-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "21b0dcf695f2656f676bbfa71f0f6c65", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9384, "upload_time": "2016-04-11T12:37:55", "url": "https://files.pythonhosted.org/packages/aa/24/9eb240ec868f7bfaa8b503afb8c9bc3093ac7c8c1d6d23697386d6a30b50/djangobot-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ac7a9feb3cb2cba7cb2f5b617cdc2feb", "sha256": "14a4084602afb9b7349b450baf67237b22b1695ed77b17a7ef55c646680741d3" }, "downloads": -1, "filename": "djangobot-0.1.tar.gz", "has_sig": false, "md5_digest": "ac7a9feb3cb2cba7cb2f5b617cdc2feb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5893, "upload_time": "2016-04-11T00:43:03", "url": "https://files.pythonhosted.org/packages/5b/90/4dde11498506de70c897d74dd2aaaee93da341ff84e50e84dbe12d65e8d8/djangobot-0.1.tar.gz" } ] }