Skip to main content
Slack Bot Integration

Integrate Slack with Torq's bot to trigger workflows, message channels, run commands, and customize branding—all inside Slack.

Updated today

The Slack steps integration adds the Torq bot (Torq app) to your workspace, which enables you to perform common Slack actions as part of your workflows and trigger Torq workflows directly from the Slack CLI by mentioning (@) the Torq bot or sending a message directly in the Torq app channel.

Slack steps can be used to post textual or image updates inside Slack conversations and channels, provide multiple-choice questions to specific users or channels, and later refer to the chosen responses in the workflow run.

Torq enables quick and easy integration with Slack, so you can automate anything and everything within moments. Torq's public Slack steps include:

  • Send Slack Message Blocks

  • Send Message

  • Upload File

  • Ask a Question

  • +43 more...

As always, if you don't see a step you need, you can create your own steps using Torq's custom step builder and share them within your workspace or organization.

To trigger a Torq workflow based on events sent from Slack, look here.

To use Slack steps in Torq workflows, look here and look here for more information.

Use Slack in Torq Workflows

Step One: Create a Slack Bot Integration in Torq

You must have admin privileges in the Slack workspace where you are adding the Torq bot.

  1. Navigate to Integration: Go to Build > Integrations > Steps > Slack, and click Add.

  2. Details:

    1. Enter a meaningful name for the integration.

    2. By default, mentions of the Torq bot and direct messages in the bot channel generate Torq events that can trigger workflows. To disable this functionality, uncheck the Receive events from Slack app mentions checkbox.

    3. Click Add.

    4. Ensure you are adding the bot to the right Slack workspace, and click Allow.

Step Two: Customize the Torq Bot

You can change the Torq bot's name and logo. The bot's name and logo appear in Slack when a message is sent to a user or channel.

Change the Bot's Name

By default, the bot's name is Torq. You can easily change this to match your organization's needs, for example, you can change the name to Security Team.

  1. Go to Bot Settings: Select the Torq bot from the Apps section, click the bot's name at the top of the screen, and then select Configuration from the menu.

  2. Edit Name: Scroll down in the settings page that will open, and in the Bot User section click Edit.

  3. Finalize: Change the Bot name as desired and click Save Changes.

Change the Bot's Logo

You can also change the bot logo, which can only be done on an individual step level by adding the logo image file as an input parameter.

If you want to change the app logo, it's recommended that you configure each Slack message/question step with the logo file and save them as custom steps. This way, you won't have to add the image file each time you use one of those steps.

You cannot change the logo for the Slack steps listed below. If you use these steps, the Torq logo will be displayed in the message.

  • Send Snippet

  • Send Slack attachment message

Screenshot of changing the bot logo.

Step Three: Add the Torq App to a Channel

To communicate with the bot in a channel, you must first add the Torq app to that channel. Typically, if you mention the bot and it hasn’t been added yet, you’ll receive a prompt to add it. Alternatively, you can manually add the bot as follows:

  • Use the Add apps to this channel Slack slash command.

  • Click + Add this app to a channel in the app menu.

Screenshot of adding the app to a channel in Slack.


FAQs

Reauthorize the Integration

Reauthorize the integration when you need to add new scopes or reinstall an existing integration.

  1. Navigate to Integration: Go to Build > Integrations > Steps > Slack.

  2. Edit: Click Edit for the integration you want to reauthorize.

  3. Finalize: Click the Reauthorize button and when prompted, then click Allow.

Run a Torq Workflow from Slack

When you have a Slack steps integration set up, you can run a Torq workflow directly from Slack:

  1. Sign in to your Torq workspace: /torq signin.

  2. Run a workflow: /torq run.

    1. Select the workflow you want to run. You can see the name of the workspace in which the workflow will run.

  3. You can also specify the workflow name in the run command: /torq run

Screenshot of running a Torq workflow from Slack.

Switch to a Different Torq Workspace

If the Slack workspace is associated with integrations in more than one Torq workspace and you want to run the workflow in a different workspace:

  1. In Slack, run: /torq signout.

  2. In Torq, switch to the workspace you want to log in to in Slack.

  3. In Slack, run: /torq signing.


Slack Steps

You can find information about some of the main Slack steps below.

