Skip to main content
Slash Commands

Integrate Slack Slash Commands with Torq to trigger workflows directly from Slack by setting up a unique endpoint.

Updated over a week ago

Create a Slack Slash Commands integration in Torq to trigger Torq workflows by running slash commands in Slack. The integration generates a unique endpoint that should be added to each Slack slash command so that Slack knows where to send the data.

Create a Slack Slash Commands integration

Perform these steps in Torq.

  1. Go to Integrations > Triggers, search for the Slack Slash Commands card, and click Add.

  2. Enter a meaningful name for the integration, such as slack-slash-commands, and click Add.

  3. In the table, locate the integration you just created and copy the endpoint URL. You will enter this as the Request URL when you create the slash commands in Slack.

Screenshot of copying the webhook URL from the integration.

Create Slash Commands

  1. Select an existing app or click Create an App and select configure From scratch.

  2. Specify a name for your app and select the Slack workspace you want to develop the app in.

  3. Once you've created the app, go to Slash Commands and click Create New Command.

    Screenshot of creating a slash command in Slack.
  4. Fill in the command details. Below is an example configuration for the command.

  5. Install/reinstall the app you created by going to Basic Information and clicking Install to Workspace or Reinstall to Workspace.

Field

Description

Command

The slash command name as it appears in Slack.

Request URL

The Slack integration endpoint you created in Torq.

Short description

Description of the command that will be displayed in Slack.

Usage hint

An example displayed in Slack that helps users understand what they expected command input is.

Screenshot of the slash command fields.

Create a Workflow

Create a Torq workflow that's triggered by a Slack slash command.

  1. Go to Workflows and click Create Workflow.

  2. Specify a name for your workflow and pick the trigger to be an integration.

  3. Select the trigger integration type to be Slack Slash Commands and then select the integration you created.

  4. Add functionality to the workflow you created.

Run a Command from Slack to Trigger the Workflow

Go to the Slack workspace where you set up the Torq bot.

  1. In the Slack CLI, run the slash command you created /domain_lookup google.com. The workflow should start running automatically.

  2. Go to your Torq workflow and make sure the trigger got an event and your workflow was executed.

    Screenshot of running the slash command in Slack

The following variable can be used on a step to get the user email that triggered the workflow from Slack:

##{{ $.metadata.user_email }}

Did this answer your question?