Issues with Telegram Bot Webhook and Self-Signed Certificate

I’m experiencing difficulties with my Telegram bot’s webhook that utilizes a self-signed SSL certificate. To create the certificate, I executed the following OpenSSL command:

openssl req -newkey rsa:2048 -sha256 -nodes -keyout custom_key.key -x509 -days 365 -out custom_cert.pem -subj "/C=US/ST=California/L=Los Angeles/O=My Bot Service/CN=examplebotdomain.com"

Everything seemed fine during setup, but I’m not seeing any requests in my server’s access logs, which suggests the webhook isn’t activating at all. I’ve thoroughly checked my server settings, yet I’m at a loss for what could be wrong. Has anyone else faced such problems with Telegram’s webhook when using self-signed certificates?

I feel ya, had that issue too! Just make sure that your cert is trusted by Telegram. You can also try reaching out to their support if it’s still not working. Sometimes a small misconfiguration can throw things off. Good luck!

The certificate format might be your issue. When I faced this problem, I found that Telegram requires just the public certificate—no extra headers or footers. Check your custom_cert.pem file to ensure it begins with -----BEGIN CERTIFICATE----- and ends with -----END CERTIFICATE----- without anything else. Also, ensure you’re correctly uploading the certificate during the webhook setup using the certificate parameter in your setWebhook call. Additionally, the webhook URL needs to use HTTPS on one of the allowed ports: 443, 80, 88, or 8443. If you’re testing locally, verify that your router is properly forwarding the port to your machine.

Had the same headache last year. My server wasn’t listening on the port I put in the webhook URL. Check that your app’s bound to the right port and your firewall isn’t blocking connections. Also make sure the Common Name in your cert matches your domain exactly - Telegram’s strict about this. I wasted hours on server configs when it was just a typo in my CN field. Set the webhook again with verbose logging to see if Telegram’s even trying to connect.