AutomationFlowsAI & RAG › Deep Research Assistant with Perplexity AI and Telegram Citations

Deep Research Assistant with Perplexity AI and Telegram Citations

ByBizThrive.ai @davids on n8n.io

Turn your Telegram bot into a real-time research assistant with this intelligent n8n workflow. Designed for founders, analysts, and knowledge workers, this automation uses Perplexity Sonar and Sonar Pro to deliver concise, citation-rich answers to complex queries — directly…

Event trigger★★★★☆ complexityAI-powered16 nodesAgentOpenAI ChatMemory Buffer WindowPerplexity ToolTelegram TriggerTelegram
AI & RAG Trigger: Event Nodes: 16 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #7939 — we link there as the canonical source.

This workflow follows the Agent → OpenAI Chat recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "c75d8927-6322-4d3e-a2a0-21e719ffc63e",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -384,
        -224
      ],
      "parameters": {
        "text": "={{ $json.chatInput }} {{ $json.message.text }}",
        "options": {
          "systemMessage": "=You are a research-focused AI assistant that combines real-time web intelligence from Perplexity  to generate insightful, concise, and well-cited answers to my queries.\n\n\ud83d\udd27 Tool Usage Logic\n\nUse the Perplexity Sonar tool for:\n\t\u2022\tQuick lookups and factual summaries\n\t\u2022\tDefinitions, current events, book/show/movie synopses\n\t\u2022\tExplainers for theories, concepts, and popular discussions\n\t\u2022\tPodcast and video summaries\n\t\u2022\tTrend monitoring and fast comparisons\n\nUse the Perplexity Sonar Pro tool for:\n\t\u2022\tQuestions requiring synthesis of multiple sources or expert reasoning\n\t\u2022\tBusiness research (competitor analysis, investor briefs, product comparisons)\n\t\u2022\tScientific or academic deep-dives\n\t\u2022\tStructured summarization (transcripts, feedback, legal docs, surveys)\n\t\u2022\tMarket trend analysis, job monitoring, and sentiment clustering\n\t\u2022\tLong-form content aggregation across industries, geographies, or verticals\n\n\ud83e\udde0 Output Guidelines\n\t\u2022\tFocus only on answering the user\u2019s question. Do not offer extra services unless explicitly requested.\n\t\u2022\tDeliver answers in clear, structured formats\n\t\u2022\tInclude citations with clickable URLs from the original sources used by Perplexity. \n\t\u2022\tIf the query contains ambiguity, politely ask for clarification instead of guessing.\n\n\ud83d\udccc Style & Tone\n\t\u2022\tMaintain a professional, neutral tone.\n\t\u2022\tUse plain language for general audiences unless the context requires technical specificity.\n\t\u2022\tPrioritize depth, clarity, and relevance over length.\n\t\u2022\tAvoid filler language and generic intros\u2014get straight to the value.\n\nIf I ask about a person, use Sonar Pro and in addition to all details, get links to their social profiles: Instagram, LinkedIn, and whichever others you can find."
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "0df084d7-379c-4a44-96c6-9faf75168485",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -720,
        64
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "00b2cd49-ab28-4148-9b5a-f11345b90e65",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -416,
        48
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b7b7feb3-0eaf-4607-86cd-46ec16f57258",
      "name": "Perplexity Sonar",
      "type": "n8n-nodes-base.perplexityTool",
      "position": [
        -80,
        48
      ],
      "parameters": {
        "model": "sonar",
        "options": {},
        "messages": {
          "message": [
            {}
          ]
        },
        "requestOptions": {}
      },
      "credentials": {
        "perplexityApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b88c3c4c-fc80-4f4e-baf5-2a92cafd49cb",
      "name": "Perplexity Sonar Pro",
      "type": "n8n-nodes-base.perplexityTool",
      "position": [
        128,
        48
      ],
      "parameters": {
        "model": "sonar-pro",
        "options": {},
        "messages": {
          "message": [
            {}
          ]
        },
        "requestOptions": {}
      },
      "credentials": {
        "perplexityApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7cb5983f-c2a1-4401-9fd2-ec045c718247",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -992,
        -224
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "bb263737-5be3-4807-9da3-db4e31fc1cf8",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -16,
        -224
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "f8da851b-40f5-4bad-a6d2-fa0488c59112",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        -672,
        -224
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "be4dd9dc-55f3-4668-a5e8-0205c230fb75",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.from.id }}",
              "rightValue": 5675741296
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e298f904-ec98-4cc7-b599-66b044a280a2",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -416
      ],
      "parameters": {
        "color": 4,
        "width": 350,
        "height": 356,
        "content": "\ud83d\udccb WORKFLOW OVERVIEW\n\n\ud83d\udd04 FLOW:\nTelegram \u2192 Filter \u2192 AI Agent \u2192 Response\n\n\ud83d\udd27 REQUIRED SETUP:\n1. Telegram Bot Token\n2. OpenAI API Key\n3. Perplexity API Key\n4. Update user ID in filter\n\n\u26a0\ufe0f SECURITY:\n- Keep API keys secure\n- User filter prevents unauthorized access\n- Test with your user ID first"
      },
      "typeVersion": 1
    },
    {
      "id": "038365a8-bb63-4534-8dc9-6acef4f33682",
      "name": "Telegram Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -464
      ],
      "parameters": {
        "width": 300,
        "height": 406,
        "content": "\ud83d\udcf1 TELEGRAM TRIGGER SETUP\n\n1. Create a Telegram bot via @BotFather\n2. Get your bot token\n3. Add Telegram credentials in n8n\n4. Set webhook URL in bot settings\n\n\u26a0\ufe0f IMPORTANT: Update the webhook ID if importing this workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "e5778cb2-410b-42f8-9516-5b75e70a0dab",
      "name": "Security Filter",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -544
      ],
      "parameters": {
        "color": 2,
        "width": 280,
        "height": 460,
        "content": "\ud83d\udd12 USER FILTER\n\n\u26a0\ufe0f CHANGE REQUIRED:\nUpdate the user ID (5675741296) to your Telegram user ID\n\nTo find your ID:\n1. Message @userinfobot on Telegram\n2. Replace the number in the filter condition\n\nThis prevents unauthorized access to your bot"
      },
      "typeVersion": 1
    },
    {
      "id": "1aa1f2e7-69ab-467d-9445-5c822e250d17",
      "name": "AI Agent Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -624
      ],
      "parameters": {
        "color": 6,
        "width": 320,
        "height": 528,
        "content": "\ud83e\udd16 AI AGENT CORE\n\n\u2699\ufe0f CUSTOMIZATION OPTIONS:\n\n1. SYSTEM MESSAGE:\n   - Modify research focus\n   - Change response style\n   - Adjust tool usage logic\n\n2. PROMPT HANDLING:\n   - Currently uses chat input + message text\n   - Can modify input processing\n\n3. BEHAVIOR:\n   - Update guidelines for different use cases\n   - Modify citation requirements"
      },
      "typeVersion": 1
    },
    {
      "id": "261f40c0-6f40-492a-a455-f032331d0e4e",
      "name": "Telegram Response",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -528
      ],
      "parameters": {
        "width": 280,
        "height": 444,
        "content": "\ud83d\udce4 TELEGRAM RESPONSE\n\nSends AI response back to user\n\n\u2699\ufe0f CUSTOMIZATION:\n- Add message formatting\n- Include parse_mode for HTML/Markdown\n- Add reply_to_message_id for threading\n- Modify response structure\n\n\ud83d\udca1 Uses same Telegram credentials as trigger"
      },
      "typeVersion": 1
    },
    {
      "id": "11bbb9dc-ebf2-4ec1-9a9d-00e366c21d30",
      "name": "OpenAI Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        16
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 470,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\ud83e\udd16 OPENAI SETUP\n\n1. Get API key from OpenAI platform\n2. Add OpenAI credentials in n8n\n3. Select your preferred model\n\n\ud83d\udca1 TIP: gpt-4o-mini is cost-effective\n\n\u2699\ufe0f CUSTOMIZATION:\n- Change model based on your needs\n- Adjust temperature in options if needed"
      },
      "typeVersion": 1
    },
    {
      "id": "5ee33d92-73d4-410d-bbfd-046633442917",
      "name": "Memory Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        16
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 466,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\ud83e\udde0 MEMORY CONFIGURATION\n\nCurrently uses chat ID for session management\n\n\u2699\ufe0f CUSTOMIZATION OPTIONS:\n- Change session key logic\n- Adjust window size for memory\n- Modify memory type if needed\n\nThis maintains conversation context per chat"
      },
      "typeVersion": 1
    },
    {
      "id": "fcf87cde-7a38-4683-9b1a-976103daf0c9",
      "name": "Perplexity Pro",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        16
      ],
      "parameters": {
        "color": 3,
        "width": 636,
        "height": 998,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ud83d\udd0d PERPLEXITY SONAR\n\n1. Get API key from Perplexity\n2. Add HTTP Header Auth credentials\n3. Set Authorization: Bearer YOUR_TOKEN_HERE\n\n\u2699\ufe0f CUSTOMIZATION:\n- Adjust max_tokens (currently 200)\n- Modify model if Perplexity updates\n- Change tool description for different use cases\n\nPerplexity Sonar (\"Sonar\" model):\n\n- Designed for quick lookups and factual summaries\n- Best for definitions, current events, book/show/movie synopses\n- Handles explainers for theories, concepts, and popular discussions\n- Good for podcast and video summaries\n- Efficient for trend monitoring and fast comparisons\n\n\n\nPerplexity Sonar Pro (\"Sonar Pro\" model):\n\n- Built for questions requiring synthesis of multiple sources or expert reasoning\n- Excels at business research (competitor analysis, investor briefs, product comparisons)\n- Handles scientific or academic deep-dives\n- Perfect for structured summarization (transcripts, feedback, legal docs, surveys)\n- Specialized in market trend analysis, job monitoring, and sentiment clustering\n- Manages long-form content aggregation across industries, geographies, or verticals\n\n\n\nThe AI Agent's system message specifically instructs it to choose the appropriate tool based on the complexity and type of research needed. This creates an intelligent routing system where simpler queries use the faster, more cost-effective Sonar model, while complex research tasks leverage the more powerful Sonar Pro model.\n\nYou can adjust the AI's prmopt to just use 1 or the other and disable or delete the unused node."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Filter": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity Sonar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity Sonar Pro": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Turn your Telegram bot into a real-time research assistant with this intelligent n8n workflow. Designed for founders, analysts, and knowledge workers, this automation uses Perplexity Sonar and Sonar Pro to deliver concise, citation-rich answers to complex queries — directly…

Source: https://n8n.io/workflows/7939/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.

Agent, Telegram Trigger, Telegram +10
AI & RAG

Digital marketers, content creators, social media managers, and businesses who want to use AI marketing automation for YouTube Shorts without spending hours on production. This AI workflow helps anyon

OpenAI, HTTP Request, OpenAI Chat +7
AI & RAG

Jarvis is a powerful multi-agent productivity assistant built in n8n. It works directly from Telegram and can understand both text messages and voice notes.

Telegram Trigger, Telegram, OpenAI +10
AI & RAG

Unlock the Power of Language with Personalized AI Learning! MOTION TUTOR is a revolutionary AI-powered language learning platform that adapts to your progress and guides you from basic vocabulary to c

Agent, Airtable Tool, OpenAI Chat +6
AI & RAG

Automate your personal productivity with this intelligent n8n workflow that integrates Telegram, Google Sheets, and OpenAI (GPT-4o). This system uses multiple AI agents to manage work hours, tasks, fi

Agent, OpenAI Chat, Telegram +9