Ifttt recipe; each click results in four actions?!

i think i’m going mad… i have a recipe to log button presses on my internet button to a google sheet. so i have the following code:

#include "InternetButton/InternetButton.h"

InternetButton b = InternetButton();
char button_number[33];
    
void setup() {
    b.begin();
}

void loop() {

    if( b.allButtonsOn() ){
        Spark.publish("button.pressed",NULL,10,PRIVATE);
        b.rainbow(5);
        return;
    } else {
        for ( int i=1; i<=4; i++ ) {
            if ( b.buttonOn(i) ) {
                Spark.publish("button.pressed",itoa(i,button_number,10),10,PRIVATE);
                return;
            }
        }
    }

}

and on my IFTTT recipe i have:

if EventName=button.pressed is EventContents=(NULL) 
  then Add row to Spreadsheet SpreadSheetName=buttons FormattedRow="{{CreatedAt}}|||{{DeviceName}}|||{{EventContents}}|||{{EventName}}|||"

so everything works fine. press button. get new row in spreadsheet… then i get another row… and another and another! for each button press i get 4 rows inserted - all identical! what gives?

looking at the IFTTT recipe page, each press actually seems to show that the recipe ran 4 times too. ie it was run 120 times, click button and it then says run 124 times.

afaict, i’ve only got one active recipe with IFTTT.

also, for the allButtonsOn() even though i get the lights coming on, it doesn’t actually register ‘ALL’ in my spreadsheet, it’s either EventContents of 1212 or 3434.

Check this out - How to track debouncing in an interrupt function?

"Do watch out for contact bounce if you have mechanical switches, and
write your code to accomodate that in a fail-safe manner (expect
multiple mS of bounce.) "

great! thanks MisterNetwork! works like a charm.