Filter Exisitng Entry Every 'X' number of Hours from HTTP Request

Hey guys,

So I have a client I’m helping send out Messages to Twilio

Basically what I’m doing is I have a custom form that’s 24/7 collecting information on Google Sheets
(Names & Phone Number) then using Google Sheets Trigger (Custom Node from : n8n-nodes-google-sheets-trigger - npm) once a new row is detected a message is sent to that new Number.

Essentially the messages being sent are “Hi [[username]], thanks for filling out our Form. We’ll get back to you shortly”

So everything’s working well to that end, the thing is some of the customers are in a situation where they have to fill in 2 or more Questionnairs thereby getting 2 or more “Thank you Messages” (I’m trying to avoid spamming)

I’d like to know if there’s a way I can filter out (using ‘IF Node’ maybe? 'Date/Time Node maybe?) numbers that are already existing not to be sent the message

i.e if number has been sent a Thank you message in the past 24hours, don’t send message.

The Nodes are
GoogleSheets Trigger > Set Node > Twilio

You could look at using getWorkflowStaticData.

You could save the user/number and check if they already exist. You probably want to store them with a timestamp and clean out the list for any entries over 24hrs

@pemontto thanks for taking the time to give this a look

The entries each have unique timestamps on Google Sheet as well (i.e the time the entry was made & filled on Google Sheets)

Do I then use the timestamp (Ps: do they have to be in ISO-8601 format e.g 2020-07-10 15:00:00.000 ?) & pass it on the expression : getWorkflowStaticData ?

Kindly, if you can, do provide with an example workflow…

Thanks.

Can you post a redacted JSON sample of the data from the trigger in your workflow and I’ll have a crack?

BTW managing the date is just so your static data doesn’t balloon out unbounded. We need to know which entries we can clean up safely!

Here’s some randomly generated data just to get the gist of the format of data that’s coming from Google Sheets.

I’m assuming the getWorkflowStaticData Node will come between the Set & Twilio Node?

Ps : if Phone Number has been sent a Thank you message in the past 24hours, don’t send message.

Contains;

  1. Name
  2. Number
  3. Timestamp
  4. Message

Here’s something that might get you started

  • Cleanup clears entries older than 24hrs
  • Throttle will set the item.send field to false if an SMS has already been sent