Create a Telegram Bot Without Code: Automation with n8n and Make.com
Step-by-step guide to creating a Telegram Bot with n8n.
Telegram bots are powerful tools for business automation: customer notifications, team alerts, order status updates, or even complete chatbots. The best part: you don't need programming knowledge. In this guide, we show you how to create a working Telegram bot in 30 minutes.
Why Telegram Bots?
Advantages over other channels:| Channel | Delivery Rate | Cost | Interactive |
|---|---|---|---|
| 20-30% opened | Free | Limited | |
| SMS | 95%+ | $0.05-0.10/SMS | No |
| WhatsApp Business | 90%+ | Complex, expensive | Yes |
| Telegram Bot | 90%+ | Free | Yes |
- Server monitoring alerts
- Order notifications
- Team communication
- Customer support bot
- Daily reports
- IoT notifications
Step 1: Create Bot on Telegram
Contact BotFather
/startCreate Bot
You: /newbot
BotFather: Alright, a new bot. How are we going to call it?
You: My Business Bot
BotFather: Good. Now let's choose a username for your bot...
You: my_business_bot
BotFather: Done! Congratulations on your new bot...
Use this token to access the HTTP API:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
Important: Store the API token securely - it's like a password!
Configure Bot
Additional BotFather commands:
| Command | Function |
|---|---|
/setdescription | Bot description |
/setabouttext | Info text |
/setuserpic | Profile picture |
/setcommands | Define commands |
Step 2: Get Chat ID
To send messages, you need the chat ID:
For Individuals
https://api.telegram.org/bot{TOKEN}/getUpdates"chat":{"id":123456789}For Groups
getUpdates-987654321Automatically with n8n
// Node: Telegram Trigger
// Waits for messages and extracts chat ID
const chatId = $json.message.chat.id;
const username = $json.message.from.username;
const text = $json.message.text;
// Save chat ID for later use
Step 3: Create First Workflow
Use Case: Server Alert Bot
Notification for server problems:
Uptime Monitor (Server down)
|
Telegram: Send alert
"Warning: Server XYZ is unreachable!"
|
Wait for response
|
On "OK": Mark alarm as acknowledged
n8n Workflow
Node 1: HTTP Request (Webhook from uptime monitor)// Webhook receives alert
{
"server": "webserver-01",
"status": "down",
"timestamp": "2024-01-15T10:30:00Z"
}
Node 2: Telegram - Send Message
// Configure Telegram Node
{
"chatId": "-987654321", // Group ID
"text": "<em>Server Alert</em>\n\nServer: {{ $json.server }}\nStatus: {{ $json.status }}\nTime: {{ $json.timestamp }}\n\nReply with /ack to acknowledge.",
"parseMode": "Markdown"
}
Step 4: Build Interactive Bot
Define Commands
With BotFather:
/setcommands
status - Current system status
help - Show help
subscribe - Enable notifications
unsubscribe - Disable notifications
React to Commands
Telegram Trigger (new message)
|
Switch (by command)
|
/status -> Send system status
/help -> Send help text
/subscribe -> Register user
/unsubscribe -> Remove user
n8n: Command Handler
// Node: Switch
// Routing based on command
const text = $json.message.text;
if (text === '/status') return { route: 'status' };
if (text === '/help') return { route: 'help' };
if (text.startsWith('/subscribe')) return { route: 'subscribe' };
if (text.startsWith('/unsubscribe')) return { route: 'unsubscribe' };
return { route: 'unknown' };
Implement Status Command
// Node: HTTP Request -> Your API;// Node: Format Response
const status = {
webserver: $json.webserver.status,
database: $json.database.status,
queue: $json.queue.jobs_pending
};
const message =
<em>System Status</em>
Web Server: ${status.webserver === 'ok' ? 'OK' : 'ERROR'}
Database: ${status.database === 'ok' ? 'OK' : 'ERROR'}
Queue: ${status.queue} jobs pending
_Updated: ${new Date().toLocaleString('en-US')}_
return { message };
Step 5: Inline Keyboards
Interactive buttons for better UX:
Send Button Message
// Node: Telegram - Send Message
{
"chatId": "{{ $json.chatId }}",
"text": "Which action would you like to perform?",
"replyMarkup": {
"inline_keyboard": [
[
{ "text": "Confirm", "callback_data": "confirm" },
{ "text": "Cancel", "callback_data": "cancel" }
],
[
{ "text": "Status", "callback_data": "status" }
]
]
}
}
React to Button Clicks
// Node: Telegram Trigger
// callback_query contains button data
if ($json.callback_query) {
const action = $json.callback_query.data;
const chatId = $json.callback_query.message.chat.id;
const messageId = $json.callback_query.message.message_id;
// Acknowledge button click (removes loading animation)
await answerCallbackQuery($json.callback_query.id);
// Update original message
await editMessage(chatId, messageId, "Action performed: " + action);
}
Practical Examples
1. E-Commerce Order Bot
Shopify (New Order)
|
Telegram to customer:
"Thank you for your order #1234!
Products:
- Product A (2x)
- Product B (1x)
Total: $149.00
We'll notify you about shipping."
2. Team Standup Bot
Schedule (Mon-Fri 9:00 AM)
|
Telegram to team group:
"Good morning! Time for the daily standup.
Please reply with:
1. What did I do yesterday?
2. What am I doing today?
3. Are there any blockers?"
|
Collect responses (30 min)
|
Save summary to Notion
3. Lead Notification Bot
Website Form (new lead)
|
Telegram to sales team:
"New Lead!
Max Smith
max@example.com
Company Inc.
'Interested in Enterprise Plan'
[Open CRM] [Call]"
4. Monitoring & Alerts
Various sources:
- Server Down -> Alert
- High CPU -> Warning
- Backup complete -> Info
- Error in logs -> Bug Report
|
Telegram with severity indicator
Make.com: Telegram Bot Scenario
Modules
Example Scenario: FAQ Bot
Telegram Watch Updates
|
Router:
+- /faq -> Send FAQ menu (Inline Keyboard)
+- callback "faq_*" -> Send FAQ answer
+- Free text -> AI search in FAQ database
Advanced: AI Chatbot
Connect with OpenAI/Claude
// Node: OpenAI;// Conversation with context
const systemPrompt =
You are a friendly support bot for Company XYZ.
You answer questions about our products and services.
For complex inquiries, refer to human support.
const messages = [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: $json.message.text }
];
// Include conversation history
const history = await getConversationHistory($json.message.chat.id);
messages.splice(1, 0, ...history);
Save Conversation
// Node: Redis/Database
// Store context for 24h
await saveMessage({
chatId: $json.message.chat.id,
role: 'user',
content: $json.message.text,
timestamp: Date.now()
});
await saveMessage({
chatId: $json.message.chat.id,
role: 'assistant',
content: aiResponse,
timestamp: Date.now()
});
Best Practices
1. Respect Rate Limits
| Action | Limit |
|---|---|
| Messages to user | 30/second |
| Messages in group | 20/minute |
| Bulk messages | 30 users/second |
// Add delay for bulk sending
for (const user of users) {
await sendMessage(user.chatId, message);
await sleep(100); // 100ms pause
}
2. Error Handling
// Catch Telegram API errors
try {
await sendMessage(chatId, text);
} catch (error) {
if (error.code === 403) {
// User has blocked bot
await removeSubscriber(chatId);
} else if (error.code === 429) {
// Rate limit - wait and retry
await sleep(error.parameters.retry_after * 1000);
await sendMessage(chatId, text);
}
}
3. Format Messages
// Markdown V2 syntaxCode\const text =
<em>Bold</em>
_Italic_
~Strikethrough~
\
\\
\Code Block
\
Link\\;
// Escape special characters
const escaped = text.replace(/[_*[\]()~`>#+=|{}.!-]/g, '\\$&');
4. Send Media
// Send image
{
"method": "sendPhoto",
"chatId": "123456",
"photo": "https://example.com/image.jpg",
"caption": "Description"
}
// Send document
{
"method": "sendDocument",
"chatId": "123456",
"document": "{{ $binary.data }}",
"filename": "report.pdf"
}
Security
Protect Token
- Never commit in code
- Use environment variables
- If leaked: Revoke token with BotFather
Restrict Access
// Only allow certain users
const allowedUsers = [123456, 789012];
if (!allowedUsers.includes($json.message.from.id)) {
await sendMessage(chatId, "Access denied.");
return;
}
Secure Webhook
// Verify secret token
const secretToken = $headers['x-telegram-bot-api-secret-token'];
if (secretToken !== process.env.TELEGRAM_SECRET) {
return { status: 403 };
}
Costs
| Component | Cost |
|---|---|
| Telegram Bot API | Free |
| n8n Cloud | From 20 EUR/month |
| Make.com | From 9 EUR/month |
| Server (Self-Hosted) | From 5 EUR/month |
Conclusion
Telegram bots are a cost-effective and efficient solution for business automation:
- Free API
- High delivery rates
- Interactive features
- Easy integration with n8n/Make.com
Next Steps
We support you with Telegram automation - from setup to production use.