kind is slack_workflow posts each firing to a Slack workflow. The workflow receives the request, and posts the firing’s summary to a Slack channel, such as “San Francisco 49ers beat Los Angeles Rams 27 to 20.”
Before you start
You need these things:- A paid Slack plan. A workflow that starts from a webhook requires one.
- Permission to create workflows that start from a webhook. Slack workspace owners and admins can restrict who creates them.
- A Tako API key.
Set up the workflow and the channel
1
Create a workflow that starts from a webhook
In Slack, open Workflow Builder, and create a workflow. For how the workflow starts, choose From a webhook.
2
Add a variable for each key that Tako sends
Add a text variable for each of these 7 keys:
summary, monitor_name, monitor_type, monitor_id, occurred_at, event_id, and event_type. Tako sends every value as a string, and it sends all 7 keys for every monitor type.3
Add a step that posts the message
Add a Send a message to a channel step, and choose the Slack channel. In the message, click Insert a variable, and choose
summary. To name the monitor in the message too, insert monitor_name.4
Publish the workflow, and copy its URL
Publish the workflow. Slack gives it a web request URL that starts with
https://hooks.slack.com/triggers/. Keep the URL secret, because anyone who has it can start the workflow.5
Register the URL as a notification channel
Replace the URL with the one that Slack gave your workflow.
SLACK_WORKFLOW_CHANNEL_ID holds the notification channel’s id.6
Attach the notification channel to a monitor
To post a new monitor’s firings to Slack, pass the notification channel’s
id in channel_ids when you create the monitor. To add Slack to a monitor that exists, send the monitor’s full list of notification channels. Set MONITOR_ID to the monitor’s id, and WEBHOOK_CHANNEL_ID to the id of the webhook channel that you want to keep:channel_ids replaces the monitor’s notification channels, so include every one that you want to keep.What the workflow receives
Each firing sends one flat JSON object of strings:
Every monitor type sends the same 7 keys, so one workflow can post the firings of all your monitors.
Good to know
summarycarries the values. The body holds nopayload. To read a price or a score as its own field, create awebhookchannel instead. See Webhook deliveries.- Slack accepts 1 request per second for each workflow. If Slack responds with a
429, Tako retries the delivery. For the retry schedule, see How Tako retries. - Tako pauses a notification channel after 2 consecutive failed deliveries. If you unpublish the workflow, its deliveries fail, and Tako pauses the notification channel. Publish the workflow again, then resume the notification channel.
- A notification channel’s URL is fixed. If you replace the workflow, it gets a new trigger URL. Every notification channel counts toward your limit, paused or not, so delete the old notification channel first. Deleting it removes it from every monitor. Then register the new URL as a new notification channel, and attach it to your monitors with
PATCH. - A
slack_workflownotification channel counts toward your limit. By default, you can hold 2 notification channels, of either kind.