πŸ’¬ Build a Telegram Q&A bot with Linkup web search, GPT-4.1 & Mistral voice

⚑ 277 views Β· πŸ’¬ Support Chatbots

Description

Create a Telegram bot that answers questions using AI-powered web search from Linkup and an LLM agent (GPT-4.1).

This template handles both text and voice messages (voice transcribed via a Mistral model by default), routes queries through an agent that can call a Linkup tool to fetch up-to-date information from the web, and returns concise, Telegram-friendly replies. A security switch lets you restrict use to a single Telegram username for private testing, or remove the filter to make the bot public.

Who is this for?

What it does / What problem does this solve?

How it works

  1. Trigger: Telegram Trigger receives incoming messages (text or voice).
  2. Route: Message Router detects voice vs text. Voice files are fetched with Get Audio File.
  3. Transcribe: Mistral transcribe receives the audio file and returns a transcript; the transcript or text is normalized into preset_user_message and consolidated in Consolidate user message.
  4. Agent: AI Agent (GPT-4.1-mini configured) runs with a system prompt that instructs it to call the Web search tool when up-to-date knowledge is required.
  5. Respond: The agent output is sent back to the user via Telegram answer.

How to set up

  1. Create a Linkup account: Sign up at https://linkup.so to get your API key. They offer a free tier with monthly credits.
  2. Add credentials in n8n: Configure Telegram API, OpenAI (or your LLM provider), and Mistral Cloud credentials in n8n.
  3. Configure Linkup tool: In the Web search node, find the β€œHeaders” section. In the Authorization header, replace Bearer <your-linkup-api-key> with your actual Linkup API Key.
  4. Set Telegram privacy (optional): Edit the Myself? If node and replace <Replace with your Telegram username> with your username to restrict access. Remove the node to allow public use.
  5. Adjust transcription (optional): Swap the Mistral transcribe HTTP node for another provider (OpenAI, Whisper, etc.).
  6. Connect LLM: In OpenAI Chat Model node, add your OpenAI API key (or configure another LLM node) and ensure the AI Agent node references this model.
  7. Activate workflow: Activate the workflow and test by messaging your bot in Telegram.

Requirements

How to take it further

πŸ”— Nodes Used

HTTP Request, Telegram, Telegram Trigger, AI Agent, OpenAI Chat Model, Simple Memory

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup