[Fixed] Webhooks callbacks are not reliable!


#60

I have similar issues and am using Weather Underground as well. I can have a day where everything is rock solid with no missed responses to the next day (when I didn’t have adequate protectionist code) blowing the 500 API calls a day rate limit. I’ve had a device that was running with no drops for 2 days just all of the sudden be unable to get a response and I only call that webhook once an hour at the top of the hour…


#61

yeah, this is a persistent problem that won’t go away, not just Weather Underground, but any API I call with webhooks.

Every 30 seconds:

Listening to: /v1/devices/events
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:38:15.312Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:38:45.310Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:39:15.311Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:39:45.310Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:40:15.311Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:40:15.818Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:40:45.314Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:41:15.318Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:41:45.314Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:41:45.782Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:42:15.318Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:42:15.543Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:42:45.315Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:43:15.318Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:43:45.316Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:44:15.324Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:44:45.316Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:45:15.319Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:45:15.530Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:45:45.320Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:45:45.544Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:46:15.322Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:46:45.318Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:47:15.322Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:47:45.320Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:48:15.320Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:48:45.323Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:49:15.330Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:49:45.337Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:50:15.325Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:50:45.327Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:51:15.326Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:51:15.860Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:51:45.328Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:52:15.332Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:52:45.328Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:52:45.540Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:53:15.327Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:53:45.332Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:54:15.328Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:54:45.333Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:54:45.751Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:55:15.338Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:55:16.002Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:55:45.335Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:56:15.331Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:56:45.332Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:56:45.591Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:57:15.338Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:57:15.564Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:57:45.340Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:57:45.554Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:58:15.337Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T16:58:15.546Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:58:45.337Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:59:15.339Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T16:59:45.338Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:00:15.338Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:00:45.338Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:01:15.341Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:01:45.339Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:02:15.343Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T17:02:15.659Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:02:45.343Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T17:02:45.591Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:03:15.343Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:03:45.342Z”,“coreid”:“myParticleDeviceID”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:04:15.343Z”,“coreid”:“myParticleDeviceID”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T17:04:15.570Z”,“coreid”:“null”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T17:04:45.342Z”,“coreid”:“myParticleDeviceID”}


#62

OK, I have a very FREAKY thing to report in this category…

I was playing around with webhooks, trying to get them to work as in here:

So I created a webhook like this using deviceid like this:

JimBrowerMacbookPro:desktop browerjames$ particle webhook create sunrise_sunset.json
Using settings from the file sunrise_sunset.json
Sending webhook request  { uri: 'https://api.particle.io/v1/webhooks',
  method: 'POST',
  json: true,
  form: 
   { event: 'sun_time',
     url: 'http://api.wunderground.com/api/redacted/astronomy/q/{{myState}}/{{myCity}}.json',
     requestType: 'POST',
     headers: null,
     query: null,
     responseTemplate: '{{#sun_phase}}{{sunrise.hour}}~{{sunrise.minute}}~{{sunset.hour}}~{{sunset.minute}}~{{/sun_phase}}',
     json: null,
     auth: null,
     deviceid: '{{SPARK_CORE_ID}}',
     mydevices: true,
     access_token: 'redacted' } }

and it didn’t return at all… then I modified it back…

JimBrowerMacbookPro:desktop browerjames$ particle webhook create sunrise_sunset.json
Using settings from the file sunrise_sunset.json
Sending webhook request  { uri: 'https://api.particle.io/v1/webhooks',
  method: 'POST',
  json: true,
  form: 
   { event: 'sun_time',
     url: 'http://api.wunderground.com/api/redacted/astronomy/q/{{myState}}/{{myCity}}.json',
     requestType: 'POST',
     headers: null,
     query: null,
     responseTemplate: '{{#sun_phase}}{{sunrise.hour}}~{{sunrise.minute}}~{{sunset.hour}}~{{sunset.minute}}~{{/sun_phase}}',
     json: null,
     auth: null,
     coreid: '{{SPARK_CORE_ID}}',
     mydevices: true,
     deviceid: undefined,
     access_token: 'redacted' } }
Successfully created webhook with ID redacted

but the file does not have deviceid in it!!!

My webhook file:

{
"event": "sun_time",
"url": "http://api.wunderground.com/api/6b82bd24e2449d28/astronomy/q/{{myState}}/{{myCity}}.json",
"requestType": "POST",
"headers": null,
"query": null,
"responseTemplate": "{{#sun_phase}}{{sunrise.hour}}~{{sunrise.minute}}~{{sunset.hour}}~{{sunset.minute}}~{{/sun_phase}}",
"json": null,
"auth": null,
"coreid": "{{SPARK_CORE_ID}}",
"mydevices": true
}

