Routing Rules, Webhooks and HTTP POST

I have a little IOT project with a Dash and an array of dallas temp sensors. I want the device to send temp data to the cloud, and create alerting/monitoring for the sensors based on ranges. I am trying to use thethings.io to manage the data and create the triggers that would “do something” with the data. I want something like thethings.io so I do not have to setup my own cloud service/server to handle the data and trigger the actions I want (emails, text messages, etc). The device is collecting data from the sensors and sending it in a json message to konekt.io. I can see the messages in the data logs.

My issue is the way that a routing rule sends data to a webhook. The data is sent in a parameter, but the api for thethings.io expects the data to be sent in the body of the http post.

  1. Are there any custom tweaks to how a webhook is called from konekt?

  2. Can I make an http post from the Dash to something other than konekt.io?

Turns out, we do have a way to do this, it’s just not well-documented yet. We’ll try to fix that this week, but here is some information.

Pick the advanced webhook when you’re setting up your routing rule.

This webhook types accepts special variables in the URL or the payload. You can use <<decdata>> in either of these to insert the data of your request into one of those.

For example, if you want to send a POST with your data in the URL, you can do something like this in in the URL field:
http://someiotcloud.com?myfield=<<decdata>>

This also works in the payload field. To completely leave the payload out, put _NONE_ in the payload field.

P.S. The Dash can’t make a POST directly to another server yet, but that’s coming.

Works perfectly! I am now sending data to thingspeak. Thank you!

Great! Glad that’s working for you. More cool stuff coming :slight_smile:

@SoggyB Hi! Can you list how you sent data to thingspeak?

Thanks!

Just like Ruben said above…

You build your querystring in your sketch

key1=value1&key2=value2

Then you create a new route as Ruben described. The querystring you built in the sketch gets appended to the destination url by <<decdata>>

http://somewebapi.com?<<decdata>>

resulting in the web hook making this HTTP POST:

http://somewebapi.com?key1=value1&key2=value2