Automate Telegram Support Tickets with n8n Bot Integration

Struggling to manage Telegram support conversations and lost message history? This n8n workflow automates Telegram message forwarding, ticket creation, and broadcasting, turning your support group into an efficient ticketing system that safeguards client interactions.
telegram
redis
httpRequest
+10
Learn how to Build this Workflow with AI:
Workflow Identifier: 2024
NODES in Use: stickyNote, if, code, set, httpRequest, redis, telegram, telegramTrigger, switch, splitInBatches, wait, filter, noOp

Press CTRL+F5 if the workflow didn't load.

Visit through Desktop for Best experience

Opening Problem Statement

Meet Ahmed, a growing e-commerce business owner who relies heavily on Telegram for client support. His support team faces a common headache: messages from clients sometimes get lost or deleted, causing confusion and lost sales. Ahmed’s private Telegram support group is flooded daily with messages from customers, making it impossible to track conversations effectively or assign tickets to the right support staff. Time wasted hunting for message history and managing separate tools is cutting into his team’s productivity and hurting the customer experience.

This is where the complexity of managing Telegram P2P messages hits hard — no easy way to keep an immutable record of support chats, and no structured ticketing system native to Telegram. Ahmed needs a solution that keeps every message safe, routes client queries to the right channels, and even broadcasts important updates back to all users without manual overhead.

What This Automation Does

This powerful n8n workflow solves Ahmed’s problem by turning a Telegram group into a seamless support ticketing platform with these key functionalities:

  • Automatically create unique forum topics (tickets) for each user query in the designated Telegram support group, so no messages get lost or deleted by clients.
  • Forward client messages to these dedicated ticket threads ensuring conversations are organized and easily accessible by the support team.
  • Save and manage user data efficiently in a Redis database to track tickets, user status, and message thread IDs for quick retrieval and updates.
  • Handle replies from support members in the group back to the correct client by forwarding their responses back automatically to the user’s chat thread.
  • Broadcast announcement messages from a Telegram channel to all users who previously interacted, filtering out those blocked for a smooth communication flow.
  • Manage edge cases like deleted or closed ticket topics by automatically recreating topics and syncing data to avoid interruptions.

Thanks to this automation, Ahmed’s support team saves countless hours daily, avoids losing vital message history, and offers professional, trackable customer service directly through Telegram.

Prerequisites ⚙️

  • Telegram Bot (created via @BotFather) with Bot Token and admin privileges in your Telegram support group and channel 📧🔑
  • Redis database credentials for fast in-memory user data storage and retrieval 📁🔐
  • n8n automation platform account with credentials set up for Telegram and Redis nodes 🔌
  • Optional: server or cloud hosting for Redis (e.g., Coolify.io) if you don’t want to self-manage Redis ⏱️

Step-by-Step Guide to Deploy This Telegram Support Bot Workflow

1. Set Up Your Telegram Bot & Support Channels

Go to Telegram and use @BotFather to create a new bot. Copy the bot token for use in n8n. Add this bot as an admin to your Telegram support group (where tickets will be organized) and your broadcast channel (for announcements).

In the “Bot-Config” node in n8n, enter your Bot Token, Support Group ID, and Broadcast Channel ID exactly as needed. You’ll see a sticky note before this node explaining these details.

2. Trigger Incoming Telegram Messages

The “Telegram-Bot” trigger listens to all new messages or channel posts. It fires whenever a user sends a message to your bot or group, providing the raw message data to the workflow.

3. Format and Clean Incoming Data

The incoming data is passed to the “Format” node (JavaScript Code node), which escapes special characters and flattens nested objects. This ensures that message data can be safely stored in Redis without syntax issues.

Example snippet for escaping Redis JSON syntax is included in this node’s code parameter.

4. Filter Out Bot Fields & Prepare User Data

The “Bot-Fields”

5. Identify Chat Type & Route Messages

The workflow uses a “Switch” node (named “1st”) to detect if the message comes from a Private chat, Supergroup, or Channel. This helps route the flow depending on the chat source.

6. Check User Existence in Redis Database

The “Check User in Database” Redis node checks if the user’s chat ID exists as a key. The “New User?” IF node uses this to decide if the user is new or existing:

  • If new, user data is saved in Redis with “Save User Data”.
  • If existing, user data is updated with “Update User Data”.

7. For New Users: Create Topic (Ticket Thread) in Support Group

“Create Topic (Chat Ticket)” HTTP Request node calls Telegram API’s createForumTopic method to create a new forum topic in the support group with a naming pattern showing the user’s first name and chat ID.

The created topic’s thread ID is saved in Redis using the “Save Topic ID” Redis node for tracking.

If forwarding the message fails due to the topic not existing, an “IF No Topic Created” node triggers re-creation of the topic and updates Redis accordingly.

8. Forward User’s Incoming Messages to Corresponding Topic

