# Workbot triggers for Slack
Workbot for Slack allows you to send commands to Workbot on Slack. Workbot will handle these commands and interact with your connected apps to do things, such as display details of a customer account, close opportunities, display a list of invoices or tickets, or create/update existing tickets.
Each Workbot command is processed using a Workato recipe. The recipe trigger picks up the Workbot command as a trigger event, and the recipe determines the actions to carry out. With Workbot, you can create custom workflows that execute via your Slack commands, and optionally retrieve relevant data for you back to Slack.
The Workbot for Slack connector has 5 triggers:
- New command
- New help message
- New event (real-time)
- New shortcut trigger
- New URL mention
- New dynamic menu event
# New command trigger (building custom commands)
This trigger requires you to configure an Enterprise Workbot command. When this recipe is started, Workbot will monitor for that command. Whenever the command is called, Workbot proceeds to carry out the recipe actions.
# New command trigger input fields
The following table lists the configurable input fields in the trigger, and what each field does.
New command trigger input field | Description |
---|---|
App |
1st part of the Workbot command. The app that the Workbot command is working with for example, Salesforce |
Action |
2nd part of the Workbot command. What the Workbot command is doing with the action data, for example,show , create , update .
|
Action data |
3rd part of the Workbot command. The record that the Workbot command works with, for example,invoice , customer , ticket .
|
Command input fields |
The input to ask from the user so as to successfully carry out recipe actions, defined in a specific format. Parameters may have the type file , which accepts file content (for example, text, binary content) as input. This can be uploaded into Slack. You can use this file in subsequent operations using the Workbot action Download Attachment. |
Command hint | Short description of what the command does. Shows up in the Workbot app page under Commands. |
Hidden command | 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 app name. |
# Workbot command format
The Workbot command is created by piecing 3 elements together, the app
, action
, and action data
:
app action action-data
In the following case, the application is "Salesforce", command action is "Show", and business data is "Account". The command that Workbot will respond to is therefore:
Salesforce show account
# Workbot command input parameters format
The command input fields field lets you decide what data is needed from the user to carry out the recipe actions successfully.
Each input parameter has to be provided in the following format:
param_name optional:true prompt:false type:string hint:hint_to_help_users sample:example_data
Command input fields | Description |
---|---|
Name | Required. Needs to be a single word. |
Optional |
Not required. If not defined, defaults to optional:true . Input parameter will be optional.
|
Prompt |
Not required. If not defined, defaults to prompt:false . No prompt will be generated.
|
Data Type |
Not required. If not defined, defaults to type:string . Possible types are string , boolean , number , file , and date_time .
|
Hint | Not required. If not defined, defaults to no hint. |
Example | Not required. If not defined, defaults to no sample data. |
In this case, to successfully retrieve Salesforce account data, we need the full account name from the Slack user.
name optional: false prompt: false type: string hint: Exact account name sample: IBM
The configured command input fields will be displayed as follow up questions for the user after the Workbot command.
A command input field displayed on Slack
# New command trigger output datapills
The New command trigger also provides a set of datapill variables that holds data about the command, such as the user making the command, the channel the command was made it, etc. The following table details these datapill variables.
New bot command output datatree
The following table lists the output datapills from the trigger, and what data each field contains.
New command trigger datapill variables | Description |
---|---|
App |
1st part of the Workbot command. The app that the Workbot command is working with for example, Salesforce |
Action data |
2nd part of the Workbot command. What the Workbot command is doing with the action data, for example,show , create , update .
|
Action |
3rd part of the Workbot command. The record that the Workbot command works with, for example,invoice , customer , ticket .
|
Message ID |
The epoch time when the Workbot command was sent. Can be used to populate Thread ID input fields to create a thread under this Workbot command message. Can also be used in Message to update, to overwrite a previously posted message. |
Context | Slack data about this Workbot command, for example, the team and channel it was posted in, the user who posted it, ID of the thread it was in, if applicable. |
Command input parameters | Data obtained from the user by asking follow up questions to their Workbot command. |
The following table holds additional information about the Context object and the data it correspondingly holds.
Context datapill variables | Description |
---|---|
Team | Slack team ID |
User | Slack user ID |
Reply Channel | Slack channel ID where message was posted |
User handle | Slack user handle |
User email | Slack user email |
User name | Slack user friendly name |
Thread ID |
Thread ID if message was posted to thread, null otherwise
|
The following table holds additional information about the Modals object and the data it correspondingly holds.
Modal datapills | Description |
---|---|
View ID | View ID of view from which command was invoked, a.k.a. the active view. If the command was invoked from a view submission, then this view ID cannot be used for updating/pushing views as the view has already closed on submission. If only 1 view is active, then this view ID will be identical to the root view ID. |
Root View ID | View ID of the root view. |
Previous View ID | View ID of the view beneath the current view |
Private metadata | Private data you can optionally use to pass to downstream recipes. This field is encrypted and hidden from users. |
Hash | A unique value you can optionally use when updating modals. When provided, the hash is validated such that only the most recent view is updated, ensuring the correct view is being updated when updates are happening asynchronously. |
Triggers may contain Message ID in their output. Message ID has a value only when New command was triggered by a button action. If the command was triggered as a result of a manually typed command, this field will be empty.
# Example: Salesforce show account command
In the following gif, we're chatting directly with Workbot via a DM. When we type in the app name "Salesforce", Workbot generates a list of available commands and displays them as buttons. The command can also be manually typed into the DM as Salesforce show account
.
Salesforce show account command
When the Salesforce show account
command is called, either via the button click or the typed command, a corresponding recipe with a Workbot for Slack new command trigger will trigger. This recipe will have a Workbot New command trigger that listens specifically to the command Salesforce show account
. The pre-built Workbot for Slack recipe (opens new window) that does this can be found below.
Salesforce show account command recipe Example recipe (opens new window)
The trigger configuration for the Salesforce show account
command is as follows.
Salesforce show account command trigger configuration
We know that Workbot commands are created by piecing 3 elements together, the app
, action
, and action data
. In this case, application is "Salesforce", command action is "Show", and business data is "Account". The command that Workbot will respond to is therefore Salesforce show account
.
The command input parameters field lets you decide what data is needed from the user to carry out the recipe actions successfully. In this case, to successfully retrieve Salesforce account data, we need the full account name from the Slack user, so we define the parameter as follows:
Salesforce show account command input field configuration
The configured command input parameter will be displayed as follow up questions for the user after the Workbot command.
Input parameters display on Slack
When the user has finished providing all the required input, the recipe actions will be executed. In this case, the recipe action was to display the Salesforce account details as a message attachment in a grid format.
Salesforce show account command results
# New help message trigger
The New help message trigger executes when a help
message is sent to your bot via DM or channel (when mentioned by the user, e.g. "@workbot help"). Use this trigger if you want to fully customize your bot's help
message response, instead of utilizing the Workbot default help message.
It is recommended to pair this trigger with the Post command reply - this response will now become the help
message users will see when invoking help
for your bot.
Only 1 New help message trigger recipe can be active at a time for each bot.
WARNING
This trigger overrides both the default help
message and the custom help JSON in the bot connection.
# Reasons to use New help message trigger
It is highly recommended to customize your bot's help message based on its unique functionality. This is done by responding to a New help message event with a Post command reply. The context contained within the trigger can be used to:
- Personalize the message to the user by using User ID
- Show different
help
messages if the user is the bot admin or an end-user by using Is bot admin? - Provide alternative
help
messages using text that the user submits along with theirhelp
command, e.g.help Salesforce
- Display bot commands, personal connections, and links to bot recipes and jobs
With the customized help message now defined within a Post command reply action, you are now able to:
- Describe your bot's unique functionality in greater detail
- Include information from other apps (e.g. Salesforce, ServiceNow, Jira) that can be scoped to the user
- Build multi-step
help
flows that can open modals or bring users to your bot app home
# Inputs
No inputs required.
# Outputs
Field | Description | Example | |
---|---|---|---|
Help message text | Text supplied by the user that comes after `help`. | "@workbot help me with salesforce" ==> "me with salesforce" | |
Message ID | Message ID of the help message | 1490915654.038365 | |
Personal connections command | Command that can be used to display the user's personal connections. Use when defining the command to invoke in buttons or other interactive component. | connections | |
Bot info command | uname | ||
Is bot admin? | True if invoking user is a bot admin, false otherwise. | true | |
Bot commands (array) | Recipe ID | Recipe ID of bot command recipe. | 42 |
Recipe name | Name of the bot command recipe. | Create Salesforce opportunity | |
Command | Full command name | salesforce create opportunity | |
Description | Command hint | creates salesforce opportunity | |
Recipe URL | URL of recipe. | https://app.workato.com/recipes/42 | |
Recipe jobs URL | URL of recipe jobs page. | https://app.workato.com/recipes/42#jobs | |
Context | Slack-related information like team info, user info, message or modal/app home view info. | See the Context datapill variables table |
# Help message priority
Help messages follow the following priority:
- Custom help in recipe
- Custom help JSON in connection level
- Default help
# New event trigger
The New event trigger executes when the specified event occurs in your Slack workspace. The trigger works with Slack's Events API (opens new window) and interactive components (opens new window) (like block actions & modal submissions). Each trigger subscribes to 1 type of event.
For events in the Events API, your bot must first be subscribed to the event in Slack.
Workbot for Slack new event trigger
By default, this trigger contains a list of the most frequently subscribed events. If the event you're looking for is not on the list, you can switch to Enter custom value to manually configure the event.
Event name points the event to the recipe and is useful in providing context — otherwise, no syntax is enforced
You may also choose to generate the event payload by specifying a sample JSON by clicking on Use a sample JSON under Event schema.
See the list of events you can subscribe to over at Slack's API Event Types documentation (opens new window).
This trigger is best used with Enterprise bots, as it allows you to specify which bot or workspace events your bot subscribes to. To subscribe to events, head over to your bot in Slack (opens new window) and navigate to Event Subscriptions. Subscribe to the events you need, then hit Save Changes.
Event Subscriptions in Slack
# New shortcut trigger
The New shortcut trigger is a powerful way to kickstart your workflows. Launch a workflow from a global shortcut, or turn any Slack message into a task or a ticket using a message shortcut. This trigger works for both Global & Message shortcuts requires you to create shortcuts in your Enterprise bot.
Workbot Shortcuts example
PREFER VIDEOS?
Watch Workbot Shortcuts in Action!
When triggered, shortcuts launch a dialog to collect command input fields from the user. The original contents of the message (along with input obtained from the dialog) can be used to create tasks, tickets, and more. To start using shortcuts, check out our shortcuts documentation.
If required, launch a diaglog box to collection more information from the user.
New shortcut trigger
To start using shortcuts, check out our Shortcuts documentation.
# New URL mention
This trigger monitors certain types of URLs in Slack and pulls pre-defined, formatted data into the channel when such an URL is mentioned. Currently, Salesforce and Github URLs are supported.
When you send a URL in Slack, you can have Workbot provide certain information into the channel for everyone to see. For example, you can send a Salesforce lead URL into your sales channel and Workbot will automatically send a message showing more information about that particular lead.
Simply select the application in the trigger (Currently only Salesforce and Github), and select the Document, and set up your actions as you prefer. By default, giving a Salesforce or Github URL in a channel that Workbot is in will trigger a prompt from Workbot asking you if you want to show details of the content of the URL that you have sent. Select yes to trigger the recipe. You can also edit the recipe in Workato if you want to have more or fewer fields included in the message.
# New dynamic menu event
In Workbot command recipes that invoke dialogs, a select
field can be defined with dynamic menu options.
A Workbot command recipe with dynamic menu options
This trigger executes when a user types in such a field and returns what the user typed (i.e. the typeahead
value). At least 5 characters must be typed to trigger an event.
Use this typeahead
value to retrieve a list of records (from another app, for example, Salesforce) to return to the main recipe (i.e. the recipe that posts the dialog where the select
field is).
You can return the list of records to the dynamic menu by using the Return menu options action. Hence, this trigger should always be paired with a Return menu options action.
# Input
# Dynamic menu name
Identifier for this menu.
# Command input fields
A Workbot command recipe with dynamic menu options can pass parameters to a Dynamic menu recipe via the Dynamic menu recipe params field. The dynamic menu recipe can use these additional parameters in generating menu options.
A Workbot command recipe with a dynamic menu options field passing a 'stagename' parameter with value 'Closed Won'
Correspondingly, the trigger must also have the same parameter defined.
The corresponding dynamic menu recipe with the same 'stagename' parameter defined
The dynamic menu recipe is then able to utilize the additional parameters in generating menu options. In the example below, the parameter stagename
is passed to the dynamic menu recipe, allowing the SOQL search to be further refined.
'stagename' parameter is passed to refine the SOQL search
# Output
Fields | Description | |
---|---|---|
Event context | Team | Team ID and domain where command was invoked. |
User | User ID and name of user who invoked command | |
Channel | Channel ID and name where command was invoked. | |
State | System message containing dynamic menu recipe ID and parameter name-value pair. | |
Action ts | Timestamp of when action was invoked. | |
Typeahead | Name | Name of parameter where dynamic menu event was received from. | Value | Characters typed by user in the dynamic menu options field. |
Callback ID | System message | |
Parameters | Name-value pairs passed by a Workbot command recipe with dynamic menu options. |