There are several important things to keep in mind when building a workflow that has the Torq bot communicating with users:

  • The RECIPIENT field needs to include the hashtag symbol (#) as a prefix to any channel name, for example, #{{ $.event.channel }}.

  • If you want to mention a user in the message, use the following syntax: <@##{{ $.event.user }}>.

Ask a Question

This step allows you to send a question to a user or a channel, with configurable response options. For example, you can ask a user if they attempted a suspicious login, with "Yes" or "No" as the response options.

You may also want to send a question to a channel, such as a group of managers, for approval. In this case, any channel member can respond.

In the screenshot below, the recipient is asked to approve a user's membership to a JumpCloud group.

Send Block Form

This step enables you to send a form to a user or a channel. A form can include any of the supported interactive components: datepickers, checkboxes, user text input, multiple option selections, and more. Use a form to collect all the information you need in one interaction and in the formats that best suit the type of information you’re trying to collect.

A numerical block_id is added automatically to each step, but you may also rename the block_id with a meaningful and unique name so it remains static even if the block order changes.

  1. Slack Block Kit: Use the Slack Block Kit Builder to create the form you want to send.

    Screenshot of building a block in Slack.
  2. Use the Send Block Form Step: Copy the form payload to the BLOCKS field in the Send Block Form step.

  3. Buttons: ​By default, the Cancel and Submit buttons will be automatically added at the bottom of your form. If the user clicks Cancel, none of the information the user may have entered in the form will be submitted.

    1. Important: The Submit and Cancel buttons are specifically designed to handle form submission and cancellation. Other buttons or dispatch actions included in the form will not have this functionality. As a result, these components will not process or provide any information from the form.

      Screenshot of a Slack message sent by the Torq bot.
  4. Optionally Add Responses: You can add the RESPONSES optional parameter to replace the Cancel and Submit buttons with up to 25 different buttons with customizable titles.

    1. The step output will include the button title the user clicks and any information entered in the form. Clicking any custom buttons at the bottom of the form will submit the form.

  5. Optional Workflow Timeout: Optionally, add the optional timeout parameter. The workflow will be on hold until the user submits or cancels the form or until the form times out.

    Screenshot of the bot message in Slack when there is a form timeout.
  6. Summary: After the user submits or cancels the form (or the form times out), the form is no longer available, and only a summary of the form is presented.

    1. You can choose not to display the summary by adding the optional POST_RESPONSE_MESSAGE parameter and setting it to false.

  7. Step Output: The Send Block Form step output contains the user response and the responding user's identity. This information can be used to direct your workflow and for reference in other workflow steps.

  8. User Path: Find the path to the user response by typing $. and selecting Select from tree mode from the autocomplete options. Search for the block_id in the context tree to access the user response easily. Read more about the workflow context here.

Send a Message/Question to a Thread

  • To send a message in a thread using a Slack step, add the optional THREAD_TS parameter.

  • Set its value to #{{ $.message_ts }} of the parent message.

  • For instance, if you're using the Ask a Question step and want to respond in a thread, use #{{ $.ask_a_question.message_ts }} as the value.

Create a Workflow Triggered by Slack in Torq

Use the same integration you created for Slack steps for Slack triggers. To create unique Slack slash commands, see here.

Create a basic Hello World workflow that will receive an event from a message that mentions the Torq bot and then send a reply message to the channel and mention the user that sent the original message.

  1. Create Workflow: Go to the Workflows page and click Create Workflow. Type a meaningful name for the workflow, such as Slack Events Hello World.

    1. Click the trigger icon and then the Slack integration.

    2. Select the integration you just created.

  2. On the Canvas: In the Steps Library, search for Slack and add the step Send a Message.

  3. Configure the Step:

    1. Rename the step to something meaningful, such as Acknowledging the message.

    2. In the RECIPIENT field, enter ###{{ $.event.channel }}.

    3. In the MESSAGE TEXT field, enter a message that mentions the user who sent the original message. For example, the message can mention the user and quotes the text that they sent to the bot: <@##{{ $.event.user }}>, I got your message: ##{{ $.event.text }}

  4. Publish: Click Publish on the workflow.

  5. Test the Workflow: Go to Slack, and from a channel the bot has been added to, mention the Torq bot (@Torq) and type Hello World.

    1. Wait a few seconds, and you should receive the reply message to the channel you mentioned the bot in.


Templates

Now that you've added both step and trigger integrations, check out these templates specially crafted by Torq's security experts. Visit Torq's template library for more.

Did this answer your question?