[UPDATE: I have been able to get further - see 2nd post in change]
I’m trying to create a webhook to send to Scriptr. The code I have that currently works via Wifi on ESP8266’s and ESP32’s is doing a direct POST to Scriptr and sends:
/RV1Startup/?type=init&temp=[78.9,81.2]&interval=5&gps=[38.12345,78.98765]
Ignore the /RV1Startup/ - that just tells Scriptr which script to run - and that’s working.
I am able to create the webhook and get past the “authorization” at Scriptr. I tried reformatting into a format such as the following and passing it as the data string on the publish:
“init”:[“init”],”temp”:[“78.9,81.2”],“interval”:[“5”],”gps”:[“38.12345,78.98765”]
Since that’s what Scriptr sees from a POST from my working ESP8266 module.
But passing quotes, equal signs, etc. get corrupted and it isn’t really being passed as a set of parameters.
In reading some of the forum posts, I see that using Mustache might work for me, but I’m confused as to what to pass as the data string and what the enter in the webhook setup.
Would I send the following string as data on the publish:
{“type”:”init”,”temp”:[78.9,81.2],”interval”:5,”gps”:[38.12345,78.98765] }
If so, do I need the opening and closing {} and also do I need to create the string using \” for the quotes in the firmware code?
Then, what do I enter where in the webhook? Do I create several parameters on separate lines in a “form” entry in the webhook definition:
type {{type}}
temp {{temp}}
interval {{interval}}
gps {{gps}}
Or do I enter a string like the following in a “JSON” type entry in the webhook definition?
{“type”:{{type}}, “temp”:[{{temp}}], “interval”:{{interval}}, “gps”:{{gps}} }
Scriptr expects Content-type: application/x-www-form-urlencoded
Will this send that way or send as JSON – and does it matter?
Thanks for any assistance – I’m very close to completing the cutover from running on ESP8266/ESP32 using Wifi to the Electron. I thought I was pretty much there once I was successfully able to get the webhook to fire, but now I’m stuck on formatting the data.
Thanks again.