1. Opening Problem Statement
Meet Carlos, the admin of an active Spanish-speaking Telegram community called “N8N en Español.” Every day, Carlos spends valuable time manually sending welcome messages to new members and farewell notes to those leaving the group. It’s repetitive and easy to miss someone, especially when the community grows rapidly. This lack of automation leads to less engagement, slower community bonding, and increased effort for Carlos.
If Carlos could automate these greetings and goodbyes, he would free hours weekly and ensure consistent, warm communication for every member’s arrival or departure, enhancing the group’s atmosphere.
2. What This Automation Does
This n8n workflow specifically handles Telegram group membership changes automatically, sending personalized messages based on real-time Telegram events. Here’s exactly what happens:
- Detects when a new user joins the Telegram group.
- Sends a customized welcome message mentioning the new member’s first name.
- Detects when a user leaves the Telegram group.
- Sends a farewell message mentioning the member who left, wishing them well.
- Ensures message delivery to a specific Telegram chat (@comunidadn8n) using a bot.
- Handles these events instantly to keep community members engaged and acknowledged.
For Carlos, this means eliminating manual messaging, speeding up member acknowledgment, and maintaining a friendly environment without lifting a finger.
3. Prerequisites ⚙️
- n8n Account – Access to n8n workflow automation platform.
- Telegram Bot API Access – Create and connect a Telegram bot to handle sending messages.
- Telegram Group Chat – The group where you want to automate greetings and farewells.
- Telegram Trigger Node – To listen for Telegram updates.
- Telegram Node – To send messages based on the changes detected.
Optionally, you can self-host n8n for full control; see Hostinger’s guide to self-hosting n8n for more details.
4. Step-by-Step Guide
Step 1: Set Up the Telegram Trigger Node
Go to Click + Add Node → Choose “Telegram Trigger”.
Configure it with your Telegram bot credentials. Set the updates field to "*" to listen for all updates including membership changes.
You will see your webhook URL generated; copy it and set it in your Telegram bot settings so it sends updates to n8n.
Outcome: This node listens for any new or leaving members in your Telegram group.
Common Mistake: Forgetting to set webhook on Telegram bot, causing no updates to trigger.
Step 2: Create the First Condition Node for New Members
Add an IF node, name it Saludos-IF.
Set condition to check if the new chat member’s first name is empty:
={{$node["Saludos-TelegramTrigger"].json["message"]["new_chat_member"]["first_name"]}}with condition isEmpty.
Outcome: This condition detects if the update is NOT about a new member joining.
Common Mistake: Wrong JSON path – double check Telegram message structure.
Step 3: Create the Second Condition Node for Members Leaving
Add another IF node, name it Saludos-IF1.
Set the condition similarly, but for members leaving:
={{$node["Saludos-TelegramTrigger"].json["message"]["left_chat_member"]["first_name"]}}with condition isEmpty.
Outcome: This detects if the update is NOT about someone leaving.
Common Mistake: Mixing up new member and left member fields.
Step 4: Connect Conditions to Actions
For the Saludos-IF node, configure the output False branch to connect to a Telegram node configured to send welcome messages.
For the Saludos-IF1 node, connect its output False branch to another Telegram node sending farewell messages.
Step 5: Configure Telegram Nodes to Send Messages
Add two Telegram nodes named S-Telegram2 (for welcomes) and S-Telegram (for farewells).
In S-Telegram2, set the Text field to:
=✔️ {{$node["Saludos-TelegramTrigger"].json["message"]["new_chat_member"]["first_name"]}}, ¡bienvenid@ a N8N en Españoll! 🙌Set the Chat ID to your group username (example: @comunidadn8n).
In S-Telegram, set the Text field to:
=✖️ {{$node["Saludos-TelegramTrigger"].json["message"]["left_chat_member"]["first_name"]}} DEP. 🙏 Que los Dioses te protejan.Also use the same Chat ID.
Outcome: Messages will post automatically when members join or leave.
Common Mistake: Incorrect chat ID or message formatting causing delivery failure.
5. Customizations ✏️
- Change Welcome Message Tone: In
S-Telegram2, editTextfield to a more formal or casual greeting. - Add Member Username: Modify the text to include the member’s Telegram username by accessing
usernamein JSON path. - Send Private Welcome Messages: Add another Telegram node to send direct messages instead of group messages.
- Post to Multiple Groups: Duplicate Telegram nodes and configure
Chat IDfields to broadcast greetings to multiple communities. - Log Member Changes: Insert a database or Google Sheets node to track who joined or left.
6. Troubleshooting 🔧
Problem: “Webhook not triggering for Telegram updates.”
Cause: Telegram bot webhook not set correctly or expired.
Solution: Go to Telegram Botfather, reset webhook URL to the n8n webhook URL again; test sending a message to confirm.
Problem: “Message not sent to group chat.”
Cause: Incorrect chat ID or bot lacks admin rights.
Solution: Verify chat ID syntax @groupname, ensure bot is admin in that group.
Problem: “JSON path errors in IF node conditions.”
Cause: Telegram message structure differences for various events.
Solution: Inspect Telegram update payload and adjust JSON paths accordingly in IF nodes.
7. Pre-Production Checklist ✅
- Verify Telegram bot permissions and admin status in the target group.
- Test Telegram Trigger node receiving new member and left member events.
- Ensure IF nodes correctly distinguish new member vs. left member payloads.
- Test Telegram nodes sending messages to your group.
- Back up your current workflow before modifications.
8. Deployment Guide
Activate your workflow by toggling it active in n8n. The Telegram trigger will listen continuously for membership changes.
Regularly check n8n execution logs for errors or missed messages.
9. FAQs
Q: Can I use this workflow with other messaging platforms?
A: This workflow is built specifically for Telegram nodes, but similar concepts could apply with other platforms if you replace the trigger and messaging nodes.
Q: Does this consume my Telegram bot API quota?
A: Telegram bots have generous free limits; normal group messaging is unlikely to hit any quota.
Q: Is my data secure in this workflow?
A: Data stays within your n8n environment and Telegram API; ensure your n8n instance is secured properly.
10. Conclusion
By following this guide, you empowered Carlos and yourself to automate community greetings and farewells in Telegram groups using n8n. This friendly automation saves him hours of manual outreach weekly and maintains a personal touch with every message.
Next, consider automating message replies, scheduling announcements, or tracking user engagement analytics to level up your Telegram community management further.
Let’s make community management effortless and engaging!