Для PyTelegramBotApi работает следующее:
from flask import Flask, request
import telebot
from telebot import types
import time
secret = "GUID"
bot = telebot.TeleBot('TOKEN_TELEGRAM', threaded=False)
bot.remove_webhook()
time.sleep(1)
bot.set_webhook(url="https://YOURNAME.pythonanywhere.com/{}".format(secret))
app = Flask(__name__)
@app.route('/{}'.format(secret), methods=["POST"])
def webhook():
bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
print("Message")
return "ok", 200
@bot.message_handler(commands=['start', 'help'])
def startCommand(message):
bot.send_message(message.chat.id, 'Hi *' + message.chat.first_name + '*!' , parse_mode='Markdown', reply_markup=types.ReplyKeyboardRemove())
проверено на платном аккаунте