Connect Your Agent to Telegram & WhatsApp

You have trained your AI agent. Now bring it where your community already talks — Telegram and WhatsApp. This guide explains how to link your agent (and the knowledge base it was trained on) to these chat channels.

How it works

Every trained agent exposes a secure interface that other apps can call. To reach Telegram or WhatsApp you run a small bridge (a bot) in between: messages from the chat app are forwarded to your agent, and the agent’s answer — grounded in your knowledge database — is sent back to the conversation.

What you need

AGENT

Train account

An account on Train with an agent fully trained and knowledge content (RAG database) uploaded.

CREDENTIALS

Agent API credentials

The agent’s API credentials, available from the agent settings in Studio.

TELEGRAM

Telegram bot token

For Telegram: your own bot token, created through BotFather (@BotFather).

WHATSAPP

WhatsApp Business account

For WhatsApp: a WhatsApp Business account or provider that allows message sending.

Steps to connect

  1. STEP 1

    Get your credentials

    Open the agent’s settings in Studio and copy the agent API token. Keep it private.

  2. STEP 2

    Create the bridge

    Set up a small bot or gateway script that receives messages from Telegram/WhatsApp.

  3. STEP 3

    Point the bridge to your agent

    Configure it to call your agent using the API credentials, with knowledge base access enabled, so answers are generated from your own content.

  4. STEP 4

    Test

    Send sample questions from Telegram/WhatsApp and confirm replies come from your knowledge database.

GOOD TO KNOW

What to expect

This guide is for users who run their own bridge. Train does not host Telegram or WhatsApp bots today — the bridge runs on your side, and you are responsible for keeping your credentials secure.

SECURITY

Security note

Never share your agent API token in public chats, logs, or repositories. If you suspect a leak, revoke the token in agent settings and issue a new one.

Need help setting this up? Contact us and our team will walk you through it.