Forward Data to Cake Red

In this tutorial, we will show you how to pass data from all sensors in your workspace to Cake Red (or another Node Red).

What is it? What can I use it for?

If you want to exchange data from your sensors in real time with Cake Red (or other systems) and don't want to use individual nodes or MQTT for this, then the Outgoing Webhook Integration is just right.

With this integration, you can forward all current or future devices and their data to Cake Red with just one setup.

This happens in real time. If a measured value comes in, it is immediately forwarded to Cake Red via the Webhook address according to the configuration.

Another advantage is that you can forward the decoder output yourself and thus have a way to forward data that Datacake cannot use, but Cake Red can.

Read also the following article to learn more about the integration.

Outgoing Webhooks

Requirements

This tutorial shows the connection between a Datacake Workspace, its devices, and Cake Red (or another Node-RED with a public URL).

Therefore, this tutorial has the following requirements.

  • You have a Datacake workspace.

  • There are devices in your workspace, and they send data.

  • You have a Cake Red instance enabled.

  • Alternatively, a Node-RED, which is accessible via a public domain or IP.

How to Start

Open Cake Red Settings

The Cake Red, which has been integrated into your workspace, has a firewall that protects it from unauthorized access from the outside world. However, for it to receive data from the workspace, a path in this firewall (and authentication) must be enabled.

Please navigate the Integration section on the sidebar and open the Cake-Red tab to do this.

Add Route on Path Allowlist

In the Cake Red settings, please scroll to the bottom of the page. There you will find the Firewall and Path settings.

Here we now set a path on the Path Allowlist. This path will later receive the data from the current workspace.

Here you choose e.g.

  • datacake/

You can also release multiple paths if you need to. Paths for accessing Node-RED dashboard nodes can also be specified here. Read more about this in the following article.

Cake Red

Deploy Changes

Once you have created the path in the settings, you still need to confirm the changes by clicking the "Deploy Changes" button.

This will cause the Cake Red instance to be reconfigured (which is necessary for the firewall). Therefore, your Cake Red will be unavailable for a maximum of 30 minutes and you will see the "Installation" badge in the sidebar.

Create Incoming Node

For Cake Red to receive the data from the Datacake Webhook Forward, you must include an HTTP interface in Cake Red. This is done via the HTTP Input Node.

In the HTTP Input, we now set the path, which we will later access from the Webhook Forwarding integration on Datacake and which we have set in the step before (on Cake Red Path Allowlist)

For the flow to be able to send a response back to Datacake, we still need a template and the HTTP output node.

Below we have attached all the necessary nodes as a JSON export. You can copy and paste this into your Cake Red or Node-RED.

Import Nodes

For ease of installation, we have exported the required Node-RED nodes as JSON. Please copy the following JSON string and import it into your Cake Red.

[{"id":"891f23db.c0a95","type":"http in","z":"d83bf667.fcb3b8","name":"","url":"/datacake/","method":"post","upload":false,"swaggerDoc":"","x":150,"y":120,"wires":[["8d0366b4.686788"]]},{"id":"8d0366b4.686788","type":"template","z":"d83bf667.fcb3b8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Thanks for the data!","output":"str","x":340,"y":120,"wires":[["b4112468.58ace8","70a9cd6f.cafd64"]]},{"id":"b4112468.58ace8","type":"http response","z":"d83bf667.fcb3b8","name":"","statusCode":"200","headers":{},"x":520,"y":120,"wires":[]},{"id":"70a9cd6f.cafd64","type":"debug","z":"d83bf667.fcb3b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":530,"y":180,"wires":[]}]

Activate Webhook Forwarding

Now that Cake Red (or its external Node-RED) has been prepared to receive data via its HTTP input, all we need to do on Datacake is create the forwarding of the data.

Please use the sidebar to navigate into the Integration section and select the Webhooks tab to do this.

With the Webhook integration, web addresses can be specified in your workspace. Datacake then uses these to forward incoming measurement data from the sensors to this URL. You can determine which data will be forwarded. The following options are available.

  • Decoder Output

  • Database entries

  • Downlinks

You can choose which options you want to have activated.

We recommend the Decoder Output, because this allows you to write back measured values from Node-RED via API, for example, without triggering a new webhook.

Please be careful!

The webhook forwarding potentially bears the risk that you create an endless loop. You are responsible for preventing these loops. If this happens, the rate limiting on the Datacake side will take effect and disable your devices.

Set up forwarding

Please create a new entry and select the respective options to enable a Webhook Forward.

As URL, please enter the URL of the Cake Red server plus the path we created in the previous steps.

For the above example, this would be in our case:

  • https://datacake-mqtt-9a4c.cakered.io/datacake/

See Incoming Data

If the setup was correct, you should now be able to see the first data in the debug view.

If you want to read more about the format of the outgoing webhook integration, please look at the following article.

Outgoing Webhooks

Last updated