Configuring a slash command

Slash commands are a great way to trigger Workbot Post command triggers.

Slash command in Slack

There are 2 methods you can configure slash commands; by connecting a custom Workbot, or by a legacy custom integration.

We strongly recommend using custom 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 custom bots

To use this method, you first need to create a custom bot.

These slash commands must be added and configured under a custom bot in Slack before they can be used in Workato.

If you already have a custom Workbot, proceed on to learn how to configure slash commands with your custom bot.

Workbot connection

To use slash commands using a custom Workbot, you need to connect its custom OAuth profile to the Workbot connection like so:

Connect custom OAuth profile

If you don't have a custom Workbot with a custom OAuth profile, check out the custom Workbots guide on how to configure a custom Workbot.

Configuring the slash command

Slash commands can be configured in Workbot Post command triggers, under the Slash command configuration group.

Slash command configuration.png

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 in Slack to invoke this slash command. Must begin with '/' and contain no spaces e.g. /createissue

In Slack, copy & paste this into the Command field in the slash command of your custom 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 e.g. "Command received, working..."
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 custom bot 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.

Enable slash command

Command name

This is the name of your slash command. Slash commands should be named after the function it performs, e.g.

/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 custom bot in Slack, but we'll get to that later.

Slash command name example

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.

Request URL

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...

where 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, custom 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.

Dialog for missing command input fields

If set to 'No', the command input fields will be collected from conversing with the user.

Dialog for missing command input fields

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 and go to your custom bot.

Custom botClick on your custom bot

Under Slash Commands, click on Create New Command

Create new commandClick on Create New Command

In the following form, populate the fields based like so:

Mapping command name

Mapping request URL

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.

Slash command preview in Slack

Click Save to finish creating the slash command.

You may have to reinstall the app to your workspace after hitting Save. Click on Click here in the marquee that shows up to reinstall the app.

Reinstall app

After installing/reinstalling your custom bot, the slash command should now be ready for use as a trigger for your Workbot recipes!

Slash command configured!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 custom bot - 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.

results matching ""

    No results matching ""