Creating a Telegram bot: setWebhook issues

Hey everyone! I’m a newbie trying to set up a Telegram bot on my Windows Server 2008 R2 VPS. I’ve got WAMP running and made a self-signed certificate. I used openssl to create new key and cert files.

I tested HTTPS and it works fine. However, when I try setting the webhook with a REST client, I get the following error:

{
    ok: false,
    error_code: 400,
    description: "Error: Bad webhook: Posix Error: Success: getaddrinfo: Name or service not known"
}

I’m using my VPS’s IP address instead of a domain name. Does anyone know what’s causing this issue or how I can fix it? I could really use some help. Thanks!

hey mike, sounds like a dns issue. try using the fully qualified domain name instead of the ip address when setting the webhook. also, make sure your server’s firewall isn’t blocking incoming connections on the port you’re using for the webhook. good luck!

I ran into a similar problem when setting up my first Telegram bot. The issue might be that Telegram’s servers can’t resolve your IP address. Have you tried using a domain name instead? Even a free one from services like No-IP could work.

Another thing to check is your SSL certificate. Telegram is pretty strict about HTTPS, so make sure your self-signed cert is properly configured. I remember spending hours troubleshooting before realizing my cert wasn’t set up correctly.

Also, double-check that your webhook URL is correctly formatted and includes the ‘https://’ prefix. It’s a small detail, but it can cause headaches if missed.

If none of that helps, you might want to consider using a more up-to-date OS. Windows Server 2008 R2 is quite old and could be causing compatibility issues with newer Telegram API requirements.

I’ve encountered this problem before. The error suggests Telegram can’t resolve your IP address. Using an IP directly often doesn’t work well for webhooks. Instead, try setting up a domain name that points to your server’s IP. You can use free DNS services like No-IP or Afraid.org for this.

Also, ensure your server’s firewall allows incoming connections on the webhook port. Sometimes, the default Windows firewall settings can block these connections.

Lastly, verify that your SSL certificate is properly installed and that your web server is correctly configured to use HTTPS. Telegram is quite strict about secure connections.

If you’re still stuck, consider upgrading your server OS. Windows Server 2008 R2 is quite outdated and might not support some newer requirements for Telegram bots.