cURL command to set a Telegram chatbot's webhook

To receive Telegram callbacks you have to set the webhook.

curl -X "POST" "https://api.telegram.org/xxx/setWebhook" 
    -d '{"url": "https://yourapp.com/telegram/xxx"}'  
    -H 'Content-Type: application/json; charset=utf-8'

Replace xxx with the token which the Telegram Bot Father provided you.

Telegram recommends you to include your token as a path variable in the webhook's url.

If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/. Since nobody else knows your bot's token, you can be pretty sure it's us.

Tags: #telegram #chatbot
May 2021, 22.

 

My next events:
🗓 Jul 20 09:00 Workshop Security in the Micronaut Framework
🗓 Sep 20 09:00 JCON Online 2022 - Getting Started with the Micronaut Framework
🗓 Sep 23 09:00 JCON Online 2022 - Micronaut® Framework and Microstream Java-native persistence engine