Webhook Not Firing

Diagnose and fix issues with Telegram/Discord webhooks not triggering.

Webhook Not Firing

Your bot doesn't respond to messages? The webhook might not be configured correctly.

Symptoms

  • Bot shows as online but doesn't respond
  • Messages are sent but nothing happens
  • No errors in logs when messages are sent

Likely Causes

  1. Webhook URL incorrect or not set
  2. SSL certificate invalid (required for Telegram)
  3. Firewall blocking incoming connections
  4. Webhook secret mismatch
  5. Bot token revoked or invalid

Fix Steps

1. Verify Webhook is Set

For Telegram:

curl "https://api.telegram.org/bot<YOUR_TOKEN>/getWebhookInfo"

Check the response:

  • url should be your webhook URL
  • last_error_message shows any issues
  • pending_update_count shows queued messages

For Discord: Discord uses gateway connection, not webhooks. Check if bot is connected:

docker logs moltbot | grep -i discord

2. Check SSL Certificate

Telegram requires valid HTTPS:

curl -I https://your-domain.com/api/telegram/webhook

Should return 200 OK. If certificate errors, see Reverse Proxy Setup.

3. Check Firewall

Ensure port 443 (HTTPS) is open:

sudo ufw status
# Should show 443 ALLOW

Test from outside:

curl https://your-domain.com/health

4. Re-register Webhook

Telegram:

# Delete old webhook
curl "https://api.telegram.org/bot<TOKEN>/deleteWebhook"

# Set new webhook
curl "https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://your-domain.com/api/telegram/webhook"

5. Check Logs

docker logs -f moltbot 2>&1 | grep -i "webhook\|telegram\|discord"

Look for:

  • "Webhook received" - confirms messages are arriving
  • Error messages about parsing or handling

Verify

Send a test message to your bot. You should see log output:

Webhook received from Telegram
Processing message from user: 123456

Common Mistakes

Using HTTP instead of HTTPS: Telegram only accepts HTTPS webhooks with valid certificates.

Wrong webhook path: Double-check the path matches your Moltbot configuration.

Cloudflare/proxy issues: If using Cloudflare, ensure it's not blocking webhook requests or requiring captchas.