well, lo and behold… it now returns 100% of the time??? yes, that is 100%, not one error after one hour of sending every 30 seconds… What?

Just look :no_mouth: at this:

{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:31:12.809Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:31:13.018Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:31:42.808Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:31:43.084Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:32:12.807Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:32:13.377Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:32:42.810Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:32:43.424Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:33:12.809Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:33:13.334Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:33:42.811Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:33:43.190Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:34:12.809Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:34:13.585Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:34:42.813Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:34:43.597Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:35:12.811Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:35:13.319Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:35:42.815Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:35:43.074Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:36:12.814Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:36:13.065Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:36:42.814Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:36:43.617Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:37:12.813Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:37:13.611Z”,“coreid”:“undefined”}
{“name”:“sun_time”,“data”:"{ “myCity”: “Weston”, “myState”: “FL” }",“ttl”:“60”,“published_at”:“2015-08-29T19:37:42.815Z”,“coreid”:“2f0023000547343233323032”}
{“name”:“hook-response/sun_time/0”,“data”:"“7~00~19~44~”",“ttl”:“60”,“published_at”:“2015-08-29T19:37:43.385Z”,“coreid”:“undefined”}

Ok I am officially befuddled… @Dave ?

it still does not return how I want, but 100% reliability… unprecedented. I wonder if the examples are not missing a key field?

WOW interesting…


#63

interesting! Thanks for posting your findings! I’ve been working on this during the last sprint, and I have some small changes I’m hoping will both help, and provide more information about tracking down other possible issues. My plan is to be releasing those updates Tuesday / Wednesday of this next week.

Thanks!
David


#64

So add the coreid field but don’t populate it?


#65

You can try that… build a webhook like this:

{
"event": "sun_time",
"url": "http://api.wunderground.com/api/yourApiKey/astronomy/q/{{myState}}/{{myCity}}.json",
"requestType": "POST",
"headers": null,
"query": null,
"responseTemplate": "{{#sun_phase}}{{sunrise.hour}}~{{sunrise.minute}}~{{sunset.hour}}~{{sunset.minute}}~{{/sun_phase}}",
"json": null,
"auth": null,
"coreid": "{{SPARK_CORE_ID}}",
"deviceid": "{{SPARK_CORE_ID}}",
"mydevices": true
}

or just

"deviceid": null,

and see what happens… It would be great to see someone get this result too…

webhook still returning very consistently.

EDIT: All I had to do is re-create my old webhooks, with their existing files and now I get a nearly 100% response!!

note that they also now include “deviceid: undefined,” even though i did not add a deviceid attribute in the json file.

JimBrowerMacBookPro:desktop browerjames$ particle webhook create weather_princeton.json
Using settings from the file weather_princeton.json
Sending webhook request  { uri: 'https://api.particle.io/v1/webhooks',
  method: 'POST',
  json: true,
  form: 
   { event: 'Vera_controller/nj_weather',
     url: 'http://api.wunderground.com/api/redacted/conditions/q/NJ/Princeton.json',
     requestType: 'POST',
     headers: null,
     query: null,
     responseTemplate: '{{#response}}{{#current_observation}}{{#estimated}}{{weather}}~{{temp_f}}~{{relative_humidity}}~{{wind_dir}}~{{wind_gust_mph}}~{{dewpoint_f}}~{{/estimated}}{{/current_observation}}{{/response}}',
     json: null,
     auth: null,
     mydevices: true,
     deviceid: undefined,
     access_token: 'redacted' } }
Successfully created webhook with ID redacted

weird… but in a good way


#66

I added the deviceid: null; to my hook and changed the event name to something no one else should be using. Not a single missed response since. Weirdness but working weirdness so I will take it!


#67

@BulldogLowell, OMG!!! I put "deviceid": null in in my webhook and republished it and now I get a response every time!!! I will ping @Dave on this cause this is huge!! :wink:


#68

@peekay123

I appreciate your trying too, it is terrific to see a couple of other folks saw the same result.

I did notice since I happened upon this and saw improvements there seems like some latency in the webhook responses, which in turn caused timeouts…

Hopefully this helps @Dave identify ideas to make this work reliably.


#69

