Telegram Integration
Communicate with your customers via Telegram using the Telegram Bot API.
Requirements
For Telegram integration:
- Telegram account
- Bot token obtained from BotFather
Creating a Bot
1. Creating a Bot with BotFather
- Search for @BotFather on Telegram
- Send the
/newbotcommand - Enter a name for the bot
- Set a username for the bot (must end with
bot) - Copy the provided API Token
2. Connecting to DOLU.ai
- Go to Settings > Channels > Telegram
- Click the Connect Telegram button
- Paste the token obtained from BotFather
- Click the Connect button
Bot Settings
Profile Settings
Edit the bot profile with BotFather:
/setdescription- Bot description/setabouttext- About text/setuserpic- Profile photo/setcommands- Available commands
Commands
You can define commands for the bot:
start - Start the chat
help - Get help
menu - Main menu
info - Get informationMessage Types
Supported Content
| Type | Send | Receive |
|---|---|---|
| Text | Yes | Yes |
| Image | Yes | Yes |
| Video | Yes | Yes |
| Audio | Yes | Yes |
| Document | Yes | Yes |
| Location | Yes | Yes |
| Contact | Yes | Yes |
| Sticker | No | Yes |
Inline Buttons
Add clickable buttons to messages:
json
{
"inline_keyboard": [
[
{"text": "Place Order", "callback_data": "order"},
{"text": "Support", "callback_data": "support"}
],
[
{"text": "Website", "url": "https://dolu.ai"}
]
]
}Reply Keyboard
Present options to the user:
json
{
"keyboard": [
["Order Tracking", "New Order"],
["Help", "Contact"]
],
"resize_keyboard": true
}Group and Channel Support
Group Messages
You can add the bot to groups:
- Add the bot to the group
- Grant admin permissions
- View group messages in the Inbox
Channel Management
Manage your Telegram channels:
- Broadcast to the channel
- Read comments
- Create polls
Automatic Replies
Welcome Message
Automatic reply to the /start command:
Hello! Welcome to the DOLU.ai Telegram Bot.
Type /menu to see the menu.
Type /help to get assistance.AI Agent
The AI Agent can be active on Telegram:
- Understands natural language questions
- Responds from the knowledge base
- Transfers to a human for complex topics
Notifications
Send notifications via Telegram:
- Order updates
- Appointment reminders
- Campaign announcements
Webhooks
Your Telegram bot triggers these events:
message- New message receivedcallback_query- Button clickedchat_member- Membership changed
API Usage
bash
# Send message
POST /api/v1/messages/telegram
{
"chatId": "123456789",
"message": "Hello!"
}
# Message with buttons
POST /api/v1/messages/telegram
{
"chatId": "123456789",
"message": "Select an option:",
"inlineKeyboard": [
[{"text": "Option 1", "callbackData": "opt1"}]
]
}Troubleshooting
Bot Not Responding
- Check that the token is correct
- Make sure the webhook URL is accessible
- Check that the bot is not blocked
Messages Are Delayed
- Check webhook status
- Check server response time
Buttons Not Working
- Make sure the callback data is in the correct format
- Make sure the bot has sufficient permissions
Best Practices
- Use commands: Guide users
- Add buttons: Make interaction easier
- Respond quickly: Users expect instant replies
- Notifications: Inform without spamming
- Manage groups: Build a community
