Skip to content

How to Configure AI Replies in Telegram Bots ​

Quick Summary (TL;DR):

  • Goal: Let your Telegram bot answer client questions about your business with ChatGPT or Gemini, using your own files (RAG).
  • Time to set up: ~4 minutes.
  • Key Node needed: AI Agent Node + AI Settings.
  • Ready Template: ⚡ Import the Support Intake Bot Template

The Challenge: Why building AI Support bots is hard with code ​

Connecting an AI model to a Telegram bot sounds simple, but coding a production-ready AI support bot requires solving multiple technical challenges:

  1. Context Limits: You cannot paste your entire website content or a 100-page catalog into every ChatGPT API call; it will exceed token limits and cost thousands of dollars. You must write a Retrieval-Augmented Generation (RAG) vector database pipeline.
  2. Hallucinations: If you don't restrict the AI model, it might recommend your competitors, make up fake discount codes, or discuss irrelevant topics.
  3. Typing Indicators: Users expect to see a "typing..." status while the AI generates its response, which requires complex async thread handling in code.

TeleGo.io solves these problems natively. You upload your files or links, and our vector engine automatically chunks, indexes, and retrieves the relevant context for the AI node with zero code.

Step-by-Step Configuration Guide ​

Here is the logic we will construct: User Message ➔ Bot Shows "Typing..." ➔ AI Queries Knowledge Base ➔ Bot Replies with Custom Info

Step 1: Set up your AI Provider Settings ​

By default, TeleGo comes with pre-configured cloud credits, but you can also use your own API keys for full control:

  1. Go to Workspace Settings ➔ AI Settings in your TeleGo dashboard.
  2. Choose your preferred provider and model (OpenAI or Google Gemini).
  3. (Optional) Paste your API Key and save.

Step 2: Upload your Knowledge Base Documents (RAG) ​

To make the AI answer questions about your company, price lists, or support articles:

  1. Navigate to Workspace Settings ➔ AI Settings ➔ Knowledge Bases.
  2. Click Create Knowledge Base and name it (e.g., "Customer Help Docs").
  3. Upload your documents (PDF, DOCX, TXT, or Markdown) or paste text directly.
  4. TeleGo's parser will split the text into semantic chunks and build a search index in under a minute.

Step 3: Add and Configure the AI Agent Node ​

  1. Open your bot's scenario canvas in the visual editor.
  2. Drag the AI Agent Node from the left panel and drop it onto the canvas.
  3. Select the node to configure its options:
    • System Prompt: Define the AI's behavior and constraints. Example:

      "You are an AI support assistant for TeleGo.io. You must answer questions using ONLY the provided Knowledge Base context. If you do not know the answer, politely ask the user to type 'support' to talk to a human agent. Do not make up facts."

    • Knowledge Base: Enable RAG and select the "Customer Help Docs" knowledge base you created in Step 2.
    • Input Mode: Set to last_user_message — the node automatically reads what the user just typed.
    • Typing Indicator: Enable this so the bot shows a native "typing..." bubble in Telegram while AI processes the request.

Step 4: Display the AI Response ​

  1. Drag a Message Node onto the canvas and connect it to the output of your AI Agent Node.
  2. Set the message content to: {%ai_last_answer%} — this variable is automatically populated with the AI's response.
  3. Optionally add follow-up buttons: "Ask another question" (loop back to AI node) or "Talk to human" (Actions node with bot.handoff).

⚡ The Fast Track: Deploy in 1 Click ​

Skip the manual canvas setup by using our pre-built Support Intake template:

  1. Go to the TeleGo Template Gallery.
  2. Choose the "Support Intake" template.
  3. Install it, upload your help PDFs in the AI settings, and click Publish. Your bot is now fully trained and live!

Frequently Asked Questions (FAQ) ​

Q: Can I collect leads before sending the conversation to the AI? ​

A: Absolutely! You can place a Message Node (asking for name and email) or a Lead Capture Node before the AI Agent Node. This ensures you capture contact details in your CRM before the user starts chatting with the AI.

Q: How do I prevent the AI from answering off-topic questions? ​

A: You can enforce this in the System Prompt inside the AI Agent Node by adding strict negative constraints. For example: "Strictly reject answering questions unrelated to our product. If the user asks about general topics, cooking, or programming, politely decline."

TeleGo.io Docs