NeuroAgent

Why Telegram Webhook Not Working on REG.RU

Complete guide to diagnosing and fixing Telegram webhook issues on REG.RU hosting. SSL, timeouts, and configuration checking.

Question

Why can’t Telegram call my webhook script?

Hello. I have a PHP bot hosted on REG.RU hosting. It previously worked correctly, but suddenly stopped receiving webhook requests from Telegram. The hosting support refuses to solve the problem, suggesting instead that I switch to a virtual dedicated server (VDS).

A similar situation has already occurred with another bot on this same hosting. After contacting technical specialists, they resolved the issue but didn’t explain the cause of the malfunction. All protective mechanisms and antivirus programming have been disabled.

Please advise what the problem might be and how to solve it?

NeuroAgent

Common Issues with Non-Working Telegram Webhooks on REG.RU Hosting

The issue with non-working Telegram webhooks on REG.RU hosting is a fairly common problem. The main reason is usually related to SSL certificates, timeouts, or request blocking at the hosting level. Telegram requires an HTTPS address for webhooks, and many problems arise specifically from incorrect SSL configuration or certificate expiration.

Contents


Main causes of non-working webhooks

The problem can be caused by several factors:

1. SSL certificate issues

  • Telegram requires mandatory use of HTTPS for webhooks
  • Certificate has expired
  • Certificate does not meet security requirements
  • Self-signed certificates are not accepted by Telegram

2. Timeouts on shared hosting

  • REG.RU may limit script execution time
  • Firewall blocks incoming requests
  • Server load causes delays

3. Incorrect webhook configuration

  • Incorrect URL in bot settings
  • Missing required headers in the response
  • Server routing issues

Important: According to the official Telegram Bot API documentation, the webhook must be accessible via HTTPS. If you’re using HTTP, Telegram will reject the request.


Step-by-step problem diagnosis

Step 1: Check the SSL certificate

Open your webhook URL in a browser and check:

  • Are there any security warnings
  • Does the site work without errors
  • Is the certificate valid
bash
# Check SSL certificate from command line
openssl s_client -connect your-domain.ru:443 -servername your-domain.ru

Step 2: Test webhook accessibility

Create a test script to check accessibility:

php
<?php
header('Content-Type: application/json');
echo json_encode(['ok' => true, 'result' => true, 'description' => 'Webhook test']);
?>

Step 3: Check hosting logs

Check access logs for requests from Telegram:

  • Look for entries with Telegram IP addresses (149.154.160.0/20)
  • Pay attention to response codes (200, 404, 503, etc.)

SSL certificate problem solutions

Option 1: Using Let’s Encrypt

A free and reliable option:

bash
# Install Certbot
sudo apt-get install certbot python3-certbot-apache

# Get certificate
sudo certbot --apache -d your-domain.ru

Option 2: Configuration through REG.RU panel

  1. Go to the hosting control panel
  2. Navigate to the “Domain Management” section
  3. Configure the SSL certificate
  4. Verify that port 443 redirects to your script

Option 3: Using Cloudflare

As Mozilla Developer Network explains, Cloudflare provides free SSL and speeds up performance:

  1. Connect your domain to Cloudflare
  2. Enable “Full (strict)” mode
  3. Configure HTTPS proxying

Configuration on the REG.RU side

.htaccess configuration

Add to the .htaccess file:

apache
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

<IfModule mod_php7.c>
    php_value max_execution_time 60
    php_value max_input_time 60
    php_value memory_limit 256M
</IfModule>

Check access permissions

Ensure the web server has access to the script:

bash
# Check permissions
ls -la /path/to/your/webhook.php
# Should be -rw-r--r--

Firewall configuration

Verify that Telegram IP addresses are not blocked:

bash
# Allow Telegram IP addresses
iptables -I INPUT -s 149.154.160.0/20 -j ACCEPT
iptables -I INPUT -s 91.108.4.0/22 -j ACCEPT
iptables -I INPUT -s 91.108.12.0/22 -j ACCEPT
iptables -I INPUT -s 91.108.56.0/22 -j ACCEPT

Alternative solution options

Option 1: Using ngrok for testing

For quick verification, you can use ngrok:

bash
# Install and run ngrok
./ngrok http 80

In the bot settings, use a URL like https://your-ngrok-id.ngrok.io/webhook.php

Option 2: Moving to a cloud solution

According to the official Telegram documentation, cloud services provide better stability:

  1. DigitalOcean
  2. AWS Lightsail
  3. Google Cloud Platform

Option 3: Using Telegram Mini Apps

As Telegram Mini Apps documentation explains, you can use built-in applications to bypass hosting limitations.


Conclusion

The main problems with webhooks on REG.RU are usually related to:

  1. SSL certificates - the most common cause
  2. Execution timeouts - shared hosting has limitations
  3. Firewalls and blocking - especially for new IP addresses

Recommended actions:

  1. First, check the SSL certificate
  2. Check logs for requests from Telegram
  3. Configure the correct response headers
  4. If the problem persists, consider moving to a VDS

For a temporary solution, you can use ngrok or cloud services. In the long term, moving to a VDS can actually solve most performance and availability issues.

Sources

  1. Official Telegram Bot API - SetWebhook
  2. Mozilla Developer Network - Cloudflare SSL Guide
  3. SSL Labs SSL Test
  4. Telegram Mini Apps Documentation
  5. REG.RU Hosting Documentation