Internet of Things (IoT)

Webhook Relay Socket Server provides an ideal method to communicate with your IoT devices without exposing them to the internet or running an HTTP server on them. It uses a lightweight communication protocol called WebSocket which is available in all major programming languages.

Use case

Our WebSockets lets devices to receive webhooks by popular services such as IFTTT, Zapier or anything else. It can also be used for remote access if you are using tunnels. Since webhooks are just a standard HTTP requests, any services can easily produce and consume them. Webhook Relay is particularly useful when:

Node-RED

Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.

We provide node-red-contrib-webhookrelay node that can be used with Node-RED to easily received webhooks.

Usage

To use this node, some configuration is required:

  1. Install node-red-contrib-webhookrelay
  2. Create bucket at https://my.webhookrelay.com/buckets
  3. Generate tokens at https://my.webhookrelay.com/tokens
  4. Supply bucket and token key & secret into the node

Detailed steps with screenshots are available below.

Installing node-red-contrib-webhookrelay node

Open ‘palette’ on your Node-RED web interface and install node-red-contrib-webhookrelay node:

install node-red-contrib-webhookrelay node

Creating Webhook Relay bucket

Buckets are like groups where you can have multiple input URLs and multiple outputs. Since we are using WebSocket streaming, we don’t really care about the outputs. However, it’s good to create at least one output since then you will be able to resend webhooks manually (good for testing integrations).

Go to your buckets page and create a bucket called nodered:

bucket created

Getting token key & secret

Retrieve token key & secret from https://my.webhookrelay.com/tokens page. While token key will remain visible, secret is already encrypted and cannot be decrypted. If you lose your secret, just delete the token and create a new one.

Configuring node-red-contrib-webhookrelay node

Add bucket name and your token key & secret into the node:

configuring webhookrelay node

Receiving webhooks

Any HTTP requests that are received by your Wehbook Relay bucket will be sent to your Node-RED instance:

webhook received

Message structure

Message contains several fields:

{
"topic": "nodered",
"payload": {
"type": "webhook",
"meta": {
"bucked_id": "12302faf-43bd-43c4-ab1d-89a8b0505693",
"bucket_name": "nodered",
"input_id": "544a6fe8-83fe-4361-a264-0fd486e1665d",
"input_name": "Default public endpoint",
"output_name": "",
"output_destination": ""
},
"headers": {
"Content-Type": ["application/json"],
"Accept": ["*/*"],
"Content-Length": ["29"],
},
"query": "",
"body": "{\n\t\"msg\": \"hello Node-RED!\"\n}",
"method": "PUT"
},
"_msgid": "eb4a7330.c838b"
}

Reporting issues

If you encounter any issues or requests, either submit them here or on the github repository here https://github.com/webhookrelay/node-red-contrib-webhookrelay.