Need a time Filter formula to block WhatsApp messages younger than 5 minutes from first one send

:bullseye: What is your goal?

When a user send me a message my http module send a standard greeting reply and want to block that same http module to send any message again if the user reply to that greeting ( if blocked it run to the next HTTP module and for this I need a 5 minute time filter to block any message from first message send to time of next message. My messages is time tracked from first send in a Google sheet.

:thinking: What is the problem & what have you tried?

I ahve tried this but not sure if it works nor if the 300 is minutes or seconds: dateDiff(now; last_location_updated_at; “seconds”) . I have set this formula in the action bar - Numeric operators equal or less than - 300

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

1 Like

Hi,

You’re on the right track :slightly_smiling_face: In Make, dateDiff() returns the difference in the unit you specify, so in your case 300 means seconds, not minutes. That part is correct.

If you want to block messages that arrive within 5 minutes of the first one, your filter should simply check whether the time difference is less than 300 seconds.

For example, using the timestamp you store in Google Sheets for the first message, this works:

dateDiff(now; first_message_time; “seconds”) < 300

If that condition is true, you block the path. If it’s greater than or equal to 300, you allow the next HTTP module to run.

Just make sure the timestamp coming from Google Sheets is in a valid date/time format that Make can read. Once that’s set, the filter will behave exactly as you expect.

Regards, Tony

2 Likes

Tony you a superstar on this weekend, thanks mate, let me try and I will report back!

3 Likes

Sorry forgot to ask, so my formula is correct you say?

Yes, your formula is correct :+1:
300 is in seconds, so it represents 5 minutes.

As long as the timestamp from Google Sheets is a valid date/time, the filter will work as intended.

Let me know how it goes.

1 Like

I will ( launching tomorrow ) and if I may and so sorry piling this on you, I output distance from my GPS module into the message and it always rounded of to the nearest kilometer, how to get it to show meters. If I am not allowed to ask here my sincere apologies!

1 Like

No worries at all, happy to help :slightly_smiling_face:

Yes, dateDiff() can return a decimal value, that’s normal. For example, 245.37 seconds just means a little over 4 minutes.

For your filter, that’s perfectly fine. You don’t need to round it. Just compare it directly:

If dateDiff(now; first_message_time; “seconds”) < 300, you block the path.
If it’s >= 300, you let the next HTTP module run.

So even with decimals, the logic still works exactly the same.

Hope that clears it up. Let me know how it goes.

2 Likes