pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

Weebhook on heroku dont working

Open andry-lebedev opened this issue 8 years ago • 4 comments

After deploying on heroku bot don't answer. Was trying as in example with flask.

  1. What version of pyTelegramBotAPI are you using? pyTelegramBotAPI==3.2.1
  2. What OS are you using? osx
  3. What version of python are you using? last one Its looks like all is ok, but bot is't responding. My code:
import os
import telebot
from flask import Flask, request


token = os.environ['TELEGRAM_TOKEN']

bot = telebot.TeleBot(token)


server = Flask(__name__)

#hadlers
#and in the end


@server.route("/", methods=['POST'])
    def getMessage():


   bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
        return "!", 200

@server.route("/")
def webhook():
    bot.remove_webhook()
    bot.set_webhook(url="https.com//somename.herokuapp.com/bot")
    return "!", 200

server.run(host="0.0.0.0", port=int(os.environ.get('PORT', 5000)))
server = Flask(__name__)

In the console on heroku I have: Running on http://0.0.0.0:16845/ (Press CTRL+C to quit)

andry-lebedev avatar Dec 06 '17 19:12 andry-lebedev

@WTFisThat1 I have the same error. I'm looking for a solution. We are waiting for the answer from the developer.

ghost avatar Dec 10 '17 17:12 ghost

Dose your getMessage() method receive any request?

eternnoir avatar Dec 11 '17 02:12 eternnoir

@eternnoir

@bot.message_handler(func=lambda message: True)
def delete_massage_user(message):
        bot.delete_message(message.chat.id, message.message_id)

At me here such method. Deletes all incoming messages in the supergroup. But it's not that. And the fact that the bot does not even run on Heroku.

ghost avatar Dec 11 '17 06:12 ghost

@WTFisThat1 you have not valid address in the set_webhook https.com//somename.herokuapp.com/bot and check getWebhookinfo

heyyyoyy avatar Jan 15 '18 21:01 heyyyoyy