Create workflows using webhooks

Who can use this feature?
  • All members (by default)
  • StandardPlus, and Enterprise Grid plans

Workflow Builder makes it possible to automate routine processes and tasks right in Slack. To start a workflow from another service and bring information into Slack using Workflow Builder, create a workflow using 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 work with a developer on your team.


Configure a webhook workflow

Create a workflow

Workflows in Slack start in response to a trigger. Members can launch workflows from the   Actions menu in a channel at any time. Other workflows can launch in response to an action a member takes (like joining a channel) or an event (like a webhook bringing information from another service into Slack). For example, you might set up a workflow that posts a message in your Customer Support team channel any time someone submits a ticket.

Tip: For step-by-step instructions to create a workflow, visit Automate everyday tasks with Workflow Builder.


Get your webhook request URL

Slack will generate a unique request URL for a webhook workflow once it's published. Request URLs start with https://hooks.slack.com/workflows and are followed by a secure, randomized string of characters.

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


Add custom variables

Depending on your workflow, you can add optional variables to pass data into Slack from another service or include Slack-specific information (like display names or email addresses) in messages your workflow posts.

For a workflow that posts a message each time a customer submits a support ticket, you may want the message to include a link to the support ticket and the assigned support agent's name. To create custom variables, you can add key value pairs in Workflow Builder as a text-based variable. Then, preview the JSON output to make sure the values match up with the other service you've connected to Slack.

Modal in the Slack desktop app where you can add custom variables for webhook workflows

If you were to add variables for support ticket links and assigned support agents, the JSON output would look like this: 

{
"support_ticket_link": "Hello, world!",
"assigned_support_agent": "U123456789"
}

Tip: You can use any variables you create when adding steps to your workflow.


Publish and test your workflow

Before running your workflow in a public channel, you can select a test channel or your personal direct message for the first step in your workflow to make sure everything is working properly. To publish changes and test your workflow, follow the steps below: 

  1. Open Workflow Builder, then select your workflow from the list. 
  2. Click Publish Changes in the top right. 
  3. Once your changes are live, send a post to your workflow's request URL using whatever tool you wish.

Once you've confirmed your workflow launches as expected, go back to Workflow Builder to update the first step of your workflow to post in the right channel or DM. 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. From your desktop, click your workspace name in the top left.
  2. Select Workflow Builder from the menu. 
  3. Click the Your Workflows tab, then select a workflow from the list. 
  4. Next to Webhook, click Edit
  5. Select Regenerate URL, then click the Copy button to copy the new URL to your clipboard. 
  6. Click Save

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.

Tip: For more details on managing workflows, like adding collaborators or making changes to steps, visit Manage workflows you collaborate on.