The Things Network (TTN) stack 3 webhook integration

I am failing to configure a webhook on TTN v3 to push data to Losant, i.e. no data arrived yet at Losant.

Please see below my TTN v3 webhook configuration:

Any hint on a proper configuration is greatly appreciated.

Hello @Frank12,

Welcome to the Losant Forums, we’re happy to have you!

It looks like the URL that you are attempting to send a webhook to isn’t the full webhook from Losant. Your webhook should look something like https://triggers.losant.com/webhooks/<webhook-id>, or more specifically https://triggers.losant.com/webhooks/J8tj1awNaoV8E64PsGsk8ACKhKrxs3_A6Tnxqx9d.

If you try the full webhook URL in the Base URL field, does this work?

Thank you,
Heath

Hello @Heath,

Thanks for your speedy reply!

I was actually trying that the first time, but the device status at Losant stays unknown and the data explorer shows no data as well. Maybe I am checking at Losant the wrong places to see if data arrived? Below a screenshot of my first webhook attempt:

Hey @Frank12,

Would you happen to be able to see webhook requests in your Application Log? I created a webhook, and using Postman just sent a POST request to that Webhook and was able to see a response in my Application Log (my webhook name is for-frank :slight_smile: )

Here’s what that would look like:

And here’s my postman setup:

Do you have a workflow being triggered by this webhook? Would you be able to provide a screenshot if so?

but the device status at Losant stays unknown and the data explorer shows no data as well.

The Data Explorer will only show historical device state data, so unless you are triggering a workflow with a Webhook Trigger and using a Device State Output Node to report state for a device, data will not show in the data explorer.

Our Losant Walkthrough goes into detail on how to get data from a webhook and report it as a device state.

Would you happen to be using the Application Template for The Things Network?

Thank you for bearing with me. We’re going to get this figured out!

Thank you,
Heath

Hi @Heath,

I simply missed to activate the TTN Receiver workflow. And yes, I can see now data arriving in the TTN Receiver workflow as well.

I am now stuck with the Authorized node. I can see how the data comes in and that it ends in the debug node after failing the Authorized node, see also below screenshots:

I believe I am not clear what value I should provide in the application globals? Providing here the webhook-ID as used at the TTN webhook seems to be not working.

What I am missing here?

@Frank12,

Happy to hear you’re getting the workflow to trigger!

According to the Template README, you need to set both the Global and the Authorization header in TTN to a complex string similar to a strong password.

I see from the first image you sent along that you have Authorization: Bearer <a token>, the Authorized? conditional node is checking to see if the contents of that header is equal to the same value that the Global has.

So, you will need to make sure that the value you are using in the Authorization header of your webhook in TTN is the same as the value of the Application global.

Thank you,
Heath

@Heath

Sorry, I should have more seriously read the README, mea culpa.

I created now my own complex string (password) and provided that in the TTN webhook as well as in the Application Globals, and it worked right away!

Thanks a lot for “reading” the instructions to me :wink:

Following the TTN template, the next challenge seems to get in the Radio Bridge node to the payload. Actually, the binary data (payload) from my node is already decoded on TTN, into variable names and respective values/units. Do I still need then the Radio Bridge node, or is there another option to parse the already decoded payload (JSON)?

@Frank12,

Actually, the binary data (payload) from my node is already decoded on TTN, into variable names and respective values/units.

Can you see these values on the payload when they come in from the TTN webhook? They should be somewhere like data.body.uplinkMessage looking at a previous screenshot you used. If so, you don’t need to use the Radio Bridge node and can process those values just like you would any other value on the payload. :slight_smile:

If you’re looking for a way to report the state of a device based on values in a payload, you can check out the Losant Walkthrough has a section on how to save data to a device using the Device State Node.

Let me know if this answers your question or if you need more information on this step.

Thank you,
Heath