Breaking Bot is a chat bot for coordinating responses to "breaking incidents". It is built on RDBMS-backed data flows, a clean business core, and, at present, chat responsiveness through the Hubot framework.
Tumblr built the bot as bb8
many moons ago. WordPress VIP retuned the bot. And Automattic open sourced it.
Important
This particular fork of Breaking Bot is for WooCommerce. WooCommerce has a slightly different incident management process than WordPress VIP, and a slightly different Slack channel structure.
Breaking Bot is composed of the following major pieces:
data
- data structures
- RDBMS persistence
core
- finite state machines
- functions without side effects
boundary
- Comm Platform
- Annoyotron
- Archivist
- Syntrax
- Issue Tracker (optional)
- Report Platform (optional)
We use RDBMS backing because it's great. We use finite state machines in our core to contain the inherent, non-trivial, stateful complexity in incidents. We isolate business logic as much as we can into functions without side effects in the core. And we push our I/O concerns to the boundary layer.
Comm Platform, at present, is entwined with Hubot and Slack specifically. But we likely detangle all that in the long run. Issue Trackers and Report Platforms are simply interfaces. Anything implemented to their requirements will work in those roles.
Copy .env.example
file to .env
. This file will be read by docker-compose.yml
and will override the defaults there.
cp .env.example .env
You will need to be an owner of this workspace so that you have the required permissions. A workspace dedicated to bot development is ideal so that you aren't worried about noise or things going wrong.
- Create a new workspace on slack.com.
- Create a main channel for Breaking Bot in Slack, eg:
#breaking-test
. - Copy the channel ID and provide it in your
devConfig
file asbreakingMainRoom
. - Optionally, repeat steps 2 and 3 and set a
breakingNotifyRoom
if you would like Breaking Bot to drop important notifications somewhere other than thebreakingMainRoom
.
FYI, the workspace's dashboard is available via Settings & administration > Workspace settings.
- Create a Slack app using this app manifest.
- Install the app to your test workspace.
- Navigate to Settings -> Basic Information, generate, and copy an app token with
connections:write
scope in the App-Level Tokens section. Provide it to your.env
file asSLACK_APP_TOKEN
. - Navigate to Settings -> Install App and copy the Bot User OAuth Token. Provide it to your
.env
file asSLACK_BOT_TOKEN
. Make sure the app is installed to your workspace in this section too.
Install dependencies:
npm ci
Start the local environment with:
docker-compose up
If your configuration is correct, you will see INFO
level logging of Now connected to Slack
when the bot is ready to accept commands in your test Slack instance.
When you make changes to code, the bot will restart automatically (via ts-watch
). Note that changes to .env
or docker-compose.yml
are an exception and will require you to docker-compose stop
and start
.
To see all the HTTP requests being made, and crank up logger level with the following environment variables in .env
and restart docker-compose
.
HUBOT_LOG_LEVEL=debug
NODE_DEBUG=request
Iterative:
npm run test:watch
Single run:
npm test