14

Hello I'm creating a bot in telegram. I send a http request:
https://api.telegram.org/bot(mytoken)/setWebhook?url=https://mywebpagetorespondtobot

and I receive this:

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

but It doesn't work.I mean telegram doesn't send updates to the server. Is this because I didn't upload my certificate?how should I do that then?

Danil Pyatnitsev
  • 2,172
  • 2
  • 26
  • 39
amir mola
  • 355
  • 1
  • 4
  • 17

4 Answers4

12

Check the status of your updates here:

https://api.telegram.org/botYOUR_TOKEN/getWebhookInfo

It will tell you about any errors. Should you not see any problems here the issue is to be found somewhere in your script. Make sure to handle incoming updates correctly.

It might be a problem with self-signed certificate. It needs to be uploaded via setWebhook method first as described here. Or try a more extensive guide here.

newsha
  • 1,288
  • 1
  • 10
  • 13
  • I deleted the webhook and getUpdates() worked fine.Maby the problem is with the certificate.I read the link but I don't know how to generate and send the pem file – amir mola Apr 28 '16 at 13:40
6

It's means what your public key incorrect.

You may check it by url https://api.telegram.org/bot{token}/getWebhookInfo after setting

When i sent incorrect public key - i receive

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

but if i sent correct public key, i receive:

{"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}}
Nikolas Sumrak
  • 100
  • 2
  • 7
5

I changed the setwebhook url to a and it worked.it seems that it doesn't work with a wabepage url. https://api.telegram.org/bot(mytoken)/setWebhook?url=https://mywebpagetorespondtobot/mymethod ' (the WebMethod)

amir mola
  • 355
  • 1
  • 4
  • 17
0
  1. BotFather -> Bot list -> API Token -> Revoke current token
  2. https://api.telegram.org/bot(New token)/setWebhook?url=https://myweb... Done)