Telegram Não Responde — Solução Bot

Como resolver quando o bot do Telegram para de responder. Diagnóstico e soluções.

Telegram Não Responde

Seu bot do Telegram parou de responder? Veja como resolver.

Diagnóstico Rápido1. Verificar Status
openclaw telegram status

Deve mostrar: “Connected” ✓

2. Verificar Logs
openclaw logs | grep -i telegram | tail -20

Procure por erros ou desconexões.

3. Testar Token
curl "https://api.telegram.org/bot<SEU_TOKEN>/getMe"

Deve retornar informações do bot.

Causas e SoluçõesToken Inválido

Sintoma:

Error: 401 Unauthorized

Solução:

  1. Vá ao @BotFather no Telegram
  2. /mybots > Seu bot > API Token
  3. Revoke token e crie novo
  4. Atualize config.yaml:
telegram:
  token: "novo-token"
  1. openclaw gateway restart
Bot Bloqueado/Deletado

Sintoma: Token funciona no curl mas bot não responde.

Solução:

  1. Verifique se o bot existe (@BotFather > /mybots)
  2. Se deletado, crie novo bot
  3. Se bloqueado por spam, aguarde ou contate Telegram
Webhook vs Polling Conflito

Sintoma: Respostas intermitentes ou duplicadas.

Solução: Use apenas um método.

# config.yaml - polling (recomendado para início)
telegram:
  method: polling
  
# OU webhook (produção)
telegram:
  method: webhook
  webhook_url: "https://seu-dominio.com/telegram"
# Limpar webhook anterior
curl "https://api.telegram.org/bot<TOKEN>/deleteWebhook"
Gateway Não Está Rodando

Sintoma: Nenhum log, nenhuma atividade.

Solução:

# Verificar processo
ps aux | grep openclaw

# Se não estiver rodando
openclaw gateway start
Telegram API Fora do Ar

Sintoma: Funciona intermitentemente.

Verificar:

Rate Limit

Sintoma:

Error: 429 Too Many Requests

Solução:

  1. Aguarde o tempo indicado
  2. Reduza frequência de mensagens
  3. Configure rate limiting:
telegram:
  rate_limit:
    messages_per_second: 1
    messages_per_minute: 20
Configuração Correta
# config.yaml - exemplo completo
telegram:
  enabled: true
  token: ${TELEGRAM_BOT_TOKEN}
  method: polling  # ou webhook
  
  # Se usando webhook
  webhook_url: "https://seu-dominio.com/telegram/webhook"
  
  # Opções
  parse_mode: "Markdown"
  drop_pending_updates: true  # Ignora msgs antigas ao iniciar
Verificações ManuaisTestar Bot Diretamente
# Enviar mensagem de teste
curl -X POST "https://api.telegram.org/bot<TOKEN>/sendMessage" \
  -d "chat_id=<SEU_CHAT_ID>&text=Teste"
Ver Updates Pendentes
curl "https://api.telegram.org/bot<TOKEN>/getUpdates"
Reinício Limpo
# 1. Parar gateway
openclaw gateway stop

# 2. Limpar webhook (se usando polling)
curl "https://api.telegram.org/bot<TOKEN>/deleteWebhook?drop_pending_updates=true"

# 3. Reiniciar
openclaw gateway start

# 4. Monitorar
openclaw logs -f | grep telegram
Quando Escalar

Se nada funcionar:

  1. Crie novo bot com @BotFather
  2. Atualize token na config
  3. Se persistir, abra issue no GitHub
Próximos Passos