I am creating a Telegram bot and need to x-callback to another application.
This is my x-callback that opens VLC and streams a video. It works fine when I use it in Siri Shortcuts or in Safari. But I need it to work on Telegram chat conversation.
vlc-x-callback://x-callback-url/stream?url=https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4
When I send it as raw text it obviously doesn't recognize it as a valid url and does nothing.
I have tried to format it Markdown, MarkdownV2 and HTML styles but none works.
I've also tried InlineKeyboardButton giving it the text
and url
but it throws a BadRequest
error
telegram.error.BadRequest: Inline keyboard button url is invalid
Is there any workaround to x-callback from Telegram to another app?
My question is implementation independent, but here is my code using python-telegram-bot
from telegram import Update, ParseMode, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import CommandHandler, CallbackContext, Updater
my_x_callback = 'vlc-x-callback://x-callback-url/stream?url=https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4'
def test(update: Update, context: CallbackContext):
update.message.reply_text(my_x_callback)
update.message.reply_text(f'[Play it on VLC]({my_x_callback})', parse_mode=ParseMode.MARKDOWN)
update.message.reply_text(f'[Play it on VLC]({my_x_callback})', parse_mode=ParseMode.MARKDOWN_V2)
update.message.reply_text(f'<a href="{my_x_callback}">Play it on VLC</a>', parse_mode=ParseMode.HTML)
button = InlineKeyboardButton('Play it on VLC', url=my_x_callback)
update.message.reply_text(
'Testing InlineKeyboard',
reply_markup=InlineKeyboardMarkup([[button]])
)
if __name__ == '__main__':
updater = Updater('TOKEN')
updater.dispatcher.add_handler(CommandHandler('test', test))
updater.start_polling()
updater.idle()