How to use setwebhook in a telegram?

Hi, I am creating a bot in a telegram. I am sending an http request:
https://api.telegram.org/bot(mytoken)/setWebhook?url=https://mywebpagetorespondtobot

and I get the following:

{"ok":true,"result":true,"description":"Webhook was set"}

but it does not work. I mean, the telegram does not send updates to the server. Is it because I did not upload my certificate? How should I do it?

+6
source share
3 answers

Check if updates are being sent, first delete your web host

 https://api.telegram.org/bot(yourToken)/setWebhook 

Then launch your bot, enter a message and check

 https://api.telegram.org/bot(yourtoken)/getUpdates 


If you get updates, everything works fine. Make sure your script handles incoming updates correctly.

If you do not receive the update, there may be a problem with your certificate.
Self-signed certificates must first be loaded using the setWebhook method, as described here .

+4
source

I changed the setwebhook url to a and it worked. It does not seem to work with the wabepage url. https://api.telegram.org/bot(mytoken)/setWebhook?url=https://mywebpagetorespondtobot/mymethod '(WebMethod)

+2
source

This means that your public key is invalid.

You can check it at https://api.telegram.org/bot {token} / getWebhookInfo URL after installation

When I sent the wrong public key - I get

 {"ok":true,"result":{"url":"","has_custom_certificate":false,"pending_update_count":6}} 

but if I sent the correct public key, I get:

 {"ok":true,"result":{"url":"mycorrecturl.com","has_custom_certificate":true,"pending_update_count":6,"last_error_date":1506772578,"last_error_message":"SSL error {337047686, error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed}","max_connections":40}} 
+1
source

All Articles