I am writing a bot for Telegram using the python-telegram-bot library. I am connecting mini app to it. The application starts and can even receive data from the bot, but for some reason the data does not pass in the opposite direction: tg.sendData is called in the mini application, but the message handler in the bot is not called.
Update: I've explored various examples and implementations of mini-apps and discovered that replacing InlineKeyboardButton
with KeyboardButton
and InlineKeyboardMarkup
with ReplyKeyboardMarkup
makes data transmission work. Does this mean that InlineKeyboardButton
cannot be used to launch mini-apps? However, I’ve seen bots that launch mini-apps using InlineKeyboardButton
. Does this imply that additional steps are required to make it work with inline buttons?
The bot code:
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, WebAppInfo
from telegram.ext import Application, CommandHandler, MessageHandler, ContextTypes, filters
from telegram_token import TELEGRAM_TOKEN
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
keyboard = [
[InlineKeyboardButton(
"