reo7sp / tgbot-cpp

C++ library for Telegram bot API
http://reo7sp.github.io/tgbot-cpp
MIT License
1.01k stars 245 forks source link

string webhookUrl(getenv("WEBHOOK_URL")); #284

Open Notorious-little opened 1 year ago

Notorious-little commented 1 year ago

Hi! please help me to use this method: what may i insert unstead of WEBHOOK_URL? i tried "https://api.telegram.org/", "https://api.telegram.org" - that does not works :( my bot just keeps silence. Thanks !

EugeneSmile commented 1 year ago

This have to be an address of your server: In case of webhook scheme, it is not you who request updates from Telegram server, but Telegram sends updates to you as soon as it has some. To do so, Telegram has no know where to send updates. And this is what webhook url is. There is really good instruction about webhook available on the Telegram website.

Notorious-little commented 1 year ago

Thank you! So, i did not fully understand everything that is written on the telegram website, but tired to do string webhookUrl("https://92.46.255.210:8443"); printf("Webhook url: %s\n", webhookUrl.c_str()); and it did not worked :(

As far as I understand, we should not make certificates when we use this tgbot-cpp library, and the goal is just to specify the correct string webhookUrl, isn't it ?

EugeneSmile commented 1 year ago

No, providing correct details to Telegram (your certificate in this case) is responsibility on your side, library cannot do this instead of you. In this case you have two options:

Notorious-little commented 1 year ago

Thanks for answer! Actually it seems that webhooks will not add much to the speed of the server, polling works well. Please tell me, how can i make the url-requests in an asynchronous way? So that my server is not blocked while waiting for a response and can process requests from several users at the same time