Creating a Command
Did you know that you can command Workbot to do things for you from Slack? Workbot has been helping our users perform all kinds of tasks like:
- Adding subscribers to a list in Mailchimp by telling Workbot: “Mailchimp add subscriber”
- Getting a breakdown of incident reports from ServiceNow via a pie chart (in Slack!) by telling Workbot: “ServiceNow report incident”
- Creating an issue in Github by telling Workbot to "Create a Github issue”
Anatomy of a Command trigger
A command consists of 3 parts;
action data - and can be used to trigger recipes. You can also prompt users for more info if they’re required to perform the recipe actions via Command input fields.
You can find the list of all the input fields for Command below, but for now, let’s focus on App, Action, Action data and Command input fields so we can create our very first command.
|New command trigger input field||Description|
This is the 1st part of the command; it defines which application this command relates to, e.g.
Github, ServiceNow, etc.
This is the 2nd part of the command; it defines what action to perform onto the App data, e.g.
Create, Show, List, etc.
The 3rd and last part of the command; it defines what sort of data to act on e.g.
Opportunity, Issue, Invoice, etc.
|Command input fields||
The data to ask from the user so as to successfully carry out recipe actions, defined in a specific format. Parameters may have the type:
You can use this file in subsequent operations using the Workbot action Download Attachment.
|Help text||Short description of what the command does. Shows up in the Workbot app page under Commands.|
If yes, command will not show up as a button in the Slack channel when the user types app name.
If no, command will show up as a button in the Slack channel when the user types the app name.
Creating a Command
In this exercise, we'll be creating a command that triggers a recipe that creates an issue in Github.
Creating a command
- Create a new recipe
- Under Application, choose Workbot. This allows you to choose Workbox-related triggers.
- Under Trigger, choose New Command
Creating a new Command
Defining the command
Workbot understands commands in 3 parts:
We’ll be creating a command that tells Workbot to Create a Github issue”. Because Workbot has built-in Natural Language Understanding (NLU) capabilities, Workbot is flexible with how the command is phrased. You have the freedom to type in the commands in any sequence that's most natural to you, e.g. "create an issue in Github"
app: This is the 1st word of the phrase; it defines which application this command relates to. In this case, “Github” is the application we want.
action: This is the 2nd part of the command; it defines what action to perform onto the
action data. “Create” is what we’ll go with here.
action data: The 3rd part of the command; it defines what sort of data to act on e.g. Opportunity, Issue, Invoice, etc. Let’s go with “issue” here.
Command input fields
Sometimes, Workbot needs more input from the user before it can trigger the recipe and carry out its actions. Command input fields let you define each input, along with how they should behave in Slack. Click on + Add command input to add command input fields.
Add command input fields
In this case, Workbot will need 3 things from the user before he can create an issue in Github: the issue "title", the “description” of the issue, and the “assignee” to assign the issue to. Hence,
assignee are the 3 command input fields we’ll define. Since only
name is required here, we’ll skip configuring the others for now.
Adding a new user input field
How your command should look like at this point: Github Create Issue recipe: Command section
How it will look like on Slack:
Before Workbot can create the issue on Github, we’ll need to define follow-up recipe actions. Also, notice the final message Workbot sent? That’s a command reply - we’ll go through that later!
Command output datapills
Command will also provide you with a set of datapills that hold additional info about the command e.g. the user making the command, the channel which the command was made it, etc. The following table details these datapill variables: Command output datatree. Notice the command input parameters we included in the earlier step? They’re datapills too!
And with that, we're done configuring the command! Now it’s time to add a series of actions to this trigger. Remember, we’re trying to get Workbot to create an issue in Github from Slack (link to the top), so we still need to create action steps in the recipe to do that. Next, we'll take a look at how to create a Command Reply.