Let Your Team Fall in Love With Your Slackbot

Gone are the days when only obscure commands in little black windows could get DevOps stuff done. Chat bots are everywhere now!

There are quite a few tutorials on how to get your first Slackbot up and running. This is what comes after. You don’t want your bot relegated to a side channel or be the equivalent of command prompt in Slack.

After all, if @treebot responds in #forest which everyone has muted, has it really responded? On that note…

Everyone knows it’s a bot, but there is a world of difference between a bot that responds with ”calling InitiateGlobalThermonuclearWar method with parameter global” versus ”pretty sure the postage will kill us but sending nukes to all countries now”.

  • Give your bot a personality or pick a theme — maybe your bot moonlights as a pirate. And personalize —call it Bob, not BuilderBot.
  • Change up responses a bit — “doing it now”, “right away”, and “alright” mean pretty much the same, but picking one at random engages people more
  • Throw in a little fuzzy logic — “start the build”, “let’s build”, “build”, “it’s time!” and “release the kraken” should all do the same thing and is much better than a monochromatic “build now”.

Developers love things they can tinker with

  • Pick a language familiar to your team
  • Set up a code walk through
  • Make the code extensible and accessible
  • Make it easy to deploy the updated bot code

Slack has a ton of functionality. Don’t shy away from using it. Responding with files or images, prompting the user with action buttons, ephemeral messages, all provide a richer bot experience.

Set up a channel to redirect messages your bot cannot interpret. Sometimes minor changes can make a huge difference — automatically handling a common misspelling, or a prompt with a list of valid options when a message is partially valid.

Bots are usually side projects. But they deserve the same amount of care as a regular project. Your bot should be reliable, well tested, seldom break and never silently. Otherwise people will fall back to the trusted and reliable command line or web interface.

Make sure you bot is responsive even if the actual task takes a while. “Acknowledge and proceed” always beats “maybe it is running in the background”. User experience is a requirement no matter the medium.

Avoid the little warning icon that comes up when your code behind takes longer than 3 seconds to respond to a Slack command. The easiest way to do this is to store the command if it will take a while to process and respond immediately.

A side note about security. Bots are powerful but open up another attack vector.

Make sure the API processing Slack requests verify signatures using the signing secret. If your bot does restricted actions, make sure you have access control logic built into your code.

Finally ensure secrets are stored securely and that code updates are controlled as your normal source code is, if required.

Chat bots are a great way to streamline DevOps and make it more accessible. And when you get your team to work on great things, they will make them amazing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store