Automating WhatsApp Message Forwarding to a Channel with n8n, Docker, and WAHA
Automating WhatsApp Message Forwarding to a Channel with n8n, Docker, and WAHA
In this post, I share how I automated the forwarding of messages from a WhatsApp group to a channel using n8n, Docker, and the WAHA library. I set everything up on an old laptop I use as a local server. The goal is to make it easier to manage a ridesharing group between Zamora and Salamanca, which had reached its participant limit.
Message Reception
WAHA receives messages from the group and sends them to an n8n webhook.
Smart Filtering
n8n queries Google Gemini to decide if the message is a ride post or not.
It also automatically discards messages with keywords like "someone" or "looking for".
Enrichment
If the phone number is missing, the system adds it automatically.
Forwarding
The message is published in the WhatsApp channel.
Visual Confirmation
The bot adds a robot reaction 🤖 to the original message to indicate it was forwarded successfully.
WAHA Disconnection
The server restarted every Saturday at dawn and WAHA stopped sending messages. I solved it with an automatic Docker container restart routine.
Incorrect Message Filtering
At first, questions or replies were forwarded. I added a keyword filter and improved the AI prompt to reduce false positives.
This automation has reduced manual effort and made the group much more useful for everyone. If you have a large group and need to automate repetitive tasks, I encourage you to try n8n and Docker.
Would you like to see the full n8n workflow or need help configuring WAHA? Leave your questions in the comments.