I’m generating JSON in my firmware and sending it via a webhook to my webserver.
Since I don’t want to have JSON encapsulated in JSON my webhook looks like this:
{
"event": "eventname",
"responseTopic": "hook-response/eventname/{{{PARTICLE_DEVICE_ID}}}/",
"url": "https://fancyurl.com",
"requestType": "POST",
"noDefaults": true,
"rejectUnauthorized": true,
"json": "{\"event\":\"{{{PARTICLE_EVENT_NAME}}}\",\"data\":{{{PARTICLE_EVENT_VALUE}}},\"coreid\":\"{{{PARTICLE_DEVICE_ID}}}\",\"published_at\":\"{{{PARTICLE_PUBLISHED_AT}}}\"}"
}
Note the missing " "
around {{{PARTICLE_EVENT_VALUE}}}
, since I want the whole request to be valid JSON when it arrives at my webserver.
Which results in:
...
"data":{"valid":"json","and":"stuff"}
...
Now I would also like the TEST
button in the web-console to still work. But it looks like all the test button does (among other things) is change {{{PARTICLE_EVENT_VALUE}}}
to test-event
. Which results in a JSON request with
...
"data" : test-event
...
Which is not valid JSON.
Is there a way to send un-escaped JSON and have the TEST
button work at the same time?
This seems to be a step in the right direction, but doesn’t look like it was ever implemented: https://github.com/particle-iot/cloud/issues/61