After claiming webhooks are not always passed to our server

Hi people,
We have been working hard to get our app and server reliably working with Photon P1 and use a claiming process that always works. We follow this sequence of steps:

  1. Photon P1 is in SoftAP mode
  2. Our app sends WiFi-credentials to the P1
  3. Our app send Photon ID to our server, server verifies list of IDs and adds device to Photon Cloud, claims the device and the renames the device
  4. typically before the claim is ready the P1 is already online and (trying to) sends webhook calls.

Issue is that the webhooks sometimes work right after setup, but 1 out of 3 times we need a reboot of the P1 to have the webhook works (arrive via the cloud at our server).

Are we doing something wrong here? Are we running in a similar issue as this [Webhooks] Hook-response fails when device claimed

Any help is really appreciated.

I think I have found some factor: we had webhooks defined on the user/account level and not on the procuct level. As the P1 was added to a product it does seem to influence if the webhooks are send to our server.

But still any suggestions to improve reception of all all webhooks really appreciated.

Some extra information on the code we use. After the setup in SoftAP mode we use the following piece of code:"entering listen mode");

    WiFi.listen();"done with listen mode");

    // Publishing this event will disconnect your session and force a new session to be created
    Particle.publish("spark/device/session/end", "", PRIVATE);
    // delay(2000);

/* In the SEMI_AUTOMATIC and MANUAL system modes, the functions must
   be registered before Particle.connect() is called.
// You must register fucntion BEFORE being connected"registering cloud functions");


Right after the connect we do a publish. That is the publish I talk about, the one that sometimes needs a reboot of the P1 device.

Just to be clear: the problem still occurs, even while we added webhooks on the product level.

Ok, just to help the community. We did find the issue. It was actually caused by two problems:

  • because we enabled threads the setup continues after “WiFi.listen()”. In the setup we have a Particle.connect() and subscribe(), but without WiFi-connectivity the connect fails. After setting up WiFi depending on time you are somewhere in the setup. We now added an explicit wait condition like:
    while (WiFi.listening()) {
  • the second issue is the timing between the P1 device starting to connect to the Particle Cloud and the mobile app switching from WiFi SoftAP on the P1 to WiFi that has Internet. With 3/4/5G phones that switch goes rapidly, but with a WiFi-only device that takes some time. We waited for the mobile app to notify the server that the P1 was brought online and that the claiming can start. Depending on the timing the P1 already started to communicatie with the cloud without being claimed. We have now switched the claim moment to the start of the setup.

Hope this helps other people.
Cheers, Sven