AutomationFlowsSlack & Telegram › Answer Questions with Factual Web Search Using Telegram, Tavily and Gpt-5

Answer Questions with Factual Web Search Using Telegram, Tavily and Gpt-5

ByAI/ML API | D1m7asis @d1m7asis on n8n.io

This n8n workflow lets users ask questions in Telegram and receive concise, fact-based answers. It performs a web search with Tavily, then uses AIMLAPI (GPT-5) to summarize results into a clear 3–4 sentence reply. The flow ensures grounded, non-hallucinated answers. 📩…

Event trigger★★★★☆ complexity15 nodesTelegramTelegram Trigger@Tavily/N8N Nodes TavilyN8N Nodes Aimlapi
Slack & Telegram Trigger: Event Nodes: 15 Complexity: ★★★★☆ Added:

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

This workflow follows the Telegram → Telegram Trigger 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": "84253a28-e14b-462a-969c-f1e296f1eb40",
      "name": "Sticky Note \u2014 Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -928
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 360,
        "content": "# \ud83d\udd0d Telegram Search Assistant\n\nMinimal bot that:\n1) Receives a question in Telegram\n2) Searches the web (Tavily)\n3) Summarizes facts with AIMLAPI (`openai/gpt-5-chat-latest`)\n4) Replies concisely (3\u20134 sentences), grounded in sources\n\n**Goal:** fast, factual answers without hallucinations."
      },
      "typeVersion": 1
    },
    {
      "id": "0aaea504-3ed8-48b3-aa38-61963de91735",
      "name": "Sticky Note \u2014 LLM Prompt",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -736
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 240,
        "content": "## \ud83e\udde0 LLM Prompt (Guardrails)\n* Extract only facts that answer the question\n* 3\u20134 sentences max\n* If data is thin \u2192 say so clearly\n* **No fabrication** \u2014 use provided results only\n\n**Inputs:**\n- `query = user message`\n- `results = full Tavily JSON`"
      },
      "typeVersion": 1
    },
    {
      "id": "0b337423-00e8-4236-b8ef-293641dd387a",
      "name": "Sticky Note \u2014 Testing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -496
      ],
      "parameters": {
        "width": 384,
        "height": 192,
        "content": "## \ud83e\uddea Testing & Fallbacks\n* Test from Telegram (not only \u201cExecute Node\u201d)\n* Add `Switch` for commands and empty text\n* If no results \u2192 reply: \u201cI couldn\u2019t find enough reliable info.\u201d\n* Catch errors: send friendly message, log details"
      },
      "typeVersion": 1
    },
    {
      "id": "4c772d35-25cc-4cf9-bfe8-58bf23d7c6eb",
      "name": "Sticky Note \u2014 Customization",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -576
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 232,
        "content": "## \ud83d\udee0 Customization\n* `/help` \u2192 usage & examples\n* `/sources` \u2192 list top URLs from results\n* `/news` or `/wiki` routing via keywords\n* Add NSFW/profanity filter pre-search\n* Rate-limit per user (Set \u2192 Wait \u2192 Redis/DB)\n* Optional: cache recent answers (key = normalized query)"
      },
      "typeVersion": 1
    },
    {
      "id": "9778f214-dabf-48db-9f70-6c62e8747fc6",
      "name": "Sticky Note \u2014 Reply",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -192
      ],
      "parameters": {
        "color": 4,
        "height": 304,
        "content": "## \ud83d\udce4 Reply to Telegram\nReply to same chat, referencing original message."
      },
      "typeVersion": 1
    },
    {
      "id": "e948ce86-f169-47a8-99c8-582bcc5e7d1b",
      "name": "Sticky Note \u2014 LLM",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -192
      ],
      "parameters": {
        "color": 6,
        "height": 304,
        "content": "## \ud83e\udde0 LLM Summarize\nInput: full search JSON.\nOutput: concise factual answer."
      },
      "typeVersion": 1
    },
    {
      "id": "a7430bc0-6057-4648-82ed-f90ccaf6fe76",
      "name": "Sticky Note \u2014 Search",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -192
      ],
      "parameters": {
        "color": 5,
        "height": 304,
        "content": "## \ud83d\udd0e Web Search\nQuery = user message. Pass raw JSON downstream."
      },
      "typeVersion": 1
    },
    {
      "id": "3c805f46-b470-4016-afe6-89641b180a86",
      "name": "Sticky Note \u2014 Typing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -192
      ],
      "parameters": {
        "color": 2,
        "height": 304,
        "content": "## \u2328\ufe0f Typing Indicator\nSend \"typing\" to show progress."
      },
      "typeVersion": 1
    },
    {
      "id": "3cca7a73-c37a-4e59-a994-a24d81e98c83",
      "name": "Sticky Note \u2014 Receive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -192
      ],
      "parameters": {
        "color": 4,
        "height": 304,
        "content": "## \ud83d\udce9 Receive Telegram Message\nHandle incoming text. Use chat.id + message_id for reply."
      },
      "typeVersion": 1
    },
    {
      "id": "0ccc7f9f-bc6d-4e44-881d-7b9e1af4f622",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        832,
        -48
      ],
      "parameters": {
        "text": "={{ $json.content }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $('Telegram Trigger').item.json.message.message_id }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eeb18791-a210-4614-9b65-7ec3c7edba37",
      "name": "Send a chat action",
      "type": "n8n-nodes-base.telegram",
      "position": [
        48,
        -48
      ],
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendChatAction"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "239a5aad-bd01-4895-9551-2606aaa9444a",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -208,
        -48
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "abdc849f-ed58-40c8-a34b-2d547f5d9212",
      "name": "Search",
      "type": "@tavily/n8n-nodes-tavily.tavily",
      "position": [
        304,
        -48
      ],
      "parameters": {
        "query": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {}
      },
      "credentials": {
        "tavilyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "17336e52-7ab1-4087-9358-97e04f129d63",
      "name": "AI/ML Chat Completion",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        560,
        -48
      ],
      "parameters": {
        "model": "openai/gpt-5-chat-latest",
        "prompt": "=You are an AI assistant.  \nYou have search results from Google in JSON or text format.  \nYour task is to:  \n1. Extract only the facts that directly answer the user\u2019s question.  \n2. Provide a clear, concise answer in 3\u20134 sentences maximum.  \n3. If the information is limited, state that clearly.  \n4. Never make things up \u2014 base your answer only on the provided results.  \n\nUser question: \"{{ $json.query }}\"  \nSearch results:  \n{{ JSON.stringify($json.results) }}\n\nGenerate the final answer in plain, simple English.\n",
        "options": {
          "responseFormat": "text"
        },
        "requestOptions": {}
      },
      "credentials": {
        "aimlApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eb8e941d-3b34-45b1-86da-f051b13a7f08",
      "name": "Sticky Note \u2014 LLM Prompt1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -976
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 240,
        "content": "## \u2699\ufe0f Setup\n1. **Telegram**: create bot via @BotFather \u2192 add token in *Credentials \u2192 Telegram API*.\n2. **Tavily**: create API key \u2192 add *Tavily account* credentials.\n3. **AIMLAPI**: add *AI/ML API* credentials (base URL `https://api.aimlapi.com/v1`).\n4. **Environment**: set `TELEGRAM_BOT_TOKEN`, `TAVILY_API_KEY`, `AIML_API_KEY` in n8n (if using env)."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Search": {
      "main": [
        [
          {
            "node": "AI/ML Chat Completion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Send a chat action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a chat action": {
      "main": [
        [
          {
            "node": "Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI/ML Chat Completion": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "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

This n8n workflow lets users ask questions in Telegram and receive concise, fact-based answers. It performs a web search with Tavily, then uses AIMLAPI (GPT-5) to summarize results into a clear 3–4 sentence reply. The flow ensures grounded, non-hallucinated answers. 📩…

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

More Slack & Telegram workflows → · Browse all categories →

Related workflows

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

Slack & Telegram

This n8n workflow allows users to generate AI-generated images by sending messages to a Telegram bot. Each request is logged in Google Sheets and limited by a daily quota per user. Image prompts are e

Telegram Trigger, Google Sheets, Telegram +2
Slack & Telegram

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Telegram Trigger, N8N Nodes Aimlapi, HTTP Request +1
Slack & Telegram

TextMain. Uses telegramTrigger, stopAndError, telegram, httpRequest. Event-driven trigger; 56 nodes.

Telegram Trigger, Stop And Error, Telegram +2
Slack & Telegram

Pede Ai. Uses httpRequest, telegram, postgres, telegramTrigger. Event-driven trigger; 53 nodes.

HTTP Request, Telegram, Postgres +1
Slack & Telegram

📄 Documentation: Notion Guide

Telegram Trigger, @Blotato/N8N Nodes Blotato, Telegram +1