{
  "name": "Answer questions with factual web search using Telegram, Tavily and GPT-5",
  "nodes": [
    {
      "id": "84253a28-e14b-462a-969c-f1e296f1eb40",
      "name": "Sticky Note — Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -928
      ],
      "parameters": {
        "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"
      }
    },
    {
      "id": "0aaea504-3ed8-48b3-aa38-61963de91735",
      "name": "Sticky Note — LLM Prompt",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -736
      ],
      "parameters": {
        "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"
      }
    },
    {
      "id": "0b337423-00e8-4236-b8ef-293641dd387a",
      "name": "Sticky Note — Testing",
      "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"
      }
    },
    {
      "id": "4c772d35-25cc-4cf9-bfe8-58bf23d7c6eb",
      "name": "Sticky Note — Customization",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -576
      ],
      "parameters": {
        "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 → "
      }
    },
    {
      "id": "9778f214-dabf-48db-9f70-6c62e8747fc6",
      "name": "Sticky Note — Reply",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -192
      ],
      "parameters": {
        "width": null,
        "height": 304,
        "content": "## 📤 Reply to Telegram\nReply to same chat, referencing original message."
      }
    },
    {
      "id": "e948ce86-f169-47a8-99c8-582bcc5e7d1b",
      "name": "Sticky Note — LLM",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -192
      ],
      "parameters": {
        "width": null,
        "height": 304,
        "content": "## 🧠 LLM Summarize\nInput: full search JSON.\nOutput: concise factual answer."
      }
    },
    {
      "id": "a7430bc0-6057-4648-82ed-f90ccaf6fe76",
      "name": "Sticky Note — Search",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -192
      ],
      "parameters": {
        "width": null,
        "height": 304,
        "content": "## 🔎 Web Search\nQuery = user message. Pass raw JSON downstream."
      }
    },
    {
      "id": "3c805f46-b470-4016-afe6-89641b180a86",
      "name": "Sticky Note — Typing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -192
      ],
      "parameters": {
        "width": null,
        "height": 304,
        "content": "## ⌨️ Typing Indicator\nSend \"typing\" to show progress."
      }
    },
    {
      "id": "3cca7a73-c37a-4e59-a994-a24d81e98c83",
      "name": "Sticky Note — Receive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -192
      ],
      "parameters": {
        "width": null,
        "height": 304,
        "content": "## 📩 Receive Telegram Message\nHandle incoming text. Use chat.id + message_id for reply."
      }
    },
    {
      "id": "0ccc7f9f-bc6d-4e44-881d-7b9e1af4f622",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        832,
        -48
      ]
    },
    {
      "id": "eeb18791-a210-4614-9b65-7ec3c7edba37",
      "name": "Send a chat action",
      "type": "n8n-nodes-base.telegram",
      "position": [
        48,
        -48
      ]
    },
    {
      "id": "239a5aad-bd01-4895-9551-2606aaa9444a",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -208,
        -48
      ]
    },
    {
      "id": "abdc849f-ed58-40c8-a34b-2d547f5d9212",
      "name": "Search",
      "type": "@tavily/n8n-nodes-tavily.tavily",
      "position": [
        304,
        -48
      ]
    },
    {
      "id": "17336e52-7ab1-4087-9358-97e04f129d63",
      "name": "AI/ML Chat Completion",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        560,
        -48
      ]
    },
    {
      "id": "eb8e941d-3b34-45b1-86da-f051b13a7f08",
      "name": "Sticky Note — LLM Prompt1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -976
      ],
      "parameters": {
        "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* cr"
      }
    }
  ],
  "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
          }
        ]
      ]
    }
  }
}