Skip to content

Start a workflow from Slack slash commands

To run a workflow when someone types one of your Slack app’s slash commands, add a Webhook block whose Source is Slack slash commands and give its URL to the command as its Request URL. Slack posts one request each time the command is used. Each request starts its own run.

This source receives slash commands only. The events Slack reports through its Events API, such as a message or a reaction, go to a different URL setting in the Slack app and to a block of their own: start a workflow from Slack events. Buttons, shortcuts, and modals go to a third: start a workflow from Slack interactivity. Use one block and one URL for each kind.

Slack shows the reply to a command to the person who typed it, and expects that reply within about three seconds. A workflow cannot write it, because a run starts after the reply is sent. OutWin answers Slack at once, with nothing or with one fixed text you set on the block. What the workflow has to say comes afterward, from an HTTP request block.

You need a Slack app whose settings you can open, edit access to the workflow’s project, and the member role or higher in the workspace to save the app’s secret on a connection. The Slack steps happen in the Slack app’s own settings pages.

Add the Webhook block and generate its URL

Section titled “Add the Webhook block and generate its URL”
  1. In a draft workflow, add a Webhook block. The block palette also lists Slack slash commands webhook in the Start group, which adds the block with its source already set.
  2. Under Source, choose Slack slash commands. The line under the setting reads “Verifies the signature · one run per event · skips duplicates”.
  3. Under Webhook URL, select Generate URL, then copy the URL.

The badge beside the URL reads “Runs start after publish”. The URL contains a token, and anyone who has the URL can send requests to it. Keep it out of shared documents.

Each slash command has its own Request URL. It is not the Request URL on the app’s event subscriptions page.

  1. In your Slack app’s settings, select Slash Commands under Features.
  2. Select Create New Command, or open a command the app already has.
  3. In Command, enter the command with its slash, such as /deploy.
  4. Paste the URL you copied into Request URL, fill in the description, and save.

Several commands can share one block. Give each of them the same URL, and tell them apart with the filter or with {{input.event.type}}, which holds the command.

Slack signs each request with the app’s Signing Secret, the same secret it signs Events API requests with. That secret is the same for every request the app sends, so OutWin does not save it on the block. You save it once on an API connection, and each Webhook block that receives from the app chooses that connection. If a connection already holds the secret for a Slack events block, choose that connection in step 4 and skip the first three steps.

  1. In your Slack app’s settings, open Basic Information. Copy the Signing Secret under App Credentials.
  2. In OutWin, open Connections. If the workspace has no API connection for Slack, add one. In Base URL, enter https://slack.com/api, the address of the Slack API that the workflow’s answer is sent to. Nothing is sent to it when commands are received. If you will not answer from the workflow, leave the field empty and choose None under Authentication.
  3. On the connection’s page, under Receiving events, paste the secret into the field that shows “Paste the signing secret” and select Save. The section then shows only a masked hint and the saved date, with Replace and Remove.
  4. In the block’s settings, under Connection that holds the signing secret, choose the connection. Each connection in the list is marked “secret saved” or “no secret yet”.

The line under the setting then starts “Verifying with the secret ending”, followed by the hint. Under Set up, the second line changes to “The signing secret is saved: deliveries are verified.”

In a workspace with no API connection, the setting shows “No API connections yet.” in place of the list, with an Add one link that opens Connections. If you choose a connection that has no secret, the line reads “This connection has no signing secret yet.” with a Save it on the connection link to its page.

With a secret saved, OutWin also checks the time Slack signed the request. A request signed more than five minutes before or after the moment it arrives is listed as Refused.

With no connection chosen, or with a connection that has no secret, the block still starts runs, and nothing is verified: anyone who has the URL can start the workflow. Publishing then shows a warning that ends “has no signing secret saved, so its deliveries are not verified: anyone who has this URL can start this workflow”. The warning does not block publishing.

The Reply setting holds the one text OutWin answers Slack with. The field shows “Got it, working on it.” as a placeholder and takes up to 2,000 characters.

