Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Fixing Telegram Webhook Not Working Issue

3 min read
18.10.2025

Check Webhook Status

First, verify whether your webhook is set correctly.

Telegram Webhook Not Working
Telegram webhook silent fail — getWebhookInfo shows last_error.

For related webhook / HTTPS-cert / VPS-app topics, see cPanel Webhooks — Automating Actions in cPanel & WHM, depth_zero_self_signed_cert in SSL/TLS, and Running PHP WebSockets on Shared Hosting.

Run this command in your terminal:

curl -X GET "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo"

Expected response (if webhook is working):

{
  "ok": true,
  "result": {
    "url": "https://yourdomain.com/webhook.php",
    "has_custom_certificate": false,
    "pending_update_count": 0,
    "max_connections": 40
  }
}

If "url": "" appears, the webhook is not set. Proceed to Step 2.

Set Up the Webhook Again

If the webhook is missing, register it manually:

curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" -d "url=https://yourdomain.com/webhook.php"

Replace:

  • <YOUR_BOT_TOKEN> with your Telegram bot token.
  • https://yourdomain.com/webhook.php with your actual webhook URL.

Run getWebhookInfo again (Step 1) to verify the setup.

VDS for Telegram bot
VDS for bots running around the clock
  • 24/7 with no downtime
  • Fast deployment and management
  • NVMe disks
  • DDR5
Telegram bot

Check Webhook Response

Telegram requires a 200 OK response from your webhook. Run:

curl -X POST -d "test=1" https://yourdomain.com/webhook.php

If it doesn't return 200, check Step 4.

Fix Common Issues

SSL Certificate Issue (Telegram Requires HTTPS)

Run:

curl -v https://yourdomain.com/webhook.php

If it shows SSL certificate problem, install a valid SSL:

sudo certbot --apache

or

sudo certbot --nginx

Test again with curl -v.

Webhook URL Not Reachable

Ensure your webhook script is publicly accessible:

ping yourdomain.com

If there's no response, check firewall settings:

sudo ufw allow 443

Then restart your web server:

sudo systemctl restart apache2  # Apache
sudo systemctl restart nginx    # Nginx

Incorrect PHP Webhook Script

Check if your webhook.php correctly handles Telegram requests:

<?php
$data = json_decode(file_get_contents("php://input"), true);
file_put_contents("webhook.log", print_r($data, true), FILE_APPEND);
?>

Then check logs:

cat webhook.log

If nothing is logged, your server isn't receiving Telegram updates.

Try setting Telegram to long polling instead of webhooks:

curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates"

If updates appear, then Telegram is sending data, but your webhook isn't working.

Fixing Webhook Requires a Valid Response

Telegram needs a response within 5 seconds.

Modify webhook.php to send a quick response:

<?php
$data = json_decode(file_get_contents("php://input"), true);
file_put_contents("webhook.log", print_r($data, true), FILE_APPEND);
http_response_code(200);
echo json_encode(["status" => "OK"]);
?>

Test the webhook again!

Summary of Fixes

Issue Fix
Webhook not set Run setWebhook with the correct URL
SSL certificate issue Install SSL via certbot
Webhook URL unreachable Open port 443 and restart web server
PHP script not responding Ensure it sends a 200 OK response

Now your Telegram webhook should work!

Frequently asked questions
`curl 'https://api.telegram.org/bot/getWebhookInfo'` — shows url, has_custom_certificate, pending_update_count, last_error_date, last_error_message, max_connections, allowed_updates. The last_error_* fields tell you exactly what Telegram saw when trying to POST to your endpoint. Decisive most of the time.
Yes, but you must upload the cert as part of setWebhook (multipart form-data with `certificate` field pointing to the PEM file). Telegram pins that specific cert. If cert rotates, must update via setWebhook again. Easier: use Let's Encrypt for a real cert; Telegram doesn't need special handling.
`max_connections` default 40; if you set lower (1), Telegram serializes and may queue updates slowly. `allowed_updates` may exclude message types you want — empty array means defaults (most). For real-time bots, leave `max_connections` at default and don't restrict allowed_updates.
Call `deleteWebhook?drop_pending_updates=true` to clear the webhook + queue. Then your code calls `getUpdates` in a loop. Useful for debugging — you see updates without endpoint dependency. To re-enable webhook: `setWebhook` again. Telegram only delivers via one mechanism at a time.
Related articles
421-4.7.0 "Unusual Rate of Unsolicited Mail" Error
Fixing ERR_INVALID_RESPONSE in PHP — System Administrator's Guide
550-5.7.1 "Likely Unsolicited Mail" Error