Telegram AI Agent with GraphRAG Knowledge Experts - n8n Workflow

Deploy a powerful Telegram AI chatbot agent using n8n and InfraNodus GraphRAG knowledge bases. This advanced n8n workflow utilizes multiple specialized AI experts for contextual retrieval.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Users looking for advanced AI agent implementation strategies within n8n.
Developers needing robust, specialized knowledge retrieval systems (GraphRAG).
Content creators and authors who want to turn their body of work (books, articles) into an interactive AI expert.
Businesses seeking to build highly contextual support or product assistants using n8n templates.

Overview

This sophisticated n8n workflow provides a comprehensive solution for deploying an intelligent AI chatbot directly integrated with Telegram. The unique value of this n8n template lies in its use of specialized "experts"—InfraNodus GraphRAG knowledge bases accessed via HTTP Request n8n node tools. Instead of relying on a single, broad knowledge base, the AI Agent, powered by the OpenAI node (gpt-4o), can intelligently select which specialized expert (book or knowledge graph) is most relevant to the user's query. This system ensures high-quality, augmented responses, making this n8n workflow ideal for complex domain-specific consultation or Q&A based on proprietary data. Deploying this n8n workflow allows for scalable, highly accurate conversational AI.

How it Works

This n8n workflow is initiated by a user message in Telegram, triggering a sequence of AI agent operations and specialized knowledge retrieval:


  1. Activation (n8n trigger): The process starts immediately upon receiving a message via the Receive a Message on Telegram n8n trigger node.

  2. User Feedback: The n8n workflow uses the Send "Typing..." message to User Telegram node to instantly send a 'Typing...' chat action back to the user, providing immediate feedback that the query is being processed.

  3. Agent Orchestration: The core AI Agent n8n node receives the user's message. It uses the OpenAI Model (specifically gpt-4o) for its language capabilities and leverages the connected Simple Memory n8n node to maintain conversational context (essential for multi-turn conversations).

  4. Expert Consultation: Based on the input prompt and the descriptive documentation provided by the specialized httpRequestTool n8n node configurations, the AI Agent intelligently decides which InfraNodus knowledge base is most appropriate. These RAG tools access specialized graphs, ensuring domain-specific expertise.

  5. Response Synthesis: The Agent receives the high-quality, contextual information from the selected expert(s). The Agent's system prompt instructs it to combine perspectives and synthesize a final, augmented response.

  6. Delivery: Finally, the Send Telegram Message to User Telegram n8n node sends the synthesized output from the Agent back to the user's Telegram chat. This entire n8n workflow executes seamlessly upon every incoming message.

Installation Guide

To successfully deploy this advanced n8n workflow, you must set up credentials for both Telegram and InfraNodus/OpenAI.

1. Import the n8n Workflow

Import the provided n8n workflow JSON into your n8n instance.

2. Configure Telegram Credentials

Create a new Telegram bot by messaging /newbot to @BotFather in Telegram.
You will receive an API token. Use this token to set up a new Telegram API credential in n8n.
Apply this credential to the Receive a Message on Telegram n8n trigger node and both Telegram action nodes (Send "Typing..." message to User and Send Telegram Message to User).

3. Configure AI Service Credentials

OpenAI: Set up an OpenAI API Key credential and link it to the OpenAI Model n8n node.
InfraNodus: Obtain an InfraNodus API key (available at InfraNodus.Com). This key is used for the specialized RAG tools. Set up an HTTP Bearer Auth credential in n8n using this key.
Apply the InfraNodus credential to all four specialized httpRequestTool n8n node experts.

4. Activate the Workflow

Once all credentials and webhook connections are properly established, activate the n8n workflow.

Node Details

This n8n workflow relies on several specialized nodes to achieve its sophisticated agent behavior:

Receive a Message on Telegram (n8n trigger): The starting point of the n8n workflow. It is configured as a webhook n8n trigger, listening for new messages in the connected Telegram bot.
Send "Typing..." message to User (Telegram n8n node): Immediately sends the sendChatAction operation to the Telegram chat ID, improving user experience by signaling processing is underway.
AI Agent (Langchain Agent n8n node): The core intelligence of this n8n workflow. It uses the user's message as input and orchestrates tool use. Key configuration includes a descriptive system prompt guiding the agent's behavior and requiring tool usage (Always access at least one of the tools).
OpenAI Model (Langchain LM ChatOpenAi n8n node): Provides the underlying large language model capabilities, configured to use gpt-4o for high performance and complex reasoning.
Simple Memory (Langchain Memory Buffer Window n8n node): This n8n node manages chat context, storing recent messages using the user's Telegram chat.id as the session key, enabling the agent to maintain continuous conversation.
InfraNodus Expert Nodes (4x HTTP Request Tool n8n node): These nodes are crucial RAG tools. Each is configured to hit the InfraNodus graphAndAdvice API endpoint, specifying a unique knowledge graph (body.name) and containing a detailed toolDescription so the AI Agent knows when to call them. Examples include the Special Agent's Manual Book Expert and The Polysingularity Letters Book experts.

Related n8n Workflows

Free

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

I'm Dmitry, the founder of InfraNodus — an AI text network analysis tool. I'm passionate about networks and data visualization and its ability to reveal what everyone else is missing and to highlight different perspectives. I'm sharing the n8n templates that make use of this unique capability of InfraNodus for multiple scenarios.

Featured*