Webhook builder to google sheets

Update. I have gotten the sheet to talk to the photon. The webhook is working has posted data using “Web From” way of processing the data but i had trouble getting more than one value to post on the sheet. So I am trying to use the Custom Template feature in the Webhook buidler and passing JSON data.

Here is the publish function I am using in my code

        char data[64];
        snprintf(data, sizeof(data), "{\"ambTempF\":%f,\"ambHumid\":%f}", ambTempF, ambHumid);
        Particle.publish("googleDocs", data, 60,PRIVATE);

and my webhook definition I used the format from this post.

{
    "event": "googleDocs",
    "url": "https://script.google.com/macros/blahblahblah",
    "requestType": "POST",
    "noDefaults": true,
    "rejectUnauthorized": false,
    "json": {
        "ambTempF": "{{{ambTempF}}}",
        "ambHumid": "{{{ambHumid}}}"
    }
}

I am using the google API script found in this post.

I have it to publish every 60 seconds and I know if works because of the Timestamp header function in the google script. Every time it hits the timestamp is posted but the other two rows have undefined. I have a hunch that it is how I am publishing the data or how the sheet is reading the data. Here is what the event log returns;
{"data":"{\"ambTempF\":32.000000,\"ambHumid\":0.000000}","ttl":60,"published_at":"2018-07-22T04:37:22.195Z","coreid":"Omitted","name":"googleDocs"}

I am so close i can taste it. I do appreciate having to figure it out for myself, helps me understand the inner workings better. Any insight is greatly appreciated.

1 Like