Webhook sending multiples

I’m trying to follow along with the webhook example found at https://docs.particle.io/guide/tools-and-features/webhooks/

my code which is flashed to the electron is:

int led = D7;  // The on-board LED

void setup() {
  pinMode(led, OUTPUT);
}

void loop() {
  digitalWrite(led, HIGH);   // Turn ON the LED

  String data = String(random(60, 80));
  Particle.publish("temp", data, PRIVATE);
  delay(30000);               // Wait for 30 seconds

  digitalWrite(led, LOW);    // Turn OFF the LED
  delay(30000);               // Wait for 30 seconds
}

The webhook is sending an HTTP POST request to my server.
The event is named temp and it is receiving ‘data’ from the electron and that value is being uploaded to my form on the server.

In my database I can see the values but for each value (1 every minute) it has uploaded it 11 times.

Looking in the logs I see

the following 11 times

Event name: hook-response/temp/0
Data: 1 record added
Published at: July 20th at 12:53:32 pm
Device: particle-internal

**followed by this 11 times**

Event name: hook-sent/temp
Data: undefined
Published at: July 20th at 12:53:31 pm
Device: particle-internal

**Followed by this once**

Event name: temp
Data: 62
Published at: July 20th at 12:53:30 pm
Device: my-device-name

Could anybody guide me as to where I’m going wrong.
Thanks

I ought to mention that in the webhook setings the Form section has the following

Event: temp
Full url: url to my form
request type: POST
Device: any device
Form:

{
“data”: “{{PARTICLE_EVENT_VALUE}}”
}

Include default attributes: No
Enforce SSL: No

Maybe this in combination with a not very imaginative event name might contribute.
There will be lots of other devices than your own, sending a doh’ event temp :wink:

1 Like

It is set to any device so that if I were to have 2 or 3 electrons each one could publish without having to have a new webhook for each device.

Name wise are you saying that the event name should be unique? That other people can publish to my webhook?

Also the records in the database and logs are 11 instances of the same value and then 11 instances of another value so they are definitely all coming from my device.

I’ve found the problem.

Earlier this morning there seemed to be problems with the webhook creation. Kept getting the bummer timeout message.

Since then it appears that it has created 11 duplicates of the webhook, which I’ve now deleted and all is back to normal!