AI Telegram Customer Support Assistant with Dynamic Lead Management - n8n Workflow

Deploy an AI Telegram support bot using this powerful n8n workflow. Automate lead capture, manage conversation history, and use n8n node tools for FAQ and service lookups.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Small to medium businesses using Telegram for customer interaction.
Automation developers looking for advanced AI-driven n8n templates.
Users needing a customizable lead management system integrated directly with a conversational interface.
Anyone seeking a powerful n8n workflow example for integrating LLMs with local data storage.

Overview

This advanced n8n workflow transforms a basic Telegram bot into a sophisticated customer support and lead generation assistant. The solution utilizes the power of an AI Agent to handle inquiries, dynamically check for existing lead records, and prompt users for missing qualification data (like name, phone, or email). By leveraging n8n Data Tables, this n8n workflow logs all interactions and stores detailed lead information. This specific n8n workflow is highly customizable, allowing you to easily update the underlying knowledge bases (FAQs, services) without modifying the core logic, making this one of the most effective n8n templates for conversational AI. This entire system runs efficiently within n8n, managing complexity via specialized n8n node configurations.

How it Works


  1. The journey begins with the Telegram - Incoming Message n8n trigger, which activates the n8n workflow upon receiving a new user message.

  2. The message is instantly logged using the Log - User Message n8n node into the chat_logs Data Table.

  3. The DB - Get Lead by User ID n8n node attempts to retrieve the existing lead record associated with the user's chat ID.

  4. The Check – Lead Record n8n node determines if a record exists. If not, the DB - Create Lead n8n node initializes a new lead record.

  5. The Build Assistant Context Code n8n node compiles the Telegram user data, the current lead status, and the user's message into a structured JSON object.

  6. This object is passed to the AI - Smart Support Assistant n8n node (an AI Agent). This agent, backed by the OpenRouter Chat Model and Simple Memory, reads the detailed system prompt.

  7. The AI determines if it needs to update the lead (using the DB - Update Lead tool) or answer a question (using DB - Get FAQ, DB - Get Services, or DB - Get Settings tools). The n8n agent ensures all required lead fields are collected.

  8. The final, conversational reply generated by the AI is logged by the Log - Bot Message n8n node.

  9. Finally, the Telegram - Send Response n8n node delivers the bot's answer back to the user via Telegram, completing the loop of this powerful n8n workflow.

Installation Guide


  1. Import the n8n template: Copy the provided JSON and import it into your n8n instance.

  2. Telegram Setup: Configure the Telegram - Incoming Message n8n trigger and Telegram - Send Response n8n node with your Telegram Bot API credentials.

  3. LLM Credentials: Update the OpenRouter Chat Model n8n node with your OpenRouter API key credentials.

  4. Data Table Configuration: This n8n workflow relies on several Data Tables (umrahchatlogs, umrahleads, umrahfaq, umrahservices, and umrahsettings). You must create these tables in your n8n instance, ensuring the column names match those referenced in the various n8n node settings (e.g., chatid, fullname, status). The Lead Management n8n node steps will fail if the table structures are not correctly replicated.

  5. Activate: Once credentials and Data Tables are configured, activate the n8n workflow. Ensure the webhook for the n8n trigger is correctly registered with Telegram.

Node Details

Telegram - Incoming Message (n8n trigger): The entry point of this n8n workflow. It listens for incoming user messages via Telegram webhook.
Data Table (Log - User Message / Log - Bot Message): Used to maintain a complete history of the conversation (user messages and bot replies) in the umrahchatlogs Data Table.
Data Table (DB - Get Lead by User ID / DB - Create Lead): Performs CRUD operations on the umrahleads table, crucial for dynamic customer identification and creation within this n8n workflow.
Code (Build Assistant Context): A core n8n node responsible for transforming raw data into a clean, context-rich JSON object consumed by the AI Agent.
OpenRouter Chat Model (n8n node): Provides the underlying large language model capabilities for the AI Agent, configured with low temperature (0.2) for reliable responses.
AI - Smart Support Assistant (n8n node): The conversational engine. This powerful n8n node processes the context, uses integrated data table tools (DB - Update Lead, DB - Get FAQ, etc.) to gather information or update records, and generates the final, polite response according to the detailed system prompt.
Data Table Tool (DB - Update Lead): An AI tool exposed to the Agent, allowing the model to write new lead data (like phone or email) back into the umrahleads table using the $fromAI expression, central to the lead management function of this n8n workflow.
Telegram - Send Response: The final action n8n node, sending the AI's generated output back to the user's chat ID.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Automation Engineer & Laravel Developer specialized in building AI-powered workflows and backend integrations. I design end-to-end automation systems combining n8n, custom APIs, and scalable Laravel backends. My focus is creating clean, modular, production-ready workflows for SaaS platforms, customer support systems, payment processing, and Telegram/WhatsApp bots. I bridge the gap between automation tools and custom backend development to deliver real business value.

Featured*