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 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.
Navigate to Integration: Go to Build > Integrations > Steps > Slack, and click Add.
Details:
Enter a meaningful name for the integration.
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.
Click Add.
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.
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.
Edit Name: Scroll down in the settings page that will open, and in the Bot User section click Edit.
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
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.
FAQs
Reauthorize the Integration
Reauthorize the integration when you need to add new scopes or reinstall an existing integration.
Navigate to Integration: Go to Build > Integrations > Steps > Slack.
Edit: Click Edit for the integration you want to reauthorize.
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:
Sign in to your Torq workspace: /torq signin.
Run a workflow: /torq run.
Select the workflow you want to run. You can see the name of the workspace in which the workflow will run.
You can also specify the workflow name in the run command: /torq run
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:
In Slack, run: /torq signout.
In Torq, switch to the workspace you want to log in to in Slack.
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.
Slack Block Kit: Use the Slack Block Kit Builder to create the form you want to send.
Use the Send Block Form Step: Copy the form payload to the BLOCKS field in the Send Block Form step.
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.
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.
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.
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.
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.
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.
Create Workflow: Go to the Workflows page and click Create Workflow. Type a meaningful name for the workflow, such as
Slack Events Hello World
.Click the trigger icon and then the Slack integration.
Select the integration you just created.
On the Canvas: In the Steps Library, search for Slack and add the step Send a Message.
Configure the Step:
Rename the step to something meaningful, such as
Acknowledging the message
.In the RECIPIENT field, enter
###{{ $.event.channel }}
.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 }}
Publish: Click Publish on the workflow.
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.
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.