Webhook custom templates not working as expected

Hi! Thanks for the fast reply!

I did read the comment in this thread : WebHook with more then one value

And managed to solve my issue by following Rickkas7 example.

What solved my issue was of the following:

  1. Migrating from usind the web console to using the Particle CLI (fantastic tool btw) for seting up my webhook.
  2. My data buffer in the snprintf call was a bit short so I made it longer.

Now it works perfect. I dont know exactly what made the difference.

Some code for other users to see:
On the particle Electron:

            char data[1000];
            snprintf(data, sizeof(data), 
                 "{\"airPressure\":\"%f\", \"PhonePressure\":\"%f\",\"StartUpTime\":\"%f\",\"LocalTimestamp\":\"%s\"}",
                 p_airSupplyPressure_F32,p_phonePressure_F32,t_startUpTime_F32,Time.timeStr().c_str()); 
                 
            /* Send to cloud */
            s_sendIsSuccess_B = Particle.publish("measurementDone",data, PRIVATE);

My weebhook with the webadress removed:

{
    "event": "measurementDone",
    "url": "https://script.google.com/macros/REMOVED/exec",
    "requestType": "POST",
    "json": {
    	  "airPressure": "{{airPressure}}",
		  "PhonePressure": "{{PhonePressure}}",
          "StartUpTime": "{{StartUpTime}}",
          "LocalTimestamp": "{{LocalTimestamp}}"
    },
    "mydevices": true,
    "noDefaults":true
}
1 Like