I prepared a simple WhatsApp chatbot in n8n. Now I want to ban some number so so they don’t get a reply.
What I’d like to achieve is:
If a banned number sends a message, it should still trigger the WhatsApp node, but not be passed forward to the AI Agent (basically stop the workflow at that point).
Alternatively, is it possible to not even trigger the WhatsApp On Message trigger when the sender is in the ban list?
To achieve your goal of blocking specific WhatsApp numbers from triggering your n8n workflow or receiving replies from your AI Agent, you can implement this solution.
Before the AI Agent node, add an “If” node to check if the sender’s number is in your ban list.
Set up the condition to check if the sender’s number matches any number in your ban list. If true, stop the workflow.
Connect the “If” node to a node that stops the workflow execution, ensuring the AI Agent node isn’t triggered.
You can maintain your ban list as an external data source, such as a Google Sheet or a database, and use an “HTTP Request” node or a database node to fetch and check the list in your workflow.
Here’s an example of how your workflow can look like.
WhatsApp trigger node, Triggers the workflow when a message is received.
If Node” Checks if the sender’s number is in the ban list. If yes, stops the workflow.
AI Agent Node Processes the message and responds if the sender’s number isn’t banned.