I have followed 2 different guides on setting up Azure IoT Central bridge for The Things Network but seem to have issue with the TTN Webhook integration. I have managed to stream sensor data to TTN from two different nodes ( Tektelic Smart Room Sensor - Base and Microchip rn2483a). However, it seems the data cannot be forwarded to my Azure function through the TTN Webhook integration as nothing happens in the output log of my Azure function and there is no data in my Azure application. View attached image to se my Webhook integration setting.
I got the Base URL from Function app → Functions → Code + Test → Get function URL
I’m not sure this is really a TTN or IoT thing, more a Homer Simpson moment.
If you look at your own screen shot you should see the answer staring you in the face, hopefully the check boxes under the words Enabled messages will cause the “Doh” moment.
@kschiffer: perhaps that hint can be made a bit more clear. Maybe we can make it
Select the message types for which you want to trigger this webhook. For each enabled message type, an optional path can be defined which will be appended to the base URL.
Thanks guys, I noticed my “Doh” mistake Now, my azure function is getting triggered, however I get the following error: Cannot read property ‘toLowerCase’ of undefined.
This is the code I have added just before handleMessage:
req.body = {
device: {
deviceId: req.body.hardware_serial.toLowerCase()
},
measurements: req.body.payload_fields
};
I noticed the necessary changes (highlighted in the code) I needed to make by first outputing the incoming message body using context.log(req.body); which gave me the following output:
I highlighted the parameters that I used in the code to extract the necessary information in order to forward data to my central application.
It does work now but not sure if this was the proper way to do it