Delightful workflows from Slack

This post will change your life. Promise.

Vishwa Krishnakumar
Frontiers
6 min readSep 27, 2017

--

We all love Slack — it is the epicenter of your work. You get all your work updates in Slack. You use bots and slash commands to take actions across your apps. But while you can take actions through commands across individual apps in Slack, the nature of work is such that you, more often than not, deal in workflows. Sometimes an event occurs and you follow a standard procedure as a response to the event. Most of the time, you need to take actions across multiple apps. And you do it in two ways:

  1. If you’re not into bots, you keep multiple tabs open, go from tab to tab, and do your thing — often repeating the process multiple times in a day.
  2. If you’re using bots, you shoot multiple commands to the individual application bots one by one.

This can be painful and feel like a giant waste of time. Well no more. Workflows are here — courtesy YellowAnt! You can now create complex command without writing a single piece of code and execute them from Slack. It would look something like below.

What is YellowAntYellowAnt is an enterprise-grade ChatOps platform that lets you manage and automate your work.

Command triggered workflows

BYOC (Bring your own commands) — Creating a command in a format you like

Some background — YellowAnt has a marketplace of applications — Git, CI/CD, Application and Error Monitoring, Project Management and a bunch of the DevOps tools. Every application is comprised of commands and triggers. For example, YellowAnt Jenkins application has a command that starts a job — jenkins start job <job-name>. It also has a trigger that notifies you when a build is done — job_notification. Each commands returns a message along with some data that you can use for post-processing.

Workflows are basically a sequence of commands. You can take data sent by a command as inputs to another command. YellowAnt has two kinds of Workflows — Command-triggered(triggered by a command on Slack) and Event-triggered (triggered by a background event, works exactly like Zapier, IFTTT etc.)

In this post, we will explore command triggered workflows(or “Crumbs” as we call it) with an example. Let’s create one Slack command that gets a high-priority PagerDuty incident, creates a JIRA issue, sends an email to the Test team, and creates a calendar event for a war room meeting. Normally, this process would take atleast 5 minutes. With this command, it will take 5 seconds.

Let’s begin.

  1. Create a YellowAnt account. It’s free and takes 5 seconds if you have a Slack account. A @yellowant bot will be created inside your team Slack
  2. Go to the YellowAnt marketplace. Search for and Integrate PagerDuty(guide), JIRA(guide), GMail(easy) and Google Calendar(easy)
  • Click on “Integrate”

3. In the YellowAnt console, click on “Create a Crumb”. Crumbs are workflows

4. Click on Create New

Select Command-based Crumb

In the Trigger area, select your custom command name. In this case, we have given war-room. Our custom command will now start with war-room

In the Input arguments section, define the arguments(or variables) that this command will take. Click on Add a new input argument. In this case, the arguments will be id(Id of the PagerDuty incident).

It is now time to add some actions.

Our first action will be to search for the PagerDuty incident with Id ‘id’. Our second action will be to create a JIRA ticket from the data that PagerDuty incident command returns.

Click on Add Action.

Select PagerDuty.

Fetching incident details

In the actions, select get_incident

Fetching the incident details from PagerDuty

The get_incident command takes one argument, i.e the incident_number. This corresponds to the id that we will pass in the argument. Click on the incident_number textbox and type @ .This will bring a dropdown of all the available variable that we will pass in our command. Select id.

The next action is to create a JIRA ticket. Click on Add Action and select JIRA. In the actions dropdown, select createissue.

The PagerDuty get_incident command gives us a bunch of data to use to create a new JIRA ticket. Use the @ symbol to select the variable in the inputs. You can use multiple variables within one input box — YellowAnt automatically concatenates them into one string.

Creating a JIRA ticket from Pagerduty data

It’s time to send a mail to the testing team

Click on Add Action. Select GMail. In the function list, select send.

Creating an Email from Pagerduty data

Format your subject and message using the @ symbol to get data from the PagerDuty command.

It’s now time to call a war room meeting using Google Calendar.

Click on Add Action. Select Google Calendar. In the function list, select create.

Describe the event name — you can add some data from the previous steps using the @ symbol. The event variable takes the event description in natural language. So you can say something like — war room meeting for PD escalation @incident_number in the next 5 minutes.

Creating a Google Calendar event

Click on Save.

Congratulations! You have just created a Crumb!

Prepare to be dazzled!

Go to Slack and click on the @yellowant bot DM.

The comand syntax for your new command is:

<command-name> run <argument-1> <value-1> <argument-n> <value-n>

So, in our case, our final command will be:

war-room run id “2”

Check out the response!

The JIRA issue creation

The EMail to the test team

The calendar invite for a war-room meeting

It’s that simple!

What do you think? Did you find this useful? Let us know in the comments below and join us in the YellowAnt community here. You can sign up on YellowAnt here.

--

--