When you create a bot to serve your telegram clients you need to add a public url to that bot. Once you registered, when updates are available on our bot, our registered url(WebHook) will be called automatically.
Here I will show you the simplest way of how to set telegram bot webhook.
For this tutorial I am using the REST client postman for that, but you can do that with Insomnia and CURL
as well.
Open postman and make HTTP POST request to https://api.telegram.org/bot{Your_bot_token}/setWebhook
For Instance:
https://api.telegram.org/bot00000000:AAAAADFSFVVVSSSSRRRGGGAAASSS/setWebhook
Then, Provide a form-data URL with your public URL. You need to make sure to use the https one. After you’re all set click enter.

You should see response like this:
{
"ok": true,
"result": true,
"description":"Webhook was set"
}
That’s it!
Now if you enter the following URL on postman
https://api.telegram.org/bot{your_bot_token}/getWebhookInfo
In our case
https://api.telegram.org/bot00000000:AAAAADFSFVVVSSSSRRRGGGAAASSS/getWebhookInfo
you should see the following message.
{
"ok": true,
"result": {
"url": "https://fdbb70c515dc.ngrok.io",
"has_custom_certificate": false,
"pending_update_count": 0,
"max_connections": 40
}
}
2 Comments
booska · March 26, 2021 at 11:25 pm
it didnt work for when i did the POST request
{
“ok”: true,
“result”: true,
“description”: “Webhook is already deleted”
}
telegrama web · April 22, 2021 at 3:17 am
Gracias x la información, me ha sido muy util.