Deep Research Assistant via Perplexity and Telegram - n8n Workflow

Automate deep, cited web research directly from Telegram using this powerful n8n workflow. It leverages an n8n AI agent with Perplexity Sonar and Sonar Pro for accurate, real-time results.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical researchers and academic professionals who require instant, cited facts.

  • Business analysts needing fast market data and synthesized expert reasoning.

  • Individuals seeking secure, high-quality automated information retrieval.

  • Users looking for advanced examples of ai_agents and tools integration within n8n.

Overview

This sophisticated n8n workflow provides a secure, private research bot accessible instantly via Telegram. It solves the problem of needing quick, highly cited, and structured information by intelligently routing user queries to the most appropriate Perplexity AI tool (Sonar for quick facts, Sonar Pro for deep, synthesized research) based on the context provided in the AI Agent's system prompt. By using this specific set of n8n templates, users gain a streamlined and efficient automated research pipeline. The inclusion of an initial Filter n8n node is crucial for security, ensuring that only an authorized, pre-defined user can activate this resource-intensive n8n workflow, protecting the system from unauthorized usage and API abuse. This robust n8n automation maximizes research efficiency and output quality.

How it Works

The entire process begins with the Telegram Trigger n8n node, which activates the flow whenever a new chat message is received. Immediately, the request is passed to a Filter n8n node. This critical security step verifies the sender's Telegram User ID against a pre-configured ID, ensuring only the intended user can proceed. Once approved, the message content flows into the core component: the AI Agent n8n node. This agent acts as the decision engine. It uses the configured OpenAI Chat Model (gpt-4o-mini) for complex reasoning and maintains conversational history through the Window Buffer Memory n8n node, using the chat ID as the session key. The agent intelligently selects between the two available Perplexity tools, Sonar (for quick facts) and Sonar Pro (for complex synthesis), based on the query. After retrieving and synthesizing the deep research, including clickable source citations as specified in the system message, the AI Agent produces the final output. This high-quality response is then automatically sent back to the user via the final Telegram n8n node, completing this powerful n8n workflow.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'Import Workflow' function.

  2. Telegram Setup: Set up a new bot using BotFather on Telegram. Configure the Telegram Trigger n8n node with your bot token and set up the webhook URL.

  3. OpenAI Setup: Create a new OpenAI credential and link it to the OpenAI Chat Model n8n node.

  4. Perplexity Setup: Obtain a Perplexity API key and set up the corresponding credentials for both the Perplexity Sonar and Perplexity Sonar Pro n8n node instances.

  5. Security Configuration (Crucial): Go to the Filter n8n node and update the static user ID value (5675741296 in the provided n8n templates) to your personal Telegram User ID. Failure to update this ID will prevent the n8n workflow from running for you.

  6. Activate: Ensure the n8n workflow is active to receive messages from the Telegram Trigger.

Node Details

Telegram Trigger (n8n trigger): The starting point for this n8n automation. It listens for incoming chat messages to initiate the research process.
Filter (n8n node): A security gate that checks if the incoming message sender ID matches the defined user ID. This ensures the n8n workflow is private and secure.
AI Agent (n8n node): The core intelligence of the flow. It orchestrates the language model and the research tools based on its detailed system message configuration. It determines whether a query needs the standard Perplexity Sonar or the specialized Sonar Pro tool.
OpenAI Chat Model (n8n node): Provides the reasoning and language understanding capabilities for the AI Agent, currently configured to use gpt-4o-mini for efficient processing within this n8n workflow.
Window Buffer Memory (n8n node): Maintains context for ongoing conversations by using the Telegram chat ID as a session key, allowing the n8n workflow to remember previous turns.
Perplexity Sonar & Perplexity Sonar Pro (n8n nodes): These nodes provide real-time, highly cited web research capabilities. The AI Agent dynamically chooses between the two based on the complexity of the research required.


  • Telegram (n8n node): Sends the final, cited research result, generated by the AI Agent, back to the user's Telegram chat.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by
David
David

Featured*