Accumulate data in the webhook

Hello everyone,

I hope you’re all doing well. I’m facing a challenge with an automation task and could really use some help.

Here’s the issue: I’m using a WhatsApp API, and I need to accumulate information in a webhook for at least 10 seconds before continuing the flow. However, the problem is that every time a message is sent on WhatsApp, the webhook gets triggered and starts executing immediately. What I actually need is the opposite:

  1. Send a message.
  2. Have the webhook wait for 10 seconds to see if more messages are received.
  3. If no additional messages are received within that time frame, proceed with the workflow.

Is this sort of behavior possible to achieve? Any insights or suggestions would be greatly appreciated. Thank you!

1 Like

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi,

My best recommendation that I could think up is simply:

  1. Webhook trigger node
  2. Wait 10s
  3. Send another API call to grab the latest messages for that thread after the timestamp for the initial webhook triggered message. Now you have all the extra messages if they occured.
  4. The hard part may just be adding these messages to some kind of database or google sheet, so then when the webhook inevitably gets called for also the next messages, you can check against your saved if its already been grabbed in a previous workflow run.

I could try design something to show here if that is confusing to follow.

As far as I know, you cannot make a webhook trigger wait for more requests, as it procs every time there is a new request, by design.

You’ll have to verify this is possible though without Business Cloud, as WhatsApp is extremely strict in who and how their API can be used. I believe most features are blocked behind a “verified partner” wall ie you have to pay thru a verified partner for full API. Ie another client had to use Respond.io, but thats a beastly 300-500/m.

Justin - thinkbot.agency

Thanks for answering!

Currently I store these messages temporarily in baserow, concatenate them and send them through a flow that cancels the running flows and leaves only the one that has just started running, but like in WhatsApp I will have several users every time a different user If you sent a message, the execution of other users would also be impacted.

I’ll try to follow your reasoning and see the result and comment here :slight_smile:

1 Like

You would need to also track per user then as well in some kind of database or sheets.

Currently I created a “registration” system within each conversation, when the user contacts the bot it takes the number and name and saves it in the “Customers” table.

Would putting this 10sec wait prevent the webhook from being triggered several times with each message?

Would you be able to provide the flows in backtick format, and data examples? (or click the code button “</>”)
```
flow 1 here
```

```
another
```

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.