Sensor node -> LoRaWAN gateway -> TTN -> ThingSpeak -- how?

On PUTSREQ : this is a proxy

paste this code in the Response Builder:

// Build a response
var msg = ‘Hello World’;

if(request.params.name) {
msg = 'Hello ’ + request.params.name;
}

response.body = msg;
// Forward a request
var parsedBody = JSON.parse(request.body);
var myPayload = ‘field1=’+parsedBody.payload_fields.temperature+’&field2=’+parsedBody.payload_fields.humidity;
request.body = parsedBody.payload_fields;
request.request_method=‘GET’;
request.forwardTo = ‘https://api.thingspeak.com/update?api_key=&’+myPayload

https://putsreq.com/ … is really a helpful site to filter and format your request… you can use webhook to test your script

ThingSpeak now offers a custom integration to forward your data from a device in an application into a ThingSpeak channel. For details on how to forward data from your existing The Things Network application to a ThingSpeak channel, see Write Data from The Things Network. There is also a full device example at Collect Agricultural Data over The Things Network

2 Likes