Telegram vs WhatsApp for Bot Businesses
Before building, understand the trade-offs:
| Factor | Telegram Bot | WhatsApp Bot |
|---|---|---|
| API cost | Free, no per-message fees | $0.005–$0.08 per message (Meta) |
| Setup complexity | Low — official free Bot API | High — requires Meta Business verification |
| Global reach | 900M users, strong in NG/GH/KE | 2.8B users, dominant in Africa |
| Bot capabilities | Rich: inline keyboards, files, payments | Basic: text + media |
| Group features | Full bot support in groups | Limited |
| Best for | Content, communities, developer tools | Business customer service |
The strategic answer: build Telegram bots for developers, communities, and content delivery. Build WhatsApp bots for local business customer service.

Step 1: Create Your Bot
- Open Telegram and search for @BotFather
- Send
/newbot - Choose a name (displayed in chats): e.g. "Kivora Assistant"
- Choose a username (must end in 'bot'): e.g. "kivoraassist_bot"
- Copy the API token you receive
Store it:
TELEGRAM_BOT_TOKEN=123456789:AAFxxxxxxxxxxxxxxxxxxxxx
Step 2: Build the Foundation
mkdir telegram-bot && cd telegram-bot
npm init -y
npm install node-telegram-bot-api dotenv express
// bot.js
require('dotenv').config()
const TelegramBot = require('node-telegram-bot-api')
const bot = new TelegramBot(process.env.TELEGRAM_BOT_TOKEN, { polling: true })
// Handle /start command
bot.onText(/\/start/, (msg) => {
const chatId = msg.chat.id
const name = msg.from.first_name
bot.sendMessage(chatId,
`Welcome, ${name}! 👋\n\nI'm your AI assistant. Here's what I can do:\n\n/ask [question] — Ask me anything\n/summary — Summarise a URL\n/help — Show this menu`,
{
reply_markup: {
inline_keyboard: [[
{ text: '🤖 Ask a Question', callback_data: 'ask_mode' },
{ text: '📰 Summarize URL', callback_data: 'summary_mode' }
]]
}
}
)
})
// Handle callback from inline keyboard
bot.on('callback_query', (query) => {
const chatId = query.message.chat.id
const data = query.data
bot.answerCallbackQuery(query.id)
if (data === 'ask_mode') {
bot.sendMessage(chatId, 'Ask me anything! Type your question:')
}
if (data === 'summary_mode') {
bot.sendMessage(chatId, 'Paste a URL and I'll summarize it for you:')
}
})
// Handle regular text messages
bot.on('message', async (msg) => {
if (msg.text && !msg.text.startsWith('/')) {
const chatId = msg.chat.id
// Send "typing..." indicator
bot.sendChatAction(chatId, 'typing')
// Process the message (add your AI logic here)
bot.sendMessage(chatId, `You said: "${msg.text}". AI response coming soon!`)
}
})
console.log('Bot is running...')
Step 3: Add AI With Groq
npm install groq-sdk
const Groq = require('groq-sdk')
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY })
// Conversation memory per user (replace with Redis/Supabase for production)
const conversations = new Map()
async function askAI(userId, userMessage) {
if (!conversations.has(userId)) {
conversations.set(userId, [])
}
const history = conversations.get(userId)
history.push({ role: 'user', content: userMessage })
// Keep last 10 messages to avoid token overflow
const recentHistory = history.slice(-10)
const completion = await groq.chat.completions.create({
model: 'llama-3.3-70b-versatile',
messages: [
{
role: 'system',
content: 'You are a helpful AI assistant on Telegram. Be concise — Telegram messages work best under 500 words. Use bullet points for lists.'
},
...recentHistory
]
})
const reply = completion.choices[0].message.content
history.push({ role: 'assistant', content: reply })
return reply
},
// Updated message handler with AI
bot.on('message', async (msg) => {
if (!msg.text || msg.text.startsWith('/')) return
const chatId = msg.chat.id
const userId = msg.from.id
bot.sendChatAction(chatId, 'typing')
try {
const reply = await askAI(userId.toString(), msg.text)
bot.sendMessage(chatId, reply, { parse_mode: 'Markdown' })
} catch (err) {
bot.sendMessage(chatId, 'Sorry, I had trouble processing that. Try again in a moment.')
}
})
Step 4: Add Payments With Telegram's Built-In Payment API
Telegram has a native payment system — users never leave the app:
// Send an invoice
bot.onText(/\/premium/, async (msg) => {
const chatId = msg.chat.id
await bot.sendInvoice(
chatId,
'Kivora Pro', // Title
'Unlimited AI queries for 30 days', // Description
'premium_30days', // Payload
process.env.STRIPE_PROVIDER_TOKEN, // Payment provider token
'USD', // Currency
[{ label: 'Pro Plan', amount: 999 }] // Prices (in cents = $9.99)
)
})
// Handle pre-checkout
bot.on('pre_checkout_query', (query) => {
bot.answerPreCheckoutQuery(query.id, true)
})
// Handle successful payment
bot.on('successful_payment', async (msg) => {
const chatId = msg.chat.id
const payload = msg.successful_payment.invoice_payload
// Update user's plan in your database
if (payload === 'premium_30days') {
await upgradeToPro(msg.from.id)
bot.sendMessage(chatId, '✅ Payment successful! You now have Pro access for 30 days.')
}
})
Step 5: Deploy With Webhooks (Better Than Polling)
Polling constantly checks for new messages — inefficient for production. Webhooks let Telegram push messages to your server instantly:
// webhook-server.js
require('dotenv').config()
const TelegramBot = require('node-telegram-bot-api')
const express = require('express')
const bot = new TelegramBot(process.env.TELEGRAM_BOT_TOKEN)
const app = express()
app.use(express.json())
// Set webhook (run once)
const WEBHOOK_URL = `https://your-server.com/bot${process.env.TELEGRAM_BOT_TOKEN}`
bot.setWebHook(WEBHOOK_URL)
// Handle webhook requests
app.post(`/bot${process.env.TELEGRAM_BOT_TOKEN}`, (req, res) => {
bot.processUpdate(req.body)
res.sendStatus(200)
})
app.listen(3000, () => console.log('Webhook server running'))
Monetisation Models for Telegram Bots
| Model | How It Works | Revenue Potential |
|---|---|---|
| Freemium | Free tier (10 queries/day), paid for unlimited | $5–$20/month per user |
| Channel subscription | Bot manages access to premium channel | $5–$50/month per subscriber |
| B2B white-label | Sell customised bots to businesses | $200–$2,000 setup + $50–$300/month |
| Lead generation | Free bot for a niche, sell the leads | $5–$50 per qualified lead |
| Affiliate | Bot recommends products, earns commission | 10–40% per sale |
The most reliable model for African markets: B2B white-label. Find businesses that need a Telegram community bot, build it once, charge a monthly management fee.

