Create more advanced workflows using webhooks

Who can use this feature?

Workflows are automated multi-step tasks or processes that can run right in Slack, or connect with other tools and services. Workflows in Slack can be as simple or as complex as you like and typically don’t require writing any code.

If you’re a developer or have some experience with code, you may want to create a workflow triggered by an event in an external service (like an internal tool your company uses) with 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

What you’ll learn

  • How to configure a webhook to trigger a workflow in Slack
  • How to create custom variables and use them in workflow steps
  • How to test your workflow before publishing it

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.

Tip: If you'd like a refresher on how to set up a workflow and choose a trigger, visit Set up a workflow in Slack.

Workflow setup

Webhook workflow basics

All workflows in Slack start in response to a trigger. To trigger a workflow using a webhook, you’ll configure the webhook to start your workflow in Slack when an event you specify occurs in another service. For example, you might set up a workflow that posts a message to Slack when there’s a problem with your website or service and an incident has been called to understand and resolve the issues.

Configure your webhook

The external service you choose to create and configure your webhook needs to provide you with the ability 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 via the HTTP request body. Any data your webhook sends to Slack can be referenced in subsequent workflow steps 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 that 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 that you can make sure that the values match up with the JSON outputs in the other service that you’re connecting to Slack via 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 Edit next to Webhook to make your changes. You’ll also need to make sure that any changes to variables are reflected in the external service that 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 that it sends the POST that you set up to the correct channel in Slack. Request URLs start with and are followed by a randomised 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.

Put what you’ve learned into practice

Add steps

Once you've configured your webhook and created any variables that 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 that you'd like to add, then follow the prompts to customise 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 that 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.

Regenerate a webhook URL

If a webhook’s URL gets exposed or needs to be changed for any reason, follow the steps below: 

  1. Open Workflow Builder and select your workflow from the list.
  2. Click Edit next to Webhook.
  3. Select Regenerate URL and save your changes.

Note: When you regenerate a webhook URL, the connection between your workflow in Slack and another service will break. Update the other service with your new URL to keep things running smoothly.