I set my telegram bot webhook, but do not send the telegram. Why?

mohammad picture mohammad · Apr 20, 2017 · Viewed 8.8k times · Source

I set webhook my telegram bot with setwebhook method but when I send a message in bot don't take this in my URL.

    https://api.telegram.org/bot<token>/setwebhook?url=https://www.example.com/bot/temp.php

In my host I use PHP language for take and analysis and answer that. and I user this command for get updates from bot.

    $update = file_get_contents(“php://input”);

But after run this line $update is empty. I haven't problem with take updates without setwebhook bot when I use webhook don't take data.

result run getWebhookinfo is:

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

Do I have to be true "has_custom_cere"? Thanks for help me

Answer

Sean picture Sean · Apr 20, 2017

You can find out problem via following method:

Check getWebhookInfo method, make sure your webhook URL is correct, and no last_error_message field.

POST similar data to your server, here is some data you can use in curl -d JSON, just copy it and run on your own server.

At last, check your CDN config (if you had applied on that server), temporary disable flooding or any check.