[SOLVED] Distinguishing incoming payload from devices

Hi,
I was wondering if there was a way to link an incoming payload to a specific device?
I have 2 devices in my application so far, and I am using 1 webhook in my Sigfox callback.
But the incoming payload appears on both devices instead of the actual device its coming from.
Thus I can’t compare their data on my dashboard since they’re the same.
Is there a way to say that if {{data.deviceName}} == “device1” then payload is from device device1 etc.?

I’m new to Losant so I’d really appreciate any help! :grin:
Cheers

The best place to look would be our Sigfox guide. It provides our recommended best practice for using a single webhook with multiple devices. From a high-level, you would add a tag to the Losant device with the Sigfox ID. You can then look up the Losant device by that tag when the webhook is triggered. Once you have the correct Losant device, you can publish the state. The guide covers all of this in detail.

Using tags allows you to add any number of devices without having to modify the workflow. You simply need to make sure each Losant device is tagged with its matching Sigfox ID.

Thanks for the feedback.
I do have all my devices tagged already.
It seems that the problem is in Sigfox Callback. Even if I create a webhook for each of my devices, Sigfox handles callbacks per device type, NOT each device itself.
There doesn’t seem to be a way to associate a specific device to a particular callback. Thus it then shows up on Losant as if all devices have reported their payload.

Any thoughts on how I could fix this?

Sigfox sends along the underlying device identifier in the callback body, if you have it configured to do so. It’s in the device variable. You can see more about Sigfox callback variables in their docs.

This ID is then available on the payload at data.body.device. So you could use a conditional node and check {{ data.body.device }} === 'xxxxxx'. We recommend using the Losant API to lookup the device instead so you don’t have to keep adding conditional node as you add devices, but either way will work.

So even though many devices within the same device type are invoking the same webhook, their underlying ID should be sent in the body of the callback so you know which specific device invoked it.

Brilliant! It works now!
I added a conditional node in the workflow and set device state for the correct device depending on the {{ data.body.device }}.
Though I only have one device reporting now, if it breaks again when I turn on more devices then I’ll ask again. But for now its solved. :smile:
Thank you for all your help!