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.
Go to Integrations > Triggers, search for the Slack Slash Commands card, and click Add.
Enter a meaningful name for the integration, such as slack-slash-commands, and click Add.
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.
Create Slash Commands
Go to https://api.slack.com/apps/.
Select an existing app or click Create an App and select configure From scratch.
Specify a name for your app and select the Slack workspace you want to develop the app in.
Once you've created the app, go to Slash Commands and click Create New Command.
Fill in the command details. Below is an example configuration for the command.
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. |
Create a Workflow
Create a Torq workflow that's triggered by a Slack slash command.
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 be Slack Slash Commands and then select the integration you created.
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.
In the Slack CLI, run the slash command you created /domain_lookup google.com. The workflow should start running automatically.
Go to your Torq workflow and make sure the trigger got an event and your workflow was executed.
The following variable can be used on a step to get the user email that triggered the workflow from Slack:
##{{ $.metadata.user_email }}