telegram-bot-ruby icon indicating copy to clipboard operation
telegram-bot-ruby copied to clipboard

set_webhook with certificate param

Open ssnake opened this issue 9 years ago • 4 comments

If use self-signed certificate and try to set web hook with following code: bot.api.set_webhook url: hook_url, certificate: File.open('telegram.pem') Things do not work. It doesn't upload certificate.

ssnake avatar Oct 28 '16 12:10 ssnake

It is said here that certificate should be instance of InputFile. It seems the gem doesn't support this type right now.
@atipugin what do you think about that? Can I submit PR to support InputFile type?

It's also said

Provide Telegram with an HTTP URL for the file to be sent.

So maybe you can upload telegram.pem some where on your server and make it public available. Then specify it's URL.

ivanovaleksey avatar Oct 28 '16 14:10 ivanovaleksey

Such method of setting webhook I took from here https://github.com/solyaris/BOTServer/blob/master/lib/webhook.rb#L48 I found solution: curl -F "url=https://<HOSTNAME>/webhooks/telegram" -F "certificate=@<FULL_PATH_TO_CERT.pem" https://api.telegram.org/bot<BOT_TOKEN>/setWebhook So I wonder if it's possible to set webhook via this gem.

ssnake avatar Oct 28 '16 14:10 ssnake

You can use certificate: Faraday::UploadIO.new('/path/to/cert') param for set_webhook method (see here: https://core.telegram.org/bots/api#setwebhook).

atipugin avatar Oct 29 '16 12:10 atipugin

and see also Telegram Platfporm Bot API 2.3.1 Marvin's Marvellous Guide to All Things Webhook

BTW, Thanks Alexander for your gem!

solyarisoftware avatar Jan 04 '17 10:01 solyarisoftware

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Feb 19 '23 15:02 github-actions[bot]

please take open the issue

solyarisoftware avatar Feb 19 '23 16:02 solyarisoftware

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 20 '23 17:04 github-actions[bot]