Anyway for setting Telegram Webhook without setting up https connection

守給你的承諾、 提交于 2019-12-09 12:24:46

问题


I want to setup Telegram Webhook but I don't have https URL, I don't want to deal with ssl certificates either.

Can I solve this problem by using https URL or without setting https certificate up?

Telegram webhook desc: https://core.telegram.org/bots/api#setwebhook


回答1:


https is mandatory but it doesn't mean you MUST set it up completely. You can use more more simple ways, let me explain:

You can connect your localhost server on your own PC or mac or linux machine, to telegram severs without setting any SSL Certificates. With using "ngrok.com Secure tunnels" you will have a https address that is mandatory for dealing with webhooks but no need to setup any SSL.

All steps you need (in PC):

1- Download ngrok.exe

2- Run in command line : "ngrok http 8888"

3- It is ready Now!

very simple,is not it

After running ngrok.exe it shows you somthing like: "https://abcd1234.ngrok.io" This is your temporary https that you can use as webhook. It is valid and belong to your bot until you close ngrok.exe( I even standby my computer without closing app and it remains for me-excellent)

Additionally with this app i have access to all messages that Telegram send to my bot and my bot api outputs (not include my sent message) as JSON show. You can access to these panel via http://localhost.com:4040 . This is a sample:




回答2:


You can't without a proper certificate, but it's now really easy to get one (and for free) : https://letsencrypt.org/getting-started/




回答3:


You have two options to get updates from telegram:

  1. Webhook, this method works over ssl only (yes, I agree with Tom - let's encrypt is awesome)
  2. getUpdates method, that work using long polling, this method does not require ssl. More info in API documentation: https://core.telegram.org/bots/api#getupdates



回答4:


You can take advantage of the Cloudflare Universal SSL to protect your endpoint with SSL. You don't have to deal with anything.



来源:https://stackoverflow.com/questions/37449252/anyway-for-setting-telegram-webhook-without-setting-up-https-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!