I’ve noticed for a while that if I have two webhooks with a similar (but different) names a Publish() to one will trigger both, which is far from ideal.
Background
I’ve setup two webhooks for each integration in my application, one pointing to production and one pointing to dev.
My webhook is structured like so:
{
"event": "envRead",
"responseTopic": "{{PARTICLE_DEVICE_ID}}/hook-response/{{PARTICLE_EVENT_NAME}}",
"errorResponseTopic": "{{PARTICLE_DEVICE_ID}}/hook-error-response/{{PARTICLE_EVENT_NAME}}",
"url": "myurl.io",
"requestType": "POST",
"noDefaults": true,
"rejectUnauthorized": true,
"responseTemplate": "",
"json": "{{{PARTICLE_EVENT_VALUE}}}"
}
With the following (abbreviated) changes made for the dev environment:
{
"event": "envRead_dev",
"url": "myurl.dev"
}
In my code I have a flag setup so I can easily switch and flash to dev when needed.
//Debug flags
#define devServer true
//Global variables
#if devServer
const char * const EnvRHook = "envRead_dev";
//other dev integrations
# else
const char * const EnvRHook = "envRead";
//other prod integrations
#endif
//logic
Particle.publish(EnvRHook, data, PRIVATE, WITH_ACK);
I currently only have one device running to this new webhook and it’s targeting the dev server.
I can see it’s publishing a dev reading but the integration gets triggered twice.
More so If i check the integration page for my prod webhook i see that it was indeed triggered and errored out as expected.
While it succeeded when hitting the dev site.
Anyone else experience this kind of thing, and anyone know how to fix it?