Create workflows that start with a webhook

Who can use this feature?
  • All members (by default)
  • Available on paid plans

Workflows are automated multi-step tasks or processes that run right in Slack. Workflows can be as simple or as complex as you’d like, and typically don’t require writing any code. To create a workflow that runs when an event happens in an external service, you can use a webhook.

What you'll need to get started

  • Familiarity with sending HTTP requests using the command line or another tool
  • An understanding of incoming webhooks. For guidance, read the documentation on Slack API, or ask a developer on your team for help

Note: Owners and admins can restrict access to creating workflows using webhooks. If you don’t see this option in Workflow Builder, find an owner or admin to ask for help.


Workflow setup

Webhook workflow basics

All workflows in Slack start in response to a trigger. To trigger a workflow with a webhook, you’ll configure the webhook to run your workflow when an event you specify occurs in another service. For example, you might create a workflow that posts a message in a particular channel when there’s a problem with your website so your engineering team can investigate.

Configure your webhook

The external service you use to create and configure your webhook must allow you to make an HTTP POST request to Slack when certain events occur. Slack will generate a unique request URL for your workflow once you publish it, and you can configure your webhook to pass information to Slack in the HTTP request body. Any data your webhook sends to Slack can be referenced in steps you add to your workflow by creating variables.

Tip: If you're not sure how to configure your webhook, we recommend asking a developer on your team for help or referencing any support documentation provided by the service you’re using, like Postman or Zapier.

Create custom variables

You can add up to 20 variables to pass data into Slack from another service and include Slack-specific information (like display names or email addresses) in steps you add to your workflow.

To create a custom variable, you’ll add a key value pair in Workflow Builder as a text-based variable. Once you add a variable, you’ll see a preview of the HTTP body so you can make sure the values match up with the JSON outputs in the other service you’re connecting to Slack with your webhook. Please note that it’s not currently possible to use nested JSON structures in workflow variables.

In the example below, if the user, severity, and incident_description were not sent with your webhook request, the workflow would fail.

Webhook configuration in Workflow Builder showing the webhook URL and custom variables

Tip: If you need to add, remove, or modify variables at any point, open your workflow in Workflow Builder. Then click the  pencil icon next to Starts with a webhook to make your changes. You’ll also need to make sure any changes to variables are reflected in the external service your webhook request is sent from.

Get your web request URL 

When you publish your workflow, Slack will generate a unique request URL that you can add to your webhook to ensure it sends the POST you set up to the correct channel. Request URLs start with https://hooks.slack.com/triggers and are followed by a randomized string of characters.

Be sure to keep your request URL secure, as anyone with the link will have the ability to trigger your workflow.

Note: Webhook workflows are limited to one request per second. Learn more about rate limits on Slack API.


Add steps to finish your workflow

Add steps

Once you've configured your webhook and created any variables you’d like to use, you're ready to add steps to your workflow

  1. Open your workflow in Workflow Builder. 
  2. Click Add Step
  3. Choose the type of step you'd like to add, then follow the prompts to customize the step.


Test your workflow

Before publishing your workflow in a channel members of your workspace are actively using, you can set up the first step to post to a test channel.

  1. Send a POST to your workflow’s request URL and go through the steps to make sure everything is working properly.
  2. Go back to Workflow Builder and update the first step of your workflow to post in your preferred channel, then publish the changes.