Skip to main content
Learn how to build a functional customer support bot from scratch. This beginner-friendly guide walks you through creating a bot, connecting it to Telegram, and setting up an AI integration.

What You’ll Learn

By the end of this guide, you’ll have:
  • A working support bot deployed to Telegram
  • An AI integration that handles customer questions
  • Typing indicators for natural conversations
  • Automatic conversation history tracking
  • Basic understanding of bot configuration

Prerequisites

Before starting, you’ll need:
  • A Chatbot Platform account (sign up here)
  • A Telegram account
  • An API key from OpenAI, Anthropic, or another AI provider
  • 15 minutes of your time

Step 1: Create Your Bot

1

Access the Dashboard

Log into Chatbot Platform and navigate to the Bots page.
2

Click Create Bot

Click the Create Bot button in the top right corner.
Bots dashboard

Bots dashboard

3

Fill in Bot Details

Enter the following information:
  • Name: “Support Bot” (or your preferred name)
  • Description: “Customer support assistant that answers common questions”
Create bot form

Create bot form

4

Create the Bot

Click Create to generate your bot instance.
Your bot is now created! Next, we’ll connect it to Telegram so users can interact with it.

Step 2: Connect to Telegram

1

Open BotFather on Telegram

In Telegram, search for @BotFather and start a chat.
2

Create a New Telegram Bot

Send the command /newbot to BotFather.Follow the prompts:
  • Name: “My Support Bot” (display name, can be anything)
  • Username: “my_support_bot” (must be unique and end with “bot”)
3

Copy the Bot Token

BotFather will provide a token that looks like:
Copy this token - you’ll need it in the next step.
4

Add Telegram Channel

Back in Chatbot Platform:
  1. Go to your bot’s page
  2. Click the Channels tab
  3. Click Create Channel
  4. Select Telegram
  5. Paste your bot token
  6. Click Create
Telegram channel form

Channel configuration

5

Verify Connection

The platform automatically configures the webhook. Your bot is now listening for messages on Telegram.
Keep your bot token secret. Never share it publicly or commit it to version control.

Step 3: Set Up AI Integration

Now we’ll connect your bot to an AI provider so it can generate intelligent responses.
1

Navigate to Integrations

From your bot’s page, click the Integrations tab.
2

Create Integration

Click Create Integration and enter:
  • Name: “OpenAI GPT-4”
  • Webhook URL: Your AI service endpoint (see examples below)
  • Timeout: 30 seconds
  • Weight: 100 (use this integration 100% of the time)
Integration configuration

Integration setup

3

Add Authentication Headers

Add the required authentication headers for your AI provider:For OpenAI:
For Anthropic:
4

Save Integration

Click Create to save the integration.
Most AI providers require a proxy service to transform the payload format. See the Webhook Integration Guide for detailed setup instructions.

Step 4: Configure Bot Behavior

Customize how your bot behaves in conversations.
1

Go to Behavior Settings

Click the Behavior tab on your bot’s page.
2

Enable Typing Indicators

Turn on Typing Indicators to show a typing animation while the bot processes responses.This makes conversations feel more natural and gives users feedback that their message is being handled.
3

Set Reply Detection

For group chats, configure when the bot should respond:
  • All Messages: Respond to every message (good for support channels)
  • Mentions Only: Only respond when @mentioned
  • Thread Replies: Only respond in threads where bot is active
4

Set Context Window

Set the conversation context window to 10-15 messages.This determines how much conversation history is sent to your AI integration.

Step 5: Test Your Bot

1

Open Telegram

Find your bot in Telegram by searching for its username.
2

Start a Conversation

Click Start or send /start to begin.
3

Send a Test Message

Try asking a common support question:
4

Verify Response

The bot should:
  1. Show a typing indicator
  2. Process your message through the AI integration
  3. Reply with an intelligent response
Congratulations! Your support bot is now live and responding to messages.

Testing Your Bot

Example Conversation

Here’s what a typical interaction looks like:

What to Test

Test these common scenarios:
  1. Basic Questions: Ask simple questions your bot should know
  2. Follow-up Questions: Test if conversation context is maintained
  3. Group Behavior: Add bot to a group and test mention detection
  4. Response Time: Verify typing indicators appear and responses are timely
  5. Error Handling: Send unexpected input to see how the bot handles it

Improving Your Bot

Write a Better System Prompt

The system prompt defines your bot’s personality and capabilities. Here’s a template:

Add Knowledge Base Context

To provide accurate answers, include your documentation in the AI context: Option 1: RAG (Recommended)
  • Embed your documentation in a vector database
  • Search for relevant articles based on user questions
  • Include relevant content in the AI prompt
Option 2: Static Context
  • Include key information directly in the system prompt
  • Best for small knowledge bases (< 5 pages)
  • Update prompt when documentation changes

Monitor Conversations

Regularly review conversations to identify:
  • Questions the bot handles well
  • Topics that need better answers
  • Common confusion points
  • Opportunities for improvement

API Examples

You can also interact with your bot programmatically via the API.
For complete API documentation, see the OpenAPI specification.

Common Issues

Bot doesn’t respond

Possible causes:
  • Integration webhook URL is incorrect
  • Authentication headers are missing or invalid
  • Integration timeout is too short
  • AI service is down or rate-limited
Solutions:
  • Test the integration using the built-in test feature
  • Verify API keys are correct and have proper permissions
  • Check integration logs for error messages
  • Increase timeout if responses take longer than expected

Bot responds to every message in group chat

Cause: Reply detection is set to “All Messages” Solution: Change to “Mentions Only” or “Thread Replies” in Behavior settings

Typing indicator doesn’t appear

Cause: Typing indicators are disabled or channel doesn’t support them Solution: Enable typing indicators in Behavior settings. Note that not all channels support this feature.

Responses are slow

Possible causes:
  • AI model is slow (e.g., GPT-4 vs GPT-3.5)
  • Network latency between platform and your integration
  • Your integration is processing additional logic
Solutions:
  • Use a faster AI model
  • Optimize your integration code
  • Increase timeout to allow more processing time

Next Steps

Add Grounded Responses

Use Agentic Loops to ground responses in real data

Deploy to More Channels

Connect your bot to Slack, Discord, and more

Manage Conversation Context

Control how conversation history is handled

Webhook Integration Deep Dive

Learn advanced integration patterns