Screen displaying AI chat interface DeepSeek on a dark background.

How to use n8n to implement Telegram community message reminder

Have you ever been overwhelmed by community management? When a newbie joins, you are in a hurry to send a welcome message, and you only realize it after an old member leaves. These repetitive operations not only take up time, but also may miss the key moments to maintain the community atmosphere.

Today I’d like to share with you how to build a Telegram group automation bot with n8n to automatically complete the two core scenarios of “welcoming newbies” and “saying goodbye to members”.

What can this robot do for you?

Simply put, it is a 24-hour online “community assistant” with two core functions:

1. Automatic welcome for newbies: When a newbie joins a Telegram group, the bot will immediately send a welcome message

2. Automatic farewell when a member leaves: When a member leaves the group, the robot will send a farewell reminder

5-step configuration guide: Build a workflow from scratch

Step 1: Create a Telegram Bot and Get API Credentials

1. Search for “@BotFather” in Telegram, send /newbot create the bot, follow the prompts to set the name and username (e.g. “MyCommunityBot”).

2. After the creation is successful, BotFather will provide an “API Token”. Save this Token, which will be used later.

Step 2: Get the Telegram Group ID

1. Create or enter the Telegram group you want to manage, add the bot you just created to the group, and grant it the permission to send messages.

2. Send any message in the group, then visit (https://api.telegram.org/bot<Your Token>/getUpdates) (remember to replace <Your Token> with the credential from step 1), find the chat.id field in the returned JSON, for example, -1001234567890, save this ID (i.e., the unique identifier of the group).

Step 3: Build the workflow framework in n8n

After logging in to n8n, click “New workflow” to create a blank workflow and add the following five core nodes (drag and drop to add, no code required):

  • Trigger Node: Listen for Telegram group events
  • Conditional judgment node A : Detect the “new member join” event
  • Conditional judgment node B : Detect the “member left” event
  • Send Message Node A: Send welcome message
  • Send message node B : Send goodbye message

Step 4: Configure node parameters

1. Telegram Trigger Node
  • Select the “Telegram Trigger” node, click “Credentials” → “Add new credential”, enter the “API Token” from step 1, and save the credentials.
  • Configure「Updates」to ["*"] (listen for all events) to ensure that member changes are captured.
2. Conditional judgment node A (detect new members)
  • Select the “IF” node and set the judgment condition:Value 1: {{$node["Trigger Node Name"].json["message"]["new_chat_member"]["first_name"]}}(Get the nickname of the new member)Operation: isEmpty(Determine whether it is empty)
  • When the condition is “false” (i.e., a new member is detected), connect to the “Send welcome message” node.
3. Conditional judgment node B (detect member leaving)
  • Similarly, add another “IF” node and set it as follows:Value 1: {{$node["Trigger Node Name"].json["message"]["left_chat_member"]["first_name"]}}(Get the nickname of the leaving member)Operation: isEmpty
  • When the condition is “false” (i.e., a member departure is detected), connect to the “Send Farewell Message” node.
4. Send Message Node (Telegram)
  • Select the “Telegram” node, select “Send Message” for the action, and select the Telegram Bot credential created in step 4 for the credential.
  • Welcome message configuration:
    • Chat ID: Fill in the group ID obtained in step 2 (e.g.-1001234567890)
    • Text: Custom welcome message, for example:✔️ {{$node["Trigger Node Name"].json["message"]["new_chat_member"]["first_name"]}}, welcome to the n8n Chinese communication group! Remember to check the group announcement
  • Farewell message configuration :
    • Chat ID: Same as above
    • Text: Custom goodbye message, e.g.✖️ {{$node["Trigger Node Name"].json["message"]["left_chat_member"]["first_name"]}} has left. Thanks for their contribution to the community!

The charm of n8n: more than just community management

This workflow may seem simple, but it demonstrates the core strengths of n8n: visual drag-and-drop, flexible conditional logic, and rich integration capabilities. In addition to Telegram, n8n can connect to more than 200 tools such as Discord and Slack to implement more automation scenarios:

  • Automatically send welcome emails after new users fill out the form (Google Forms + SendGrid)
  • Monitor Twitter keywords and automatically forward them to the Discord channel (Twitter + Discord)

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注