that… is… super weird! but that being said, I think that’s how I’ve always been testing it on my end and it’s been very reliable… so… I guess I should test it the other way! :slight_smile:

Thanks,
David


#70

I am having an incredibly frustrating time trying to get webhooks to work. I have a webhook that’s being published called “request_recipe”. This hits one of my private APIs and returns JSON. In the dashboard, I can see that the request is being called. In my API, I can see the request being made and the proper response being formed. In the dashboard I can see the resulting chunked “hook-response/request-recipe/0” as well as the 1 and 2. However, my event handler for the hook-response is never being called. I am running a photon with firmware v0.4.5-rc.1 with an external antenna in Manual mode.

webhook:

{
  "event":"request_recipe",
  "url":"http://API_URL/recipe/{{SPARK_EVENT_VALUE}}",
  "requestType": "GET",
  "headers": {},
  "mydevices": "true"
}

Subscription code:

void recipeReceived(const char* name, const char* data) {
  Serial.println("Recipe Received.");
}

void setup() {
  WiFi.selectAntenna(ANT_EXTERNAL);
  WiFi.connect();
  Spark.connect();
  Serial.begin(115200);

  bool subscribed = Spark.subscribe("hook-response/request_recipe", recipeReceived);
  if(subscribed) {
    Serial.println("Hook subscription active");
  } else {
    Serial.println("Cannot subscribe to hook");
  }
}

I’m at the end of my rope, any assistance would be greatly apprciated.


#71

Hi @cadwallion,

Try:

 Spark.subscribe("hook-response/request_recipe", recipeReceived, MY_DEVICES);

Thanks,
David


#72

It makes no sense because I had that EXACT code earlier today and it had no impact, but I just tried it again with MY_DEVICES added and it works. I’m afraid any time something like this happens because while it’s nice to be functional, magically fixing things tend to bite me down the road.

At least for now it’s functional. Thanks!


#73

@cadwallion, are you running in MANUAL mode? You may want to wait for Spark.connected() before you subscribe.


#74

I am indeed running in MANUAL mode. I’ll add that check in as well, thanks.


#75

This is reading like a BuzzFeed article: “Fix your webhooks with this one neat trick!”

But, seriously, I just tested ,and it works. :slight_smile:


#76

Hey Everybody!

Yesterday I rolled out a small upgrade to webhooks with lots of little bug fixes and hopefully some big reliability updates. If I’m right, you should see a massive improvement in hook reliability, and if not I wanna know about it!

Here’s what changed:

  • The hooks now publish a “hook-sent” message right before they reach out to the target server, so you know the hook was activated, even if the target server is slow to respond.
  • Internally, any response from the hook servers are tallied, and we’ll be scrutinizing those counts and setting alerts on them to confirm they’re being sent properly.
  • The hooks response transport had an issue where some identifiers might collide, being a source of response unreliability, this has been fixed both when specifying ‘deviceid’, and when leaving that blank.
  • The hooks no longer “double-serialize” responses from your server, so no more of "\"\"this\"\"" :slight_smile:
  • hooks now have responseTopic templates, and errorResponseTopic (coming soon), so you can dynamically change the response topic event name based on templated values.
  • hooks no longer “die” after 10 http errors in a row. They now just sleep for a minute to give the target server a break.
  • the maximum number of simultaneous requests for a hook (regardless of rate limit) is now ~100 simultaneous request sockets (up from like 5). So your hook should have a much easier time of handling bursting requests.
  • After reaching out to the librato team, we’ve increased the domain limit for librato to 2000 requests per minute for now, in case your requests to librato were being dropped due to the rate limits.
  • oh, you can now set deviceid to {{SPARK_CORE_ID}}, and it’ll respond as if it’s from that device. This is an experimental feature, and I’m curious to hear your thoughts on that.
  • and more!

Please let me know if your hook experience improves or not, thanks for reading! :slight_smile:

Thanks,
David


#77

Thanks for the update. I’ve been watching the dashboard and within 1-2 seconds see the publish, hook-sent, and reply.


#78

Not a single drop since the changes were implemented. I had made the deviceid: undefined; change last week to deal with some of the stability issues and now my responses look like this. What does the question mark inside a diamond mean?


#79

Yay! When the hook replies with the response, it generates a random internal name for the socket, so that’s pretty much some random bytes. :slight_smile: I’ll probably be hiding that before too long since it’s mostly gibberish.

Thanks,
David