
About
Integracao completa com Telegram Bot API. Setup com BotFather, mensagens, webhooks, inline keyboards, grupos, canais. Boilerplates Node.js e Python.
name: telegram description: Integracao completa com Telegram Bot API. Setup com BotFather, mensagens, webhooks, inline keyboards, grupos, canais. Boilerplates Node.js e Python. risk: critical source: community date_added: '2026-03-06' author: renat tags:
- messaging
- telegram
- bots
- webhooks tools:
- claude-code
- antigravity
- cursor
- gemini-cli
- codex-cli
Telegram Bot API - Integracao Profissional
Overview
Integracao completa com Telegram Bot API. Setup com BotFather, mensagens, webhooks, inline keyboards, grupos, canais. Boilerplates Node.js e Python.
When to Use This Skill
- When the user mentions "telegram" or related topics
- When the user mentions "bot telegram" or related topics
- When the user mentions "telegram bot" or related topics
- When the user mentions "api telegram" or related topics
- When the user mentions "chatbot telegram" or related topics
- When the user mentions "mensagem telegram" or related topics
Do Not Use This Skill When
- The task is unrelated to telegram
- A simpler, more specific tool can handle the request
- The user needs general-purpose assistance without domain expertise
How It Works
Skill para implementar bots profissionais no Telegram usando a Bot API oficial. Suporta Node.js/TypeScript e Python.
Overview
A Telegram Bot API permite criar bots que interagem com usuarios via mensagens, comandos, inline keyboards, pagamentos e muito mais. Bots sao criados pelo @BotFather e autenticados via token unico.
Base URL: https://api.telegram.org/bot<TOKEN>/METHOD_NAME
Metodos HTTP: GET e POST
Formatos de parametros: query string, application/x-www-form-urlencoded, application/json, multipart/form-data (uploads)
Limite de arquivos: 50MB download, 20MB upload (via multipart), 50MB via URL
Portas suportadas para webhooks: 443, 80, 88, 8443
Pre-requisitos:
- Conta no Telegram
- Bot criado via @BotFather (fornece o token)
- Token no formato:
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
Se o usuario nao tem um bot criado, oriente a conversar com @BotFather no Telegram e enviar /newbot.
Decision Tree
O usuario precisa criar um bot?
├── SIM → Secao "Setup com BotFather" abaixo
└── NAO → Qual linguagem?
├── Node.js/TypeScript
└── Python
→ O que quer fazer?
├── Enviar mensagens → Secao "Tipos de Mensagem"
├── Receber mensagens → Secao "Receber Updates"
├── Teclados interativos → Secao "Keyboards"
├── Gerenciar grupos/canais → references/chat-management.md
├── Webhook setup → references/webhook-setup.md
├── Inline mode → references/advanced-features.md
├── Pagamentos → references/advanced-features.md
├── Bot de atendimento com IA → Secao "Automacao com IA"
└── Referencia completa da API → references/api-reference.md
Para iniciar um projeto do zero com boilerplate pronto:
python scripts/setup_project.py --language nodejs --path ./meu-bot-telegram
## Ou
python scripts/setup_project.py --language python --path ./meu-bot-telegram
Para testar se o token do bot funciona:
python scripts/test_bot.py --token "SEU_TOKEN"
Para enviar uma mensagem de teste:
python scripts/send_message.py --token "SEU_TOKEN" --chat-id "CHAT_ID" --text "Hello!"
Setup Com Botfather
- Abra o Telegram e busque @BotFather
- Envie
/newbot - Escolha nome de exibicao (ex: "Meu Bot Incrivel")
- Escolha username (deve terminar com "bot", ex:
meu_incrivel_bot) - BotFather retorna o token - guarde com seguranca
- Comandos uteis do BotFather:
/setdescription- descricao do bot/setabouttext- texto "sobre" do bot/setuserpic- foto de perfil/setcommands- lista de comandos/mybots- gerenciar bots existentes/setinline- habilitar inline mode/setprivacy- modo privacidade em grupos
Variaveis De Ambiente
TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
Node.Js/Typescript
// Instalar: npm install telegraf dotenv
// Para TypeScript: npm install -D typescript
import { Telegraf } from 'telegraf';
import dotenv from 'dotenv';
dotenv.config();
const bot = new Telegraf(process.env.TELEGRAM_BOT_TOKEN!);
bot.start((ctx) => {
ctx.reply('Ola! Eu sou seu bot. Como posso ajudar?');
});
bot.on('text', (ctx) => {
if (!ctx.message.text.startsWith('/')) {
ctx.reply(`Voce disse: ${ctx.message.text}`);
}
});
bot.launch();
Python
## Instalar: Pip Install Python-Telegram-Bot Python-Dotenv
import os
from dotenv import load_dotenv
from telegram import Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes
load_dotenv()
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text('Ola! Eu sou seu bot. Como posso ajudar?')
async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.messag