Datacake Docs
Ask or search…
K

Send Slack Notifications

Using our Rule Engine you can send Slack Notifications via Webhook

Information

Datacakes Rule Engine has the feature to call webhooks as actions to a triggering rule. In this tutorial, we are showing you how you can connect a Slack Webhook and send messages to your Slack channels.

Prerequisites

Slack Application

Before setting up a Slack webhook, you must create an application in your Slack workspace and enable the webhook feature.
Read the following article to find out how exactly you can do this.
Sending messages using Incoming Webhooks
Slack API
Guide on how to set up incoming webhooks on Slack

Creating a Rule

Create a new rule on Datacake and select the respective sensor conditions for the rule.
Now select "Webhook" as the action and enter the URL to call field the URL you created on the Slack Workspace app.
Rule Configuration on Datacake
You can leave the header configuration as the default unless your Slack integration needs additional configuration.

Payload

Using the Payload option in the Datacake Rule, you can specify the message that will be displayed on Slack. For this purpose, the Webhook integration on Slack offers various design options.
We show you a possible example in the following snippet. Please copy and paste it into your rule.
{
"text": "Datacake Sensor Notification",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":warning: *Sensor Notification:*"
}
},
{
"type": "section",
"block_id": "section567",
"text": {
"type": "mrkdwn",
"text": "Dragino LHT65 in Vreden, set up outdoors, has reached a temperature below freezing. See current readings below."
},
},
{
"type": "section",
"block_id": "section789",
"fields": [
{
"type": "mrkdwn",
"text": "*Temperature:* \n{{ devices["03710dd1-2157-408f-ab9d-1c00b8b2eef8"]["measurements"]["TEMPERATURE"] }} *C"
},
{
"type": "mrkdwn",
"text": "*Humidity:* \n{{ devices["03710dd1-2157-408f-ab9d-1c00b8b2eef8"]["measurements"]["HUMIDITY"] }} %"
},
]
}
]
}
Please make sure that you replace the placeholders for device data with your own placeholders.
Last modified 1yr ago