Reply What OutWin sends What the person sees
Empty Status 200 with no body. Nothing. Slack shows no message and no error.
A text Status 200 with the text as an ephemeral message. The text, shown to the person who typed the command and to nobody else.

The text is the same for every command the block receives. It takes no expressions, so it cannot repeat what the person typed or say what the workflow found. There is no setting that posts the reply to the whole channel.

The lines under the field read “Slack shows this text to the person who typed the command, and to no one else. It is the same every time, and is sent only when the event is queued to run: not on a draft, a paused workflow, or an event the filter turns away.” and “Left empty, Slack shows nothing.”

OutWin sends the text only when the command is queued to run. On a draft, on a paused workflow, for a command the filter turns away, for a duplicate, and when too many events are already waiting, it sends the empty reply, and the person sees nothing. Credits and the subscription are checked later, when the run starts. A workspace that is out of credits is therefore found after the reply: the person sees the text and no run follows.

The event type of this source is the command with its slash, such as /deploy. The block does not know your app’s commands, so Events that start a run offers none to tick. The line under it reads “Every event starts a run. Tick some to run only for those.”

To start runs for some commands only, type each command with its slash into the box that shows “Another event type” and select Add. Each command you add is ticked. A command that is not ticked is then listed as Filtered out and starts no run.

To narrow further by a field of the request, select Add a condition under Only when. The field body.text holds what the person typed after the command, and body.channel_id holds the channel. Webhook settings lists the comparisons.

  1. In Slack, type the command in a channel of the workspace the app is installed in.
  2. In OutWin, look under Recent deliveries in the block’s settings.

Recent deliveries lists every command that reached the URL, including while the workflow is a draft. On a draft each command is listed as Dropped with “The workflow is not published, so nothing ran.” It starts no run, it is not run later, and Slack shows the person nothing. The last line under Set up changes from “Waiting for the first event…” to, for example, Received /deploy. Dropped.

With a secret saved on the chosen connection, a command listed as Dropped on a draft has passed the signature check. A delivery that fails the check is listed as Refused.

If you have edit access, select a command to see what the block passed on. The list is kept for seven days, and the data of the newest 20 events is kept.

Each run receives one command. Slack sends it as a form, and the block passes the form’s fields on as the body. An HTTP request block or a database block directly after the Webhook block reads it with these expressions. An AI block such as Think receives the whole value as its input.

Expression What it holds
{{input.body}} The fields Slack sent, among them command, text, user_id, channel_id, team_id, response_url, and trigger_id.
{{input.body.text}} What the person typed after the command. It is empty when they typed the command alone.
{{input.body.user_id}} The id of the person who typed the command.
{{input.body.channel_id}} The id of the channel the command was typed in.
{{input.body.response_url}} The address Slack gives an app for a later answer. An HTTP request block cannot call it.
{{input.event.type}} The command with its slash, such as /deploy. It is the body’s command field.
{{input.event.id}} The body’s trigger_id field, which Slack makes for each use of a command.
{{input.delivery.verified}} true only when the signature was checked and passed.

A block further along reads the same values through the Webhook block’s name, as in {{steps["Slack slash commands"].body.text}} for a block named Slack slash commands. Data and context describes what each block passes on.

Slack’s trigger_id opens a modal only within three seconds of the command. A run starts later than that, so a workflow cannot open a modal with it.

The event holds a response_url, the address Slack gives an app for a later answer. An HTTP request block cannot call it. The block sends to the host of its API connection and adds a path, the path cannot hold a full URL, and a value that an expression puts in the path cannot hold a slash.

To answer, call Slack’s Web API with the app’s bot token. The token needs the chat:write scope.

  1. On the Slack connection’s page, under Settings, set Base URL to https://slack.com/api, choose Bearer token under Authentication, enter the bot token, and select Save changes. This can be the connection that holds the Signing Secret.
  2. After the blocks that do the work, add an HTTP request block and choose the connection.
  3. Under Request, choose POST and enter the path /chat.postEphemeral.
  4. Under Body, choose JSON and enter the message:
{
"channel": "{{steps["Slack slash commands"].body.channel_id}}",
"user": "{{steps["Slack slash commands"].body.user_id}}",
"text": "The deploy has started."
}

