Integrate Professional Telegram Bots with Node.js and Python
A skill for professional Telegram Bot API integration - BotFather setup, messages, webhooks, keyboards, groups, and AI automation.
Why it matters
Build and deploy professional Telegram bots using the official Bot API. This asset provides boilerplates and guidance for Node.js/TypeScript and Python, enabling seamless integration with Telegram features.
Outcomes
What it gets done
Set up bots with BotFather for custom Telegram experiences.
Implement message sending, receiving, and interactive keyboards.
Integrate bots with Node.js or Python applications.
Configure webhooks for real-time bot updates.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-telegram | bash Overview
Telegram Bot API - Integracao Profissional
A skill for professional Telegram Bot API integration - bot setup via BotFather, all message types, inline/reply keyboards, webhooks, command registration, and AI-powered chatbot automation. Use it for building or integrating a Telegram bot specifically, not for general chatbot platforms or unrelated messaging integrations.
What it does
This skill provides complete Telegram Bot API integration in Node.js/TypeScript and Python, covering bot creation via @BotFather, message types, webhooks, inline keyboards, and group/channel management. It documents the API basics (base URL pattern https://api.telegram.org/bot<TOKEN>/METHOD_NAME, GET/POST methods, supported parameter formats, 50MB download/20MB upload file limits, webhook ports 443/80/88/8443) and the BotFather setup flow (/newbot, choosing a display name and username, retrieving the token, and useful BotFather commands like /setdescription, /setcommands, /setinline, /setprivacy). It provides working boilerplate in both Telegraf (Node.js/TypeScript) and python-telegram-bot, plus a pure-HTTP fallback using requests with no library dependency, and setup/test scripts (setup_project.py, test_bot.py, send_message.py) for scaffolding a new bot project. It demonstrates every message type - HTML and MarkdownV2 formatted text (noting MarkdownV2's required character escaping), photos, documents, video, audio, voice notes (OGG/Opus), location, contact cards, polls, and media groups - plus chat actions like "typing" indicators. Interactive UI covers inline keyboards with callback-data buttons, URL buttons, and switch-inline-query buttons (with the callback handler always answering the callback query), reply keyboards including location/contact request buttons, and keyboard removal. It covers both update-reception models: long polling (simplest, ideal for development) and production webhooks (Telegram POSTs updates to your HTTPS URL), including a complete Flask webhook example with setWebhook registration and a secret token. It shows registering bot commands so they appear in the Telegram UI menu, message editing (text and inline keyboard), message deletion, and message forwarding. A full AI-chatbot automation pattern integrates the Anthropic (or OpenAI) API, maintaining per-chat conversation history capped at the last 20 messages, showing a typing indicator while generating a response. Error handling demonstrates a retry-with-exponential-backoff wrapper distinguishing TimedOut/NetworkError (retry) from BadRequest (e.g. "chat not found", handled without retry). Rate limit guidance covers roughly 30 messages/second in private chats, 20 messages/minute per group, and a 30 msg/sec overall broadcast ceiling, recommending a small sleep between bulk sends and respecting the retry_after value on HTTP 429 responses.
When to use - and when NOT to
Use it when building a Telegram bot, integrating the Telegram Bot API, or handling Telegram messages, webhooks, or chatbot automation. It is scoped specifically to Telegram Bot API integration, not general chatbot platforms or unrelated messaging tasks.
Inputs and outputs
Inputs: a Telegram bot token from @BotFather, the target chat/group/channel ID, and the desired bot behavior (message types, keyboards, webhook vs polling, AI automation).
Outputs: working Node.js/TypeScript or Python bot code for message sending/receiving, inline/reply keyboards, webhook or polling setup, command registration, and AI-powered conversational automation.
from telegram.ext import Application, CommandHandler, MessageHandler, filters
async def start(update, context):
await update.message.reply_text('Hello! How can I help?')
app = Application.builder().token(TOKEN).build()
app.add_handler(CommandHandler('start', start))
app.run_polling()
Who it's for
Developers building Telegram bots - from simple message/command bots to AI-powered conversational assistants with inline keyboards and webhook-based production deployment.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.