Rechercher des réponses factuelles sur le web et répondre aux questions avec Telegram, Tavily et GPT-5

Intermédiaire

Ceci est unPersonal Productivity, AI RAGworkflow d'automatisation du domainecontenant 15 nœuds.Utilise principalement des nœuds comme Telegram, AimlApi, TelegramTrigger, Tavily. Utiliser Telegram, Tavily et GPT-5 pour des recherches factuelles sur Internet afin de répondre aux questions

Prérequis
  • Token Bot Telegram
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "e95138f4feafe21ee6a9aac976bfd8e9187993130e7b713ed219f955c1b8837d",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "84253a28-e14b-462a-969c-f1e296f1eb40",
      "name": "Note adhésive — Aperçu",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -928
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 360,
        "content": "# 🔍 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–4 sentences), grounded in sources\n\n**Goal:** fast, factual answers without hallucinations."
      },
      "typeVersion": 1
    },
    {
      "id": "0aaea504-3ed8-48b3-aa38-61963de91735",
      "name": "Note adhésive — Invite LLM",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -736
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 240,
        "content": "## 🧠 LLM Prompt (Guardrails)\n* Extract only facts that answer the question\n* 3–4 sentences max\n* If data is thin → say so clearly\n* **No fabrication** — 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": "Note adhésive — Test",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -496
      ],
      "parameters": {
        "width": 384,
        "height": 192,
        "content": "## 🧪 Testing & Fallbacks\n* Test from Telegram (not only “Execute Node”)\n* Add `Switch` for commands and empty text\n* If no results → reply: “I couldn’t find enough reliable info.”\n* Catch errors: send friendly message, log details"
      },
      "typeVersion": 1
    },
    {
      "id": "4c772d35-25cc-4cf9-bfe8-58bf23d7c6eb",
      "name": "Note adhésive — Personnalisation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -576
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 232,
        "content": "## 🛠 Customization\n* `/help` → usage & examples\n* `/sources` → 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 → Wait → Redis/DB)\n* Optional: cache recent answers (key = normalized query)"
      },
      "typeVersion": 1
    },
    {
      "id": "9778f214-dabf-48db-9f70-6c62e8747fc6",
      "name": "Note adhésive — Réponse",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -192
      ],
      "parameters": {
        "color": 4,
        "height": 304,
        "content": "## 📤 Reply to Telegram\nReply to same chat, referencing original message."
      },
      "typeVersion": 1
    },
    {
      "id": "e948ce86-f169-47a8-99c8-582bcc5e7d1b",
      "name": "Note adhésive — LLM",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -192
      ],
      "parameters": {
        "color": 6,
        "height": 304,
        "content": "## 🧠 LLM Summarize\nInput: full search JSON.\nOutput: concise factual answer."
      },
      "typeVersion": 1
    },
    {
      "id": "a7430bc0-6057-4648-82ed-f90ccaf6fe76",
      "name": "Note adhésive — Recherche",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -192
      ],
      "parameters": {
        "color": 5,
        "height": 304,
        "content": "## 🔎 Web Search\nQuery = user message. Pass raw JSON downstream."
      },
      "typeVersion": 1
    },
    {
      "id": "3c805f46-b470-4016-afe6-89641b180a86",
      "name": "Note adhésive — Saisie",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -192
      ],
      "parameters": {
        "color": 2,
        "height": 304,
        "content": "## ⌨️ Typing Indicator\nSend \"typing\" to show progress."
      },
      "typeVersion": 1
    },
    {
      "id": "3cca7a73-c37a-4e59-a994-a24d81e98c83",
      "name": "Note adhésive — Réception",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -192
      ],
      "parameters": {
        "color": 4,
        "height": 304,
        "content": "## 📩 Receive Telegram Message\nHandle incoming text. Use chat.id + message_id for reply."
      },
      "typeVersion": 1
    },
    {
      "id": "0ccc7f9f-bc6d-4e44-881d-7b9e1af4f622",
      "name": "Envoyer un message texte",
      "type": "n8n-nodes-base.telegram",
      "position": [
        832,
        -48
      ],
      "webhookId": "01689fcb-171a-4338-bdc5-10447d604caa",
      "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": {
          "id": "wh7cybWjl2Zw0MEh",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eeb18791-a210-4614-9b65-7ec3c7edba37",
      "name": "Envoyer une action de chat",
      "type": "n8n-nodes-base.telegram",
      "position": [
        48,
        -48
      ],
      "webhookId": "bf4cf2c0-6013-4ebf-be08-3519823031c1",
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendChatAction"
      },
      "credentials": {
        "telegramApi": {
          "id": "wh7cybWjl2Zw0MEh",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "239a5aad-bd01-4895-9551-2606aaa9444a",
      "name": "Déclencheur Telegram",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -208,
        -48
      ],
      "webhookId": "5ff309b0-9d51-4953-b9ae-616e4c17322b",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "wh7cybWjl2Zw0MEh",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "abdc849f-ed58-40c8-a34b-2d547f5d9212",
      "name": "Recherche",
      "type": "@tavily/n8n-nodes-tavily.tavily",
      "position": [
        304,
        -48
      ],
      "parameters": {
        "query": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {}
      },
      "credentials": {
        "tavilyApi": {
          "id": "8wWN6c3Z8RZux0RW",
          "name": "Tavily account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "17336e52-7ab1-4087-9358-97e04f129d63",
      "name": "Complétion de chat IA/ML",
      "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’s question.  \n2. Provide a clear, concise answer in 3–4 sentences maximum.  \n3. If the information is limited, state that clearly.  \n4. Never make things up — 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": {
          "id": "QLCphbfkAMZbZesE",
          "name": "AI/ML account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eb8e941d-3b34-45b1-86da-f051b13a7f08",
      "name": "Note adhésive — Invite LLM1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -976
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 240,
        "content": "## ⚙️ Setup\n1. **Telegram**: create bot via @BotFather → add token in *Credentials → Telegram API*.\n2. **Tavily**: create API key → 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
    }
  ],
  "pinData": {},
  "connections": {
    "abdc849f-ed58-40c8-a34b-2d547f5d9212": {
      "main": [
        [
          {
            "node": "17336e52-7ab1-4087-9358-97e04f129d63",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "239a5aad-bd01-4895-9551-2606aaa9444a": {
      "main": [
        [
          {
            "node": "eeb18791-a210-4614-9b65-7ec3c7edba37",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eeb18791-a210-4614-9b65-7ec3c7edba37": {
      "main": [
        [
          {
            "node": "abdc849f-ed58-40c8-a34b-2d547f5d9212",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "17336e52-7ab1-4087-9358-97e04f129d63": {
      "main": [
        [
          {
            "node": "0ccc7f9f-bc6d-4e44-881d-7b9e1af4f622",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Productivité personnelle, RAG IA

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds15
Catégorie2
Types de nœuds5
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34