chat.postEphemeral shows the message to that person alone, and Slack delivers it only when the person is in the channel. To post to the whole channel, use the path /chat.postMessage and leave out user. Slack’s page for each method lists the other conditions, such as the app’s access to the channel.

Slack answers these calls with status 200 also when it turns one down. The body then holds "ok": false and an error field, and the block completes. To act on a failed call, read {{input.response.body.ok}} in the next block.

Publish the workflow. From then on, each command that passes the filter starts a run, and the person who typed it sees the Reply text if you set one. On a published workflow the block’s settings are read-only, including Reply and the choice of connection, and Recent deliveries is in the block’s inspector. You can still replace the secret on the connection’s page.

Outcome What happened
Ran The command started a run.
Waiting 10 runs of the workflow are already active. The command starts a run when one of them ends. A command that waits longer than an hour is listed as Dropped.
Duplicate A command with the same trigger_id already ran in the last 72 hours. The line reads “This event was already received and run, so it did not run again.”
Handshake Slack’s check of the certificate at the URL, sent with no signature. The line reads “Slack slash commands checked that the URL answers.” It starts no run.
Ping The same check, sent with a signature. The line reads “A ping from the sender, not an event. Nothing ran.”

Slack’s documentation says it sends the certificate check, a request with ssl_check set to 1, now and then to the commands of an app that is distributed publicly. It is not a command, and nobody typed it.

Receiving a command costs no credits, and neither does a command that is filtered out, a duplicate, or a certificate check. A run that starts uses credits for the blocks that run in it.

Open Recent deliveries and read the outcome and the sentence beside the newest command.

What you see Cause Fix
“Nothing has arrived yet.” No request has reached the URL. Check that Request URL on the command itself is the block’s current URL. Each command has its own, and the URL on the event subscriptions page is a different setting. Rotate token on a published workflow changes the URL, and the old one stops working.
Dropped with “The workflow is not published, so nothing ran.” The workflow is a draft. The person saw nothing in Slack. Publish the workflow. Commands that arrived before then are not run later.
Dropped with “The workflow is paused, so nothing ran.” The workflow is paused. Resume the workflow. Commands that arrived while it was paused are not run later.
Dropped with “The workspace is out of credits, so nothing ran.” The workspace has no credits left. The person saw the Reply text, because the reply is sent first. Add credits, then use the command again.
Filtered out with Events of type "/status" are not chosen on this trigger. The command is not ticked under Events that start a run, or it was added there without its slash. Add the command with its slash, or clear every tick so that all commands start a run. The settings are read-only on a published workflow.
Refused with “The signature did not match. Check that the secret saved here is the one the sender shows for this URL.” The secret on the chosen connection is not the app’s Signing Secret. This can happen when the block chose another service’s connection, when the secret was copied from another app, or when the app’s secret was replaced in Slack. Copy the Signing Secret from the app again and select Replace under Receiving events on the connection’s page. You do not republish the workflow.
Refused with “The request carried no signature.” A secret is saved on the chosen connection, and the request did not carry Slack’s signature. A request sent by hand to try the URL has none. Type the command in Slack so that Slack sends the request.
Refused with “The request’s timestamp is too far from now, so it may be a replay of an old delivery.” The request was signed more than five minutes before or after it arrived, for example because a saved copy of an earlier request was sent again. Type the command in Slack again.
Ran, and the workflow’s answer does not appear in Slack The HTTP request block completed, and Slack turned the call down in the body of its answer. Open the run and read the block’s output. The error field names the reason.

A delivery listed as Refused is answered with status 401 and starts nothing. OutWin keeps none of its data, and Slack shows the person who typed the command an error in place of a reply. For every other outcome in the table, Slack receives status 200 and OutWin does not run the command later.