# Configuring a slash command
Slash commands are a great way to trigger Workbot Post command triggers.
We strongly recommend using Enterprise Workbots to configure your slash command, as custom integration is a legacy feature that will eventually be deprecated (no news as to when just yet).
# Slash command using Enterprise Workbots
To use this method, you first need to create an Enterprise bot.
These slash commands must be added and configured under an Enterprise Workbot in Slack before they can be used in Workato.
If you already have an Enterprise Workbot, proceed on to learn how to configure slash commands with your Enterprise bot.
# Workbot connection
To use slash commands using a Enterprise Workbot, you need to connect its custom OAuth profile to the Workbot connection like so:
If you don't have an Enterprise Workbot with a custom OAuth profile, check out the Enterprise Workbots guide on how to configure an Enterprise Workbot.
# Configuring the slash command
Slash commands can be configured in Workbot Post command triggers, under the Slash command configuration group.
The table below shows the input schema for the slash command configuration fields.
|Field||Explanation||What goes in here|
|Enable Slash command||Toggle whether to enable slash command for this command trigger.||If set to 'Yes', command can be invoked using slash command.|
|Command name||Used to invoke the slash command.||
What user will key in Slack to invoke this slash command. Must begin with '/' and contain no spaces for example, /createissue|
In Slack, copy & paste this into the Command field in the slash command of your Enterprise bot.
|Auto-reply message||When command is invoked, automatically sends this reply to the user only. If left empty, reply will mirror the user's command.||
Key in some text to assure user that the command was received after invocation for example, |
|Dialog for missing command input fields||Show a dialog to collect command input fields from the user.||
If 'Yes', missing command input fields can be entered in a dialog form. Otherwise, Workbot will prompt for them in conversation with user.|
Can only be used when command is invoked using a Enterprise Workbot slash command.
# Getting started
To get started, fill in the post command trigger fields as you normally would. Next, move on to the slash command configuration group.
# Slash command configuration group
# Enable slash command
Toggle whether to enable slash command for this command trigger. When set to 'Yes', command can be invoked using a slash command.
# Command name
This is the name of your slash command. Slash commands should be named after the function it performs, for example,
/createissue, /listusers, /showcustomers
Slash command actions must start with a slash and contain no spaces. This slash command will also need to be created in your Enterprise Workbot in Slack, but we'll get to that later.
# Request URL
When slash commands are invoked from Slack, Slack will require a URL to send requests to. This request URL is generated by Workato, and will be needed when setting up your slash command in Slack (we'll get to that later).
After Enable slash command is set to Yes, and a valid Command name is keyed in, then a Request URL is generated in the help box at the top of the post command trigger.
# Using slash commands with command input fields
If you've defined command input fields in your post command trigger, you can pass them into the slash command when you invoke it.
Command input fields in slash commands follow this format:
/slashcommand name1: value 1 name2: value 2 name3: value 3...
name is the name of the command input field and
value is the value of the field.
For example, in the JIRA create issue recipe above, we've defined Title and Description as command input fields. We can pass the respective values to the slash command invocation like so:
/createissue title: Button is misaligned description: At the registration page, the registration button is misaligned.
# Dialog for missing command input fields
Even when command input fields are missing, Enterprise Workbot slash commands can still collect them from the user using Slack dialogs.
When set to 'Yes', this triggers a dialog to pop up when the user invokes the command via a Slash command. This dialog collects all the command input fields you require from the user. Hints and examples defined in the command input fields are also displayed in the dialog.
If set to 'No', the command input fields will be collected from conversing with the user.
# Creating the slash command on Slack
The trigger should now have all the info required to create the slash command in Slack.
To start creating your slash command, head to https://api.slack.com/apps (opens new window) and go to your Enterprise bot.
Select your Enterprise bot
Under Slash Commands, select Create New Command
Select Create New Command
In the following form, populate the fields based like so:
Under Escape channels, users, and links sent to your app, check the box to enable it. This tells Slack to escape users and channels in their request payload to us.
At the bottom of the form, you can see a nifty preview of how the slash command will look like in Slack.
Click Save to finish creating the slash command.
You may have to reinstall the app to your workspace after hitting Save. Select Click here in the marquee that shows up to reinstall the app.
After installing/reinstalling your Enterprise bot, the slash command should now be ready for use as a trigger for your Workbot recipes!
You can add more slash commands to the same bot, but make sure their names are unique
You can add more slash commands to the same Enterprise Workbot - but since slash commands are not namespaced, make sure to uniquely name each slash command in a Slack team.
Try it out! Head to your Slack workspace and invoke the slash command to trigger your Workbot recipes.
To read up on how to configure legacy slash commands, see Configuring legacy slash commands.