Particle Webhook Not Firing

I have a webhook subscription that worked last night but has suddenly stopped firing this morning. It is a webhook integration with my own server. I am able to ping the server myself from curl, and a Particle test works as expected, but my device doesn't appear to send it on its own anymore. I have this in my setup function: Particle.subscribe("hook-response/credentials", getIotCredentials, MY_DEVICES); My device is online, and my other integration with Google API is firing as expected. The logs from the integrations section indicate no activity outside the test pings. I have made no changes code-wise since it was working last.
The only thing that is of concern is that the Kubernetes cluster the server is hosted on was temporarily down, so devices did get 56 500 errors last night, and the Particle Cloud skipped 169 requests.
I want to reiterate that running a curl script to the exact endpoint works as of now.

Any suggestions? Thank you in advance!

Hi Melody, and welcome to the community!

Do you also have a Particle.Publish() somewhere along your loop() function that is being executed every now and then?

Do you see something coming out in the console of the device?
https://console.particle.io/events
Like this:

Cheers

1 Like

Hello,
I have the subscribe() in my setup() I truly only need a response once. It's to grab my mqtt credentials based off the particle device ID. There are no logs in the console unless I do a test ping from the console.
It did previously worked being declared in the setup function, am I better off moving it to the loop()?

Thanks

Hi, a subscribe will Subscribe to events published by devices. (or other servers).

The subscribe alone does not do much, just tells your Particle device to start listening for an external event that another device or server needs to trigger.

Maybe you are confused with Particle.publish()?

Hi. If you were able to resolve the issue, kindly report back what you discovered so it may help others in the community. Thanks! :slightly_smiling_face:

If I am understanding correctly, you are clicking on the "PING" button on the console? If so, that might not be much help, in this case. Here is a link with more info about that:
https://community.particle.io/t/what-does-ping-in-the-console-do/47481

What may have happened is the port forwarding for your device may have been disrupted during the server error session. Once this occurs, the server will forever ping your device over a port which does not exist any more. There is more information about "UDP hole punching" here on the forum and elsewhere.

What @gusgonnet was referring to by asking you if you already had a timer, or some such thing, to occasionally issue a Particle.publish() command, in your current running code, then perhaps the error would resolve itself once the command executes - without restarting/resetting your device.
Let's say, your code might look something like this:

SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);

setup() {
  Particle.subscribe("hook-response/credentials", getIotCredentials, MY_DEVICES);
  ... //your code
}
loop() {
  ... //your code
  if (twelve_hours_passed_since_last_ping) {
    if (Particle.connected) {// may block if NOT connected
      Particle.publish("ping", "alive");
    }
  }
}

If ever a forwarding port becomes disabled (you will never know when) this may restore a working connection for you.

Also, Particle.keepAlive(), can be useful to checkout:
https://docs.particle.io/reference/device-os/api/cloud-functions/particle-keepalive/

Other helpful things for us to know about your situation are:
what device are you using?
what firmware release OS is installed on it?

I forgot to include this link. @rickkas7 talks about port forwarding and blocking. Good to know about:
https://community.particle.io/t/particle-subscriber-callback-takes-more-than-30-seconds-to-a-minute/65029/2

1 Like