A base for an on-call chat bot for Slack and extends classes from lins05/slackbot. While slackbot supports Python 2 and 3, this repository is Python 3+ only.
This project was built during Adobe "Garage Week" 2019 in order to support the easy creation of bots for on-call Slack channels that listen to events and can respond intelligently.
- PagerDuty integration for querying on call information
- Natural language processing (NLP) support for smarter bots using spaCy
- Currently only supports text categorization for message routing, but could support more in the future
- Supports Slack blocks in addition to attachments
First you need to get the slack api token for your bot. You have two options:
- If you use a bot user integration of slack, you can get the api token on the integration page.
- If you use a real slack user, you can generate an api token on slack web api page.
Follow the setup steps in the lins05/slackbot repository.
slackbot_settings.py:
PAGERDUTY_TOKEN = 'mytoken'
PAGERDUTY_SCHEDULE_ID = 'ABCDEFG'
PAGERDUTY_USERNAME_EMAIL_DOMAIN = 'adobe.com'
See the slackbot/plugins/oncall.py
file for examples of using the PagerDuty integration.
Before spaCy can be used, it must have a model trained for text categorization or text labels. Please note that message routing is currently only capable based on labels and not any other spaCy document properties.
If you already have a spaCy textcat model to use, you may skip this section completely.
You can use Yuri to classify slack messages, train a spaCy model, and test it. In the end you should have a directory containing the spaCy model files.
slackbot_settings.py:
SPACY_MODEL = '/model/dir'
This is the same directory that was generated using yuri or by manually training a spaCy model.
See the slackbot/plugins/nlp.py
file for examples of using NLP in your plugins.
To release a new version of this library, install bump2version
into a virtualenv, and then
call bump2version <part>
where part is major
, minor
, or patch
to update a certain part
of the version number. Then push the tag and the master branch. The tagged version will be
built on travis-ci.org and released to pypi and docker.