using bots chatops

Using bots to increase ChatOps efficiency

Let’s face it: It’s been a long time since messaging was just about human-to-human communication (for high-performing organizations, at least). Today, bots and integrations are first-class citizens of messaging tools, and with good reason.

Instead of waiting for a member of the DevOps team to receive an OpsGenie alert when a cloud system experiences a hiccup—and then waiting for the rest of the team to learn about the problem through a cascade of messages and email—both actions can be handled within seconds with automated alerts inside of Mattermost.

Bringing automation to more users

With bots, even more efficient workflows beyond one-way alerts about system health are possible. Bots allow for a friendly, two-way interface between your users and the various tools and SaaS products they use every day. This turns Mattermost into a command line for your teams’ entire operations and lets team members work inside of a shared application that they already have open (instead of needing to constantly tab back and forth between several different websites).

Bots and other integrations are just programs within your messaging environment that enable you to send commands and messages out to other tools or receive messages back from them. They can be as simple as canned, humorous responses or reminders or as complex as interactive command and status interfaces with your production infrastructure—all in chat.

This has a bigger impact than just saving a few clicks here and there. Bots within Mattermost are in direct proximity to your entire team. Almost every organization has a few tools that are purchased for the team but are only used by a select few because they never make their way into daily workflows. Bots solve this problem by allowing your team to easily fit valuable tools into their workflows (and to see that others are doing the same), enabling everyone to benefit from powerful automated tools. When it takes more effort not to use available bots, they tend to be adopted faster. 

Giving automation a friendly face

With the exception of the emotional attachment some developers have for their IDEs, software tools don’t tend to elicit the fuzziest of feelings. Bots have a few handy features that make automation much more friendly and help people become comfortable adopting new kinds of automated tools and workflows.

Bots typically are highly customizable, allowing you to provide a friendly, approachable interface to automated commands and alerts. Choose how you want automated messages to appear, what useful information they should provide, and what channels they appear in. Likewise, slash commands that control bots are often far easier to learn than an entire new toolchain.

Bots know how to be subtle

Sometimes you want a bot to alert the entire team about an event. But bots can also be smart (and customizable) enough to alert specific users via private channels or even direct messages when appropriate. This creates new scenarios that can be easily addressed with bots, such as alerting a user that tests failed for their feature branch.

User-specific messages also make sure the messages that show up in channels are actually valuable to the entire channel. Anyone who has scaled an organization knows that communicating the right information with the right people (without oversharing with anyone) is a serious challenge. Bots can help by ensuring only relevant information is shared with team members.

By the same token, bots can communicate useful information across teams when necessary by being integrated into multiple channels—even when the teams aren’t in the same organization or have different functions. 

Choosing useful bots

Every team has their own needs and their own ideal bot setup. But there are a few popular bots you should know about.

Hubot is a popular chatbot created by GitHub. Hubot makes it easy to write your own customizable scripts and commands that interact with remote services via a RESTful API and web sockets. Community-created scripts allow functionality such as creating Asana tasks and querying Grafana.

BotKube makes it possible to run kubectl on your team’s Kubernetes cluster from chat. You can also install BotKube in a specific channel and get notifications about the health of your Kubernetes cluster and lifecycle events.

The Mattermost Jenkins Plugin lets you easily interact with continuous integration (CI) jobs and builds using slash commands. You can enable and disable jobs, create builds, and get results from builds and tests.

Parting thoughts: Get started using bots

Beyond increasing effectiveness and helping to manage alerts, bots are also a great way to run prepared scripts and commands, which is always useful for minimizing user errors.

If you’d like to start using bots within your own team, begin with a few small steps. Take a look at the existing Mattermost integrations and find a couple of the tools that you’re already using for deployment. Start sending high-value alerts to a shared channel and then move on to sending commands and updates to your tools through the bot interface. 

Once you feel comfortable with the workflow, download Hubot and try creating a few custom scripts of your own.

After getting comfortable using existing integrations and bots to automate your team’s processes, you’re ready to create bots of your own and share them with the rest of the world.

To learn more, check out some of our related reading including the Mattermost Integrations documentation, our ChatOps homepage, and our blog post How to Create a Chatbot with Dialogflow and Google Cloud Functions.

(Editor’s noteThis post was written by James Timmins, software consultant and Python developerIf you have any feedback or questions about Using bots to increase ChatOps efficiency, please let us know.)

Read more about:


James is a software consultant and Python developer. When he's not writing Python, he's usually writing about it in blog or book form.