Tutorial

Serve a Telegram webhook with Caddy automatic HTTPS

You need a domain and a VPS with ports 80 and 443 open.

Tutorial1 min readUpdated

  1. Create an A/AAAA record for hooks.example.com to your VPS.
  2. Run your bot on 127.0.0.1:8080 with secret header checks.
  3. Caddyfile:
    hooks.example.com {
        reverse_proxy 127.0.0.1:8080
    }
  4. setWebhook with url and secret_token (see Telegram URL builder)
  5. Confirm with getWebhookInfo and a real /start.

Domain registrar option: Namecheap Domains.

Production webhooks guide ยท Vultr + systemd

Related comparisons and tools