# Run a workflow from a Slack slash command
URL: /slack-slash-commands
Type: howto
Description: Start a Stylo Workflow when someone types a slash command in Slack, and post the result back to them.
Keywords: slack, slash command, slack command, trigger, response_url, signing secret, chatops
This guide shows you how to start a Workflow from a Slack slash command, such as `/blocked-items store 42`, and reply to the person who ran it. Do this when your team should be able to run a Workflow from Slack without opening Stylo.

<Callout type="info">
  **Prerequisites:** You're a Stylo admin, and you can create and install apps in your Slack workspace.
</Callout>

How it works [#how-it-works]

When someone runs the command, Slack sends it to Stylo. Stylo checks that the request came from your Slack app, starts the Workflow, and answers Slack straight away with a short acknowledgement. The Workflow runs in the background. A **Reply to Slack Command** step then posts the result back to the person who ran the command.

Slack gives each command a reply link that accepts **at most 5 replies within 30 minutes**. A Workflow that takes longer than 30 minutes can't reply to the command.

Set up the command [#set-up-the-command]

<Steps>
  <Step>
    Create a Slack app [#create-a-slack-app]

    Go to [api.slack.com/apps](https://api.slack.com/apps), click **Create New App**, choose **From scratch**, name it, and pick your workspace. On the app's **Basic Information** page, find **App Credentials** and copy the **Signing Secret**.

    **Expected result:** You have the Signing Secret copied.
  </Step>

  <Step>
    Add the Signing Secret to Stylo [#add-the-signing-secret-to-stylo]

    In Stylo, go to **Settings → Integrations** and open the Slack card. Click **Connect** (or reconnect an existing Slack connection) and paste the **Signing Secret**. The **Bot Token** is only needed if the same connection also sends messages with the **Send Slack Message** block.

    **Expected result:** Slack shows as connected.
  </Step>

  <Step>
    Build and publish the Workflow [#build-and-publish-the-workflow]

    Create a Workflow in the Workflow Builder and choose the **Slack Slash Command** trigger. Select the Slack connection that holds your Signing Secret. Save the Workflow, then copy the **Request URL** from the trigger's settings.

    Add the steps the command should run. Use `<Slack Slash Command.text>` to read what the person typed after the command. End with a **Reply to Slack Command** step, then publish the Workflow.

    **Expected result:** The Workflow is published and you have its Request URL.
  </Step>

  <Step>
    Add the slash command in Slack [#add-the-slash-command-in-slack]

    Back in your Slack app settings, open **Slash Commands** and click **Create New Command**. Enter the command name, paste the Stylo **Request URL**, and add a short description and usage hint. Turn on **Escape channels, users, and links sent to your app** if your Workflow needs the IDs of users or channels mentioned in the command.

    **Expected result:** The command is listed on the Slash Commands page.
  </Step>

  <Step>
    Install the app [#install-the-app]

    Open **Install App** in your Slack app settings and click **Install to Workspace**, or **Reinstall** if Slack prompts you after adding the command.

    **Expected result:** The app is installed and the command appears when you type `/` in Slack.
  </Step>

  <Step>
    Run the command [#run-the-command]

    Type the command in any channel and press Enter.

    **Expected result:** You see the Workflow's acknowledgement, then its reply. The run appears in the Workflow's execution history.
  </Step>
</Steps>

Choose who sees the reply [#choose-who-sees-the-reply]

The trigger's **Acknowledgement** and the default reply are visible only to the person who ran the command. To post the reply for everyone in the channel, set the **Reply to Slack Command** step's **Visibility** to **Everyone in the channel**. Leave **Acknowledgement** blank to skip the acknowledgement.

Troubleshooting [#troubleshooting]

<Callout type="warn">
  **Slack shows an error when you run the command.** Stylo rejects commands it can't verify. Check that the Workflow is published, that its trigger uses the Slack connection holding this app's Signing Secret, and that the command's Request URL matches the one in the trigger. If you regenerated the Signing Secret in Slack, paste the new one into Stylo.
</Callout>

<Callout type="warn">
  **The command is acknowledged but no reply arrives.** Open the Workflow's execution history and check the **Reply to Slack Command** step. A reply fails if the Workflow ran longer than 30 minutes or replied more than 5 times.
</Callout>

<Callout type="warn">
  **Slack never reaches Stylo.** Turn off **Socket Mode** in your Slack app settings. With Socket Mode on, Slack stops sending commands to the Request URL.
</Callout>

Slash commands can't be run inside message threads. This is a Slack limitation.

Related [#related]

* [Slack Slash Command trigger reference](/reference/blocks/trigger-slack-slash-command)
* [Reply to Slack Command block reference](/reference/blocks/slack-reply-to-command)
* [Slack integration](/reference/integrations/slack)
* [Workflow Builder overview](/workflow-builder-overview)