Losing Data in webhook message

bool result = Particle.publish(“batteryvoltagecurrent”, String(battery_Voltage) + “,” + String(current_mA), PRIVATE, WITH_ACK);

{
  "event": "{{{PARTICLE_EVENT_NAME}}}",
  "data": "{{{PARTICLE_EVENT_VALUE}}}",
  "coreid": "{{{PARTICLE_DEVICE_ID}}}",
  "published_at": "{{{PARTICLE_PUBLISHED_AT}}}",
  "value": "{{{PARTICLE_EVENT_VALUE}}}"
}

The source event that triggered the webhook
{
“name”: “batteryvoltagecurrent”,
“data”: “4.126250,18.988064”,
“published_at”: “2023-04-23T15:24:54.860Z”,
“coreid”: “e00fce68cf8f56b3eaac4b41”
}

Resulting webhook message with no event name or coreid.

{“id”:“0F9K9JWB3R4R98JH5Z9WKDTYH6”,“value”:“4.126250,18.988064”,“feed_id”:2507524,“feed_key”:“halco-all-locations”,“created_at”:“2023-04-23T15:24:54Z”,“created_epoch”:1682263494,“expiration”:“2023-06-22T15:24:54Z”}

What have I done wrong to lose these values in the webhook message???

Do you have more than one webhook triggering for batteryvoltagecurrent? It’s a prefix match, so a webhook with an event name of battery would trigger for batteryvoltagecurrent, for example. If you have a product, the webhook could either be in the product or the claimed owner’s sandbox.

Assuming the last thing is the payload that your server is seeing, that data is generated by a completely different webhook, as not only does it not have coreid, it has a bunch of other fields that are not in your webhook listed.

1 Like

I deleted all webhooks in my application. I then added one webhook to each device in my one product , and I get the same result - no event name and no codeid.

Event
The source event that triggered the webhook
{
“name”: “batteryvoltagecurrent”,
“data”: “batteryvoltagecurrent,e00fce68cf8f56b3eaac4b41,4.078750,19.024813”,
“published_at”: “2023-04-25T11:19:24.851Z”,
“coreid”: “e00fce68cf8f56b3eaac4b41”,
“userid”: “5af0d20c9ec28504b5c726e9”,
“version”: 0,
“public”: false,
“productID”: 19812
}

I have added the codeID and event name in my app’s publish. This necessitate a different software for each device.

Message to url:
{“id”:“0F9MRPBF8C2WEHSQFN2C7NDH91”,“value”:" batteryvoltagecurrent,e00fce68cf8f56b3eaac4b41,4.078750,19.024813",“feed_id”:2507524,“feed_key”:“halco-all-locations”,“created_at”:“2023-04-25T11:19:24Z”,“created_epoch”:1682421564,“expiration”:“2023-06-24T11:19:24Z”}

Thanks

What is the webhook configuration JSON? The parameters in the triggering event are not passed to the server unless they are also in the webhook template.

Does this help?

Request Format

Web Form

{
“event”: “{{{PARTICLE_EVENT_NAME}}}”,
“data”: “{{{PARTICLE_EVENT_VALUE}}}”,
“coreid”: “{{{PARTICLE_DEVICE_ID}}}”,
“published_at”: “{{{PARTICLE_PUBLISHED_AT}}}”,
“userid”: “{{{PRODUCT_USER_ID}}}”,
“fw_version”: “{{{PRODUCT_VERSION}}}”,
“public”: “{{{PARTICLE_EVENT_PUBLIC}}}”,
“value”: " {{{PARTICLE_EVENT_VALUE}}}"
}

What is “Message to url”? Is that coming from your server logs?

All of the other parameters like feed_id and feed_key are not coming from the Webhook, assuming that the correct webhook is triggering. And it looks like it’s picking up value from the data field of the event JSON. That means that the part that would need to pick up the coreid would be in your server configuration, not the webhook configuration.

Rick,

Thanks for all your efforts debugging my code. I added mydeviceID = System.deviceID() to my code and put mydeviceID in the publish string. Now I can OTA this single code to all my devices.

Thanks for your help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.