Hi!
I’m currently trying to setup a webhook that listens for “spark/device/diagnostics/update” events (diagnostic information) and posts to a database. However since the values in the data aren’t connected to any variables I can’t seem to use the json: {} declaration in the custom template. And sending PARTICLE_EVENT_DATA gives a really weird format and does not produce a good json.
My webhook:
{
"event": "spark/device/diagnostics/update",
"deviceID": "-",
"url": "-",
"requestType": "POST",
"noDefaults": true,
"rejectUnauthorized": true,
"json": {
"device": {
"system": {
"uptime": "{{uptime}}",
"memory": {
"total": "{{total}}",
"used": "{{used}}"
}
},
"network": {
"connection": {
"status": "{{{status}}}",
"error": "{{error}}",
"disconnects": "{{disconnects}}",
"attempts": "{{attempts}}",
"disconnect": "{{disconnect}}"
},
"signal": {
"rssi": "{{rssi}}",
"strength": "{{strength}}",
"quality": "{{quality}}",
"qualityv": "{{qualityv}}",
"at": "{{at}}",
"strengthv": "{{strengthv}}"
}
},
"cloud": {
"connection": {
"status": "{{status}}",
"error": "{{error}}",
"attempts": "{{attempts}}",
"disconnect": "{{disconnect}}"
},
"disconnects": "{{disconnects}}",
"publish": {
"rate_limited": "{{rate_limited}}"
},
"coap": {
"unack": "{{unack}}"
}
}
},
"service": {
"device": {
"status": "{{status}}"
},
"coap": {
"round_trip": "{{round_trip}}"
},
"cloud": {
"uptime": "{{uptime}}",
"publish": {
"sent": "{{sent}}"
}
}
}
},
"query": {
"auth": "-"
}
}
I’m aware that the current code is wrong since there are no variables with the names I’ve declared.
How can I send the data from the diagnostics event while preserving a good json format?
Thanks!