Looping webhook triggers in n8n from Evolution Api

Hi everyone,

I’m using n8n to handle a webhook that receives messages from the Evolution API with follow-up moderation actions (I run a huge WA community and got sick of all the spam and promo accounts).

I’m facing an issue where the webhook is re-triggered not only for the initial message but any additional requests related to the message status updates I suspect it’s generating when executed. In short, the moment delete_message, update_group participant, etc. get triggered, their node begins to loop in production. It makes my workflow absolutely unusable, sending hundreds of requests every second, even though in testing, it works perfectly fine.

In short:

  1. Webhook receives metadata from message_upsert
  2. Message passes through admin check (to ignore pre-defined numbers)
  3. Spam filter defines hard spam {{$json.hardSpam}} and soft spam {{$json.softSpam}} which is later filtered through the IF nodes.
  4. Hard spam follows the “Delete message + Remove participant” route;
    Soft spam follows the “Delete message” route
  5. Now workflow should end (I am planning more features after I fix this)

Any idea how to stop the loop? It keeps looping and sending API requests until WhatsApp bans the number (learned the hard way). I just need it to execute once, or learn how to control the loop. So far I coudn’t find the answer anywhere and AI is not helping either.

Thanks!

  • n8n version: Latest
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Not sure
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Hetzner CX 22, Self hosted
  • Operating system: Windows

can you please share the workflow here?

For sure. I am self-hosting, so it won’t let me to share it directly. I am attaching full screenshots though, going through the soft spam route (which is identical to the other one, except for the ban).






I have conducted a little test and just used a webhook and delete message node - it did not loop. So the issue must be triggered by the nodes before I guess

I might have discivered a solution, till now, I was usuing general webhook in evolution API. Once I toggled webhook by events and changed the webhook, it seemed to have stopped. I am not sure entirely why (perhaps some of more experienced n8n members will explain), but webhook by event do not trigger loops anymore.

I will do some more testing, but so far it seems this was the issue!


image

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