Answer Questions with Factual Web Search using Telegram, Tavily and GPT-5

Go to Workflow
0 views
Built by AI/ML API | D1m7asis AI/ML API | D1m7asis
Created on June 07, 2026

Description

🧠 Telegram Search Assistant β€” Tavily + AI/ML API

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.

πŸš€ Features
πŸ“© Telegram-based input
⌨️ Typing indicator for better UX
πŸ”Ž Web search with Tavily (JSON results)
🧠 Summarization with AIMLAPI (openai/gpt-5-chat-latest)
πŸ“€ Replies in the same chat/thread
βœ… Guardrails against hallucinations

πŸ›  Setup Guide

1. πŸ“² Create Telegram Bot
Talk to @BotFather
Use /newbot β†’ choose a name and username
Save the bot token

2. πŸ” Set Up Credentials in n8n
Telegram API**: use your bot token
Tavily**: add your Tavily API key
AI/ML API**: add your API key
Base URL: https://api.aimlapi.com/v1

3. πŸ”§ Configure the Workflow
Open the n8n editor and import the JSON
Update credentials for Telegram, Tavily, and AIMLAPI

βš™οΈ Flow Summary

| Node | Function |
|--------------------------|-----------------------------------------------|
| πŸ“© Receive Telegram Msg | Triggered when user sends text |
| ⌨️ Typing Indicator | Shows β€œtyping…” to user |
| πŸ”Ž Web Search | Queries Tavily with user’s message |
| 🧠 LLM Summarize | Summarizes search JSON into a factual answer |
| πŸ“€ Reply to Telegram | Sends concise answer back to same thread |

πŸ“ Data Handling
By default: no data stored
Optional: log queries & answers to Google Sheets or a database

πŸ’‘ Example Prompt Flow

User sends:

When is the next solar eclipse in Europe?


Bot replies:
The next solar eclipse in Europe will occur on August 12, 2026.
It will be visible as a total eclipse across Spain, with partial views in much of Europe.
The maximum eclipse will occur around 17:46 UTC.

πŸ”„ Customization
Add commands: /help, /sources, /news
Apply rate-limits per user
Extend logging to Google Sheets / DB
Add NSFW / profanity filters before search

πŸ§ͺ Testing
Test end-to-end in Telegram (not just β€œExecute Node”)
Add a fallback reply if Tavily returns empty results
Use sticky notes for debugging & best practices

πŸ“Ž Resources
πŸ”— AI/ML API Docs
πŸ”— Tavily Search API

Nodes Used (1)

Telegram
n8n-nodes-base.telegram