DigiKeyword / Blog / WhatsApp Webhook Duplicate Notifications

Automation · WhatsApp · n8n

WhatsApp Webhook Sends the Same Message Multiple Times: Deduplication in n8n

A customer sent one message and your bot replied three times. Most of the time the fault is not in your flow but in how webhooks work. We explain the three causes and the fix in n8n.

Here is the classic scene when someone sets up WhatsApp automation and receives their first real customer message: the customer writes "Hello, can I get a price?", and the same automatic reply appears twice in a row, sometimes three times. You check the flow and the logic looks correct. Yet in n8n's execution list there are multiple records for a single message. In this article we explain three separate causes, how to tell which one affects you, and the permanent fix on the n8n side.

Short Answer

According to Meta's documentation, if your endpoint returns anything other than 200, or the notification cannot be delivered for another reason, Meta retries the same notification for up to 7 days, and Meta itself states that this can lead to duplicate notifications. So setting up a webhook on the assumption that "each event arrives once" is wrong. The fix has two parts: decouple the webhook from the work and respond immediately with 200, and deduplicate incoming messages by their ID (messages[].id).

Why does the same message arrive more than once?

There are three different sources, and mixing them up prolongs diagnosis.

1. Meta retries

Meta's webhook setup page says exactly this: if the endpoint responds with anything other than 200, or delivery fails for another reason, Meta retries at progressively longer intervals for up to 7 days until it succeeds. The page also says "these retries may lead to duplicate webhook notifications." The documentation does not state how many seconds or minutes the intervals are, so I will not state them either.

In n8n this usually shows up as follows: after the webhook, your flow calls an AI model or a slow external service, while the webhook node returns the response only at the very end of the flow. While Meta waits for the answer, it loses patience, counts the notification as failed and sends it again. I could not verify from official pages exactly how many seconds Meta waits. Third-party sources give different figures between 3 and 15 seconds; rather than trusting one of them, you should respond as quickly as possible.

2. Status notifications arrive at the same webhook

According to Meta's components page, status notifications also arrive through the same messages field as messages. The difference is that the value object contains a statuses array instead of messages. The page says each outgoing message can generate up to three status notifications: sent, delivered, read.

If you have not set up a filter, every reply your bot sends comes back to you three more times as if it were a "message" and triggers the flow again. This is not a retry; it is your flow mistaking its own reply for a new message. Sometimes the result is an infinite loop.

3. Multiple subscriptions to the same event

If you have an old test webhook, a second n8n instance or a subscription you forgot in the dashboard, the same event can go to two separate addresses. I could not verify this on a Meta page; I know it from a third-party source and from user reports in the n8n community. Rule out the first two causes first, then check the subscription list in the Meta dashboard.

How do you tell which one affects you?

Open the execution list in n8n and look at the JSON of the last two or three duplicate records.

Fix 1: Respond to the webhook immediately

In n8n's Webhook node, the Respond setting offers three options: Immediately, When Last Node Finishes, and Using 'Respond to Webhook' Node. When Immediately is selected, the node responds right away, with the body "Workflow got started". In any WhatsApp flow that involves an AI call or waiting on an external service, this setting solves half the problem, because you answer Meta before the flow finishes. You can change the response code and body from the node.

A warning: if you also perform signature verification, the check that rejects requests with an invalid signature must run before the response. Adding a separate check node so that verification is not skipped is better than "acknowledge everything immediately".

Fix 2: Let only incoming messages through

Put an If or Filter node right after the Webhook and let through the events where the entry[0].changes[0].value.messages field is populated. Those carrying statuses either end silently or go to a separate branch, a flow that writes delivery status to a table. This way your bot does not reply again to the "delivered" notification of its own answer.

Fix 3: Deduplicate the message by its ID

Since retries are unavoidable, you need to catch the second arrival of the same message. According to Meta's components page, the ID of an incoming message is in the entry.changes.value.messages[].id field and starts with wamid.. This value is your deduplication key.

n8n's Remove Duplicates node has a ready-made operation for this: "Remove Items Processed in Previous Executions". If you set "Keep Items Where" to "Value Is New" and give the message ID as the value, items carrying an ID that has been seen before are removed from the flow. The node keeps the history itself, so you don't need to set up a separate database. The history size is 10,000 entries by default. If you use more than one Remove Duplicates node in the same flow, the Scope setting matters: "Node" is the default and each node keeps its own history, while selecting "Workflow" makes the history shared. If you need to reset something, there is a "Clear Deduplication History" operation.

The placement order of the node matters too. The best approach is to put it right after the signature check and the message/status filter, that is, before any costly work is done. If you put it after the AI call, deduplication is useless and you will have paid the model twice.

For status notifications, the key is different

If you write delivery statuses to a table, the key logic changes. According to Meta, the id in the status object is the ID of the outgoing message, so the same message can arrive in three separate notifications with the same id. If you deduplicate only on id, you will mistakenly discard the delivered and read notifications. This inference is mine; the documentation has no such recommendation: building the key by combining the id and status fields looks safer.

When deduplication is not enough

The Remove Duplicates history lives inside the n8n instance. If you run more than one n8n instance, or multiple workers in queue mode, you need to test in your own setup how this history is shared across instances; I could not verify this from the documentation. In critical flows (creating orders, sending payment links), the most robust approach is to store the message ID as a unique record in your own database and to make the operation conditional on that record being inserted successfully. A duplicate order is far more expensive than a duplicate message.

A note on personal data as well: the message ID alone does not carry content, but if you store records containing phone numbers and message text for deduplication, those are also data within the scope of KVKK. Storing only the ID and not keeping the content is enough for this purpose and is the lightest option.

Five checks before going live

  1. Is the Respond setting in the Webhook node Immediately, or is there a fast Respond to Webhook node?
  2. Is there a filter right after it that separates messages from statuses?
  3. Does Remove Duplicates sit before the expensive steps?
  4. Is there only a single webhook subscription for this number in the Meta dashboard?
  5. In critical operations, is the message ID unique in the database?

FAQ

How long does Meta retry failed webhooks?

According to Meta's documentation, if your endpoint responds with anything other than 200, or if a notification cannot be delivered for any other reason, Meta retries delivery at decreasing frequency, for up to 7 days, until it succeeds. The documentation also states explicitly that these retries can result in duplicate notifications.

Which field should I use for deduplication?

For incoming messages, use the id field in the entry.changes.value.messages array (the value starting with wamid.). For status notifications, the id in the statuses array is the ID of the outgoing message; since the same message generates separate notifications for sent, delivered and read, you need to use this ID together with the status as the key.

Do I need to set up a separate database for this in n8n?

Usually not. The Remove Items Processed in Previous Executions operation of n8n's Remove Duplicates node stores the values seen in previous executions itself. The history size is 10,000 records by default. If your record count will exceed this, or if you run more than one n8n instance, you should consider an external database.

Sources: Meta for Developers, "Set up webhooks"; Meta for Developers, "Webhooks components"; n8n Docs, "Remove Duplicates"; n8n Docs, "Webhook". Node names and defaults may vary depending on the n8n version.

If your WhatsApp flow replies twice

Let's review your flow together and put the response time, the filter and the deduplication in the right place.

Book an Appointment Message on WhatsApp

Related posts