The “Forward New Message” HTTP Request node uses the saved topic (message_thread_id) to forward the original user message from their chat to the support group’s forum topic.

Messages forwarded here cannot be deleted by clients, protecting your message history.

9. Handle Team Replies Back to Users

“Support Forum” IF node checks if the message is inside the support group. The “From Ticket” IF node further verifies if the message is a reply to a topic message.

The “Forward Support Reply To User” HTTP node forwards team replies back to the user’s private chat using Telegram API’s forwardMessage method, preserving the conversation.

10. Notify User Upon Ticket Creation

The “Send User Ticket Created Notification” Telegram node sends a polite notification to the user, informing them a ticket was created and support will respond shortly.

11. Broadcast Messages from Channel to All Users

When a new channel post is detected (“IF Verified Channel” node), all users are retrieved from Redis with “Retrieve all users in DB”.

“Format Users” and “Filter Blocked Users” nodes prepare and filter the users, excluding those marked blocked.

Using “Split In Batches1”, the workflow respects Telegram’s limits by sending up to 29 messages per second.

“Broadcast Channel Post into Users” HTTP node copies channel messages to each user’s private chat automatically, followed by a “Wait1” node to pause and manage rate limits.

12. Handle Message Blocks

The “Set Blocked Member” Redis node can mark users as blocked, preventing future broadcasts to those who wish not to receive messages.

Customizations ✏️

  1. Change Support Group or Bot IDs: In the “Bot-Config” node, update Support_Group_ID and BotToken to use your own Telegram group and Bot credentials.
  2. Customize Ticket Naming Pattern: Edit the two HTTP Request nodes “Create Topic” and “ReCreate Topic” to modify how forum topic names appear, e.g., add more user info or change emoji icons.
  3. Add Message Edit Handling (Future Update): Currently, this project notes an upcoming feature to edit forwarded messages. You can later add a webhook to listen to edit events and update topic messages accordingly in Telegram.
  4. Adjust Broadcast Batch Size: Modify the “Split In Batches1” node’s batch size (default 29) based on your Telegram rate limits or desired throughput.
  5. Add Additional User Data Fields: Extend the “Format” Code node to flatten/save more user message fields into Redis for richer user context.

Troubleshooting 🔧

Problem: “thread not found” error when forwarding messages.

Cause: The Telegram forum topic was deleted or closed by an admin.

Solution: The IF No Topic Created node triggers the “ReCreate Topic” HTTP node automatically to recreate the forum topic and update Redis with new thread ID, ensuring no message loss.

Problem: Redis key not found or data not saving.

Cause: Incorrect Redis credentials or key pattern misconfiguration.

Solution: Double-check Redis credentials in n8n and ensure keys use the proper “TG-USER-{{chat_id}}” pattern. Test Redis connection separately to confirm access.

Problem: Messages not forwarding to Telegram support group.

Cause: Bot not an admin or missing permissions in Telegram group.

Solution: Make sure the Telegram bot has admin rights with permission to manage topics and send messages in the support group.

Pre-Production Checklist ✅

  • Verify Telegram Bot Token and ensure Bot is admin in group and channel.
  • Test Redis connectivity and credentials.
  • Send test messages from private chat and ensure tickets (forum topics) are created and messages appear in the support group.
  • Send replies in support group topics and verify they appear in the user’s private chat.
  • Test channel broadcast posts and confirm messages forward to users respecting block lists.

Deployment Guide

Activate your n8n workflow and ensure the Telegram-Bot trigger webhook URL is set correctly in your Telegram Bot webhook configuration for real-time message handling.

Monitor your workflow executions within n8n’s UI for any errors or skipped messages and use logs to debug if necessary.

If you self-host n8n or Redis, ensure uptime and scalability according to message volume. Consider setting up alerts for failures.

FaQ2

  1. Can I use other messaging platforms instead of Telegram?

    This workflow specifically uses Telegram nodes and API calls. To use another platform, significant reconfiguration would be needed with compatible nodes.

  2. Does this use a lot of API calls?

    It depends on message volume. Telegram limits apply, and this workflow batches broadcasts accordingly to avoid hitting rate limits.

  3. Is user data secure?

    User data is stored securely in Redis in memory. Bots only access chat IDs and message metadata required for forwarding, not sensitive personal data.

  4. Can I scale this for thousands of users?

    Yes, with proper hosting and Redis scaling, this workflow supports large user bases but watch Telegram rate limits for broadcasts.

Conclusion

By implementing this n8n Telegram support bot workflow, you transform your Telegram support group into a robust, ticket-based customer service platform that keeps all user messages safe from deletion and organizes conversations for efficient collaboration.

You save hours of manual tracking, prevent lost conversations, and broadcast important updates reliably. Next steps include adding message edit support, enhancing customer lead integrations, or extending to multi-channel support.

Give your Telegram support a professional upgrade with this workflow and watch your customer satisfaction and team productivity soar!

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free