HTTP Post (webhook) is different in V3 than in V2

Hello! Im getting used to using V3 instead of V2 and seems to be working fine for me (except for the 10 TTIG that I expect that can migrate next month).

There is a “little” problem in version 3 that I see for my uses…

We have developed some code that gets the POSTS (HTML posts in V2) and saves this data in a database. Everything works fine, version 3 has also the same feature by using the webhooks except that there is a minor “problem”.

Posts are not written in the same way in V2 than in V3, for example, “dev_id” is now “device_id”, “app_id” is now “application_id”, “hardware_serial” is now “dev_eui”.

I know it can be easily resolved by re-writing the code but it makes it difficult to have both consoles working at the same time (V2 and V3) until I manage to move all the sensor to Version 3.

Not sure if this is a statement or a plea for help.

You could have a copy of your script, suitably altered, side by side with the old script as there is no reason to enter a v2 script end-point in to v3, you could have one for each version.

Easy to solve (apart from using two endpoints as @descartes suggested): check which set of fields are available and extract the value from those. Checking for one field will tell you which format message you received.

1 Like

Hello! Im not really very into the programming stuff… im more of an electronic guy but the person that is helping me out with the programming is having difficulties when looking for the values… every time he tries to extract a value from a field he gets the value AND one of the correlation_ids (which I dont know what it is)…

Above some images. We are trying to get the device_id but we are also getting the first correlation id… what is the correlation id anyways??

image

Above an example of how it is in V3:

image

And how it was in V2:

image

Sorry! Everything is good now!! He deleted the whole code and rewrite it and now it is working as it should…

I still have the question about what are the correlation_ids?

Thanks!

TTS generates a whole sequence of messages as it processes something. Most messages can be subscribed to via any number of means. The correlation ids join up all the messages for one over-arching action - like an uplink or a join.

You can tell which server / process it came from the first few letters, ie gs = gateway server, as = application server etc

Hi! I also will have a similar problem, since we’ve been using v2 for a while, and now need to add a new endpoint for v3. Unfortunately, as I only have a TTIG, and there’s no support for migrating it to v3 yet, I cannot test this on my own for the time being. But I could easily create the new uplink endpoint if I had some documentation, or at least a few payload samples I could extrapolate from.

Could anyone please help me? I’ll try to use the screenshots from @Hortimix but it would be great to have a formal definition of the json that is sent to the endpoint, or at least one example of a message with all fields showing.

Thank you!

All the best,
Diego

That is totally inaccurate and the matters are complete separate.

Nothing is stopping you creating an application in v3 with a device and setting up a WebHook.

Your TTIG will relay packets to v3 like it and all other v2 gateways have been doing for months.

As to the formal definition of the JSON, there has been comprehensive documentation on WebHooks for over a year now.

Hi Nick, I appreciate your response. While I’ve been using TTN for a while now, I didn’t have a clear picture of the ability for devices to coexist in V2 and V3. I guess I should then simply create the end devices in V3, right? Could you please point me to the right documentation so I don’t mess up?
As for the Webhooks documentation, I found this, after searching in the forum: Data Formats | The Things Stack for LoRaWAN
Is this what I should be looking at?

All the best,
Diego

It’s all in the documentation - and as well as the data formats, there is information specific to WebHooks.