Hi, this appears to still not be fixed. I tried many months ago, and again today. If you post an escaped version it’ll send the string, if you post the actual valid JSON then the webhook system actually hangs for me and doesn’t even create it. Awesome.
@noumanh, you will literally go crazy dealing with all the idiosyncrasies (ie bugs) of the webhook system. Even today I was getting tripped up by the old webhook name issue where publishing to ‘myhook2’ will trigger ‘myhook’ and ‘myhook2’. Don’t start me on the handling of >200 status codes.
My current approach to create a timestamp that is equivalent to FB server timestamp is to construct a millis version of epoch on the particle device just before the publish:
[in global declarations]
double millisForFB = (double) Time.now() * 1000; // epoch in seconds changed to millis for firebase
sprintf(charMillis,"%13.0f", millisForFB); // this is the easiest way I knew of stripping the decimal
s.concat(",\"t\":"); // my abbreviated 'time' field in the json post, i change that in the webhook template to a longer variable name to save space in the length constrained publish string
s.concat(charMillis); // make it a string for concat
Compared to your chaining of services (which from experience I don’t recommend due to the HTTP status code handling and constrained 5 second timeout of particle webhook processing), this should be more reliable and cheaper. You could also patch the results via a firebase cloud function but this approach gets it right first time and doesn’t incur (minimal) cloud function costs.
Welcome to suggest improvements, it works but i’m sure there is a nicer way of skinning the cat. I’m not a C guy, my background is distributed web platforms and data centre networks. We just need to roll with the punches until either we can publish via SSL MQTT to our own API’s or someone takes a long hard look at webhooks and dusts out the cobwebs.