I’m attempting to get a response from my webhook and it doesn’t seem to be responding. The published event triggers the webhook and I can see it is successful in the console.
Here is the device-side code:
void gcp_cloud_time_zone_handler(const char *event, const char *data) {
// Handle the integration response
arl_debug("event: %s, data: %s", event, data);
}
void gcp_cloud_init(void)
{
arl_debug("Initializing GCP web-hooks...");
// Subscribe to the integration response event
Particle.subscribe(System.deviceID() + "/hook-response/time_zone/", gcp_cloud_time_zone_handler, MY_DEVICES);
}
int gcp_cloud_get_timezone(void)
{
sprintf(m_msg,"{\"location\":\"33.570297,-117.723793\",\"timestamp\":\"1557790143\"}");
arl_debug("publish: time_zone: %s", m_msg);
Particle.publish("time_zone", m_msg, PRIVATE);
}
Here is the successful event as seen in the Particle IO console:
{
"name": "time_zone",
"data": "{\"location\":\"33.570297,-117.723793\",\"timestamp\":\"1557790143\"}",
"ttl": 60,
"published_at": "2019-05-14T23:31:33.660Z",
"coreid": "2f002a000847373334363431",
"userid": "",
"version": 4,
"public": false,
"productID": 8295
}
Here is the successful response on the Particle IO console from the Google Time Zone API:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Tue, 14 May 2019 22:38:26 GMT
Expires: Wed, 15 May 2019 22:38:26 GMT
Access-Control-Allow-Origin: *
Server: mafe
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
Server-Timing: gfet4t7; dur=88
Cache-Control: public, max-age=86400
Age: 3187
Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39"
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked
{
"dstOffset" : 3600,
"rawOffset" : -28800,
"status" : "OK",
"timeZoneId" : "America/Los_Angeles",
"timeZoneName" : "Pacific Daylight Time"
}
Output of my device console with no response:
[23:44:01:321] Connected to cloud.
[23:44:07:461] lat=33.570297 lon=-117.723793 alt=0 uncertainty=4171
[23:44:07:461] Initializing GCP web-hooks...
[23:44:17:722] publish: time_zone: {"location":"33.570297,-117.723793","timestamp":"1557790143"}type or paste code here
I’m sure I’m doing something wrong I just can’t see it.
Thanks.