Replies: 4 comments
-
Hi, Have you follow this setup instructions to create self-signed certificates for the SSL/TLS connection, and add the needed information to settings.py file? https://github.com/J-Rios/TLG_JoinCaptchaBot#scalability-polling-or-webhook I don't know how Heroku works, but requirements for webhook are that it must has a static IP or domain for the machine/service where the Bot is running, and also allow to accept incoming connection from Telegram to the specified WEBHOOK_PORT on settings.py. Regarding ports, note that Telegram only support to use 443, 80, 88 or 8443, if you try to usé another one, It won't work. Regards. |
Beta Was this translation helpful? Give feedback.
-
I took a look on this information: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks#heroku And seems that for Heroku usage, you don't need to create your own certificates, and also heroku application is fixed to use a "PORT" environment variable for the webhook port, so some code modificación need to be done on joincaptchabot to support webhook connection with heroku... I will do that changes on Bot code when I get some time. |
Beta Was this translation helpful? Give feedback.
-
I've added to settings.py and to join_captch_bot.py It works |
Beta Was this translation helpful? Give feedback.
-
Ok, great! I have made some changes in the code to avoid any need to modify the joincaptchabot.py file. Now, the setup to use Heroku should only require to modify the next configurations in the settings.py file (or provide it as environment variables): # Bot Webhook Host address
"CAPTCHABOT_WEBHOOK_HOST": "https://<appname>.herokuapp.com/",
# Bot Webhook Host Port
"CAPTCHABOT_WEBHOOK_PORT": os_environ.get("PORT", "80"),
# Bot Webhook Certificate (must be None for Heroku)
"CAPTCHABOT_WEBHOOK_CERT" : None,
# Bot Webhook Certificate private key (must be None for Heroku)
"CAPTCHABOT_WEBHOOK_CERT_PRIV_KEY" : None,
# Optionally, to verify request from Telegram Server
# (don't use the Bot Token, for security reason it must be other)
"CAPTCHABOT_WEBHOOK_SECRET_TOKEN" : None, I don't have a Heroku account, so this is not tested, and could be nice is someone can verify that this is enough (currently only available in development branch). Best Regard :) |
Beta Was this translation helpful? Give feedback.
-
I deployed your amazing bot to heroku and set run_webhook, and when i run it i dont get telegram updates
Beta Was this translation helpful? Give feedback.
All reactions