Integrate data streams to Slack
Integrate the real-time data published by your devices and clients to Slack
Last updated
Integrate the real-time data published by your devices and clients to Slack
Last updated
If you currently don't have a device or client publishing data to a data stream, learn how to publish real-time messages to the cloud with Node-RED, Javascript, or Python.
You also need to have a Cloud Node-RED server that subscribes to your real-time data streams. If you don't have one, learn how to spin up a secure Cloud Node-RED server, and subscribe to data streams.
Navigate to the Node-RED of your cloud server. From the top right menu, click on Manage palette and select the Install tab.
In the search bar, search for slack and install the node-red-contrib-slack.
From the social nodes on the left palette, drag and drop a slack-web-out node. Connect the desired data stream to a function and ultimately to the slack node.
If you don't have a data stream, learn how to publish real-time data streams and how to subscribe to them in the cloud.
Double click on the slack node to configure the Slack Client by giving it the proper slack app OAuth Token with write permission to the desired channel.
A Slack OAuth Token starts with "xoxb-"
To create a Slack App for this purpose, you can navigate to https://api.slack.com/apps, click on Create New App and follow the instruction. Next, you would need to select the app, and navigate to OAuth & Permissions page to find the token. In the same page, make sure you have given the proper write permission to this app.
After configuring the Slack node, double click on the function node and write the following javascript code to write the data streams to the desired slack channel. Here, you can also define custom rules, such as a threshold, to filter your data. In this tutorial, we simply concatenate each message with a string to form a sentence,
Hit Deploy to apply the changes. You should see the data stream messages are populated to your slack channel.
Congratulations! You successfully integrated a real-time data stream to Slack.