Skip to main content
Sending messages to Slack

Learn how to send a message to Slack from a care flow with the API call action

Nick Hellemans avatar
Written by Nick Hellemans
Updated over 2 years ago

Before you get started, you may want to consider setting up a Slack integration using Zapier as an alternative setup.

Slack has the following limitations to consider when using webhooks to send data:

  • Slack can't process nested JSON objects. Therefore no information about the pathway is available in Slack webhook messages as this is embedded in a nested object.

  • Slack can't process numeric fields.

These limitations lead to Slack messages containing a limited amount of details.

Setup

This tutorial outlines the steps to set up a Slack workflow to receive webhook payloads. We'll use Slack's Workflow Builder to create a workflow that can be triggered by sending a message to a webhook endpoint.

Prerequisites:

  • You have a Slack workspace

  • You have created a channel (or have an existing channel) where you want to post messages to

Create a Slack workflow

Detailed documentation on how to create workflows in Slack can be found here.

  1. Type /workflow in any Slack channel and select "Open Workflow Builder" and then press "Create" in the upper right corner.

  2. Give your workflow a name

  3. Select "Webhook" as the trigger to start the workflow

  4. Add a "text" variable. We can then use this variable to pass some text when calling the Webhook (see below).

  5. Add an additional step to your workflow which sends a message to a Slack channel.

  6. Select a channel to post the message to and print the text variable in the message.

  7. Publish your workflow and grab the webhook endpoint URL generated by Slack.

Configure the API call action in your care flow

The last step is configuring the API call action in your care flow to send messages to the webhook that will trigger our custom workflow in Slack.

  1. Add an "API call" action to your care flow

  2. Configure the endpoint. Paste the webhook URL generated by Slack here (see step 7 of the previous section)

  3. Configure your HTTP body according to the schema you have defined in the workflow.

Test your webhook

You can currently not test API call actions in Awell Studio (not in the builder, not in preview). However, we are working on making that possible. To test your API call action, publish your care flow and enroll a patient in it.

Did this answer your question?