Skip to main content
Slack Slash Commands

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

Updated yesterday

Create a Slack Slash Commands integration in Torq to trigger workflows using Slack slash commands (commands that begin with a slash, like /command). The integration generates a unique endpoint (a special URL that acts as a "destination" for data). Add this endpoint to each Slack slash command so Slack knows where to send the data when you execute the command.

To use Slack Slash Commands in Torq workflows, look here.

Use Slack Slash Commands to Trigger Workflows in Torq

Step One: Create a Slack Slash Commands Trigger Integration in Torq

  1. Navigate to Integration: Go to Build > Integrations > Triggers > Slack Slash Commands, and click Add.

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

  3. Copy URL: 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.

Step Two: Create a Slash Command in Slack

  1. Go to Slack API: Go to https://api.slack.com/apps/.

  2. Choose App: Select an existing app or click Create an App and select Configure From Scratch.

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

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

    Screenshot of creating a slash command in Slack.
    1. Fill in the command details. In the following example, the workflow will be triggered by the slash command /domain_lookup and run a workflow that looks up the given URL. See the table below for further breakdown.

      Screenshot of the slash command fields.
  4. Finalize: You must install or reinstall the app you created by going to Basic Information and clicking Install to Workspace or Reinstall to Workspace. This will save your changes.

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 helps users understand what the expected command input is.

Step Three: Create a Workflow in Torq

  • Build: Go to Workflows and click Create Workflow.

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

    • Select the trigger integration type to Slack Slash Commands, and then select the integration you created earlier.

  • Add Functionality: Add functionality to your workflow as desired (in our example, a domain check and a follow-up Slack message)

Step Four: Run a Command from Slack to Trigger the Workflow

  • In Slack: In the Slack workspace wherein you added the Torq bot, run the slash command you created, for example: /domain_lookup google.com. The workflow should start running automatically.

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


FAQs


Templates

Now that you've added your integration, check out these templates specially crafted by Torq's security experts. Visit Torq's template library for more.

Did this answer your question?