Hi,
I am successfully connecting a particle device to Azure but the data that is reaching Azure Event hub is not in the format I want.
As described in https://docs.particle.io/guide/tools-and-features/webhooks/ I created a custom template providing the Json that I want to be forwarded to Azure, but basically the webhook ignores the template. The data sent to azure is the same as I had not included a json format in the webhook.
The webhook definition I am using
{
"event": "tasJson",
"url": "https://Myservice.servicebus.windows.net/particle/messages",
"requestType": "POST",
"json": {
"payloadtype":"{{payloadtype}}",
"pin":"{{pin}}",
"value": "{{value}}",
"timestamp": "{{SPARK_PUBLISHED_AT}}",
"guid": "{{SPARK_CORE_ID}}"
},
"azure_sas_token": {
"key_name": "Send",
"key": "MYKEY"
},
"mydevices": true
}
What is sent is:
"data":"{\"payloadtype\": \"pinvalue\",\"pin\": \"D0\",\"value\": \"4\"}","ttl":"60","published_at":"2016-01-04T19:06:26.569Z","coreid":"55ff6f066678505530381667","name":"tasJson"}
this is not the format I requested.
If the webhook is created without the Json part, the result is exactly the same.
{
"event": "tasJson",
"url": "https://Myservice.servicebus.windows.net/particle/messages",
"requestType": "POST",
"azure_sas_token": {
"key_name": "Send",
"key": "MYKEY"
},
"mydevices": true
}
data that is sent using this webhook
{"data":"{\"payloadtype\": \"pinvalue\",\"pin\": \"D0\",\"value\": \"4\"}","ttl":"60","published_at":"2016-01-04T19:08:58.593Z","coreid":"55ff6f066678505530381667","name":"wsa1"}
Code that is being used in the firmware:
// publish the event that will trigger our Webhook
data=String("{\"payloadtype\": \"pinvalue\",\"pin\": \"D0\",\"value\": \"" + String(count[D0]) + "\"}");
success = Particle.publish("tasJson", data, 60, PRIVATE);
Am I doing something wrong or custom templates are not working ?
here is what is shown on the dashboard. Why the “undefined” data ???