Using sub-elements within PARTICLE_EVENT_VALUE

I’m using a web hook on spark/device/diagnostics/update events to send vitals to my endpoint. I’m testing with NGROK, but it will be sent through an Azure IoTC Bridge to Azure IoT Central.

To have that work properly, Particle has to send a specifically formatted JSON body which maps specific Device Template capabilities (keys) to values from within the PARTICLE_EVENT_VALUE.

When I send {{{PARTICLE_EVENT_VALUE}}} from the webhook I see data sent, but when I use the dot notation as described in the docs, I get nothing.

{{{PARTICLE_EVENT_VALUE.device.power.battery.charge}}} does not resolve. It always come across as empty.

I don’t think I have the hierarchy wrong… Any suggestions on how to get the dot notation working?

You would not include PARTICLE_EVENT_VALUE in the template as the JSON does not contain a key of that name.

1 Like

Thanks @ScruffR that’s not very intuitive but I can confirm it does work.

{{{PARTICLE_EVENT_VALUE}}} is the whole event data value.

But if you only want sub-elements you can reference them directly {{{device.power.battery.charge}}}

Thank you for the help!

1 Like