How to apply a webhook to messages using a plugin?

Using a webhook plugin to make requests to the script on your custom server to modify messages.

The "msg-webhook" plugin type sends POST requests with an array of messages before they are registered with the device. The plugin then merges the response with the original message set.

Click on the "+" button in the Telematics Hub -> Plugins section to create a new plugin:

flespi panel telematics hub plugins

Pick “msg-webhook” in the configuration drop-down and specify something like http://your-server:port/post as a URI parameter.

Deploy your custom processing script on your server or VPS. Configure your example to listen on your-server:port network endpoint and to handle a /post URI.

Hint: to give this plugin a quick try, you can deploy our example (Node.JS, PHP) on your server and then modify it to your needs (our example adds a "datetime" and "squirrel" parameters with human-readable date and a 🐿️ (squirrel) respectively to each message).

create webhook plugin

You can also specify the list of parameters to include in the message if you don’t need all of them.

Then we need to assign this plugin to the right devices. Open the created plugin and go to the Devices tab. Then click the "+" button to assign devices:

assign device to webhook plugin

Save the plugin and flespi platform will constantly deliver a batch of messages to your deployment. Then go to the Telemetry tab for the given device to check if the date and the squirrel appeared among the device parameters:

check webhook plugin telemetry

Done.


See also
Using a plugin to detect if the position is inside a specified list of geofences and add status to the device message.
Using plugins to resolve information about Wi-Fi nodes into location data with the help of Google Wi-Fi Geolocation API.