Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] URL field of getBotCallbackAnswer is not processed #274

Open
IRuslan opened this issue Nov 24, 2023 · 5 comments
Open

[BUG] URL field of getBotCallbackAnswer is not processed #274

IRuslan opened this issue Nov 24, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@IRuslan
Copy link

IRuslan commented Nov 24, 2023

Describe the bug
Based on official documentation of the keyboardButtonCallback, once a button is pressed by the user, the getBotCallbackAnswer method should be called. And there is a expected response of messages.botCallbackAnswer type. One of options is URL to the bot itself via URL field. However WebK version of Telegram client abandon this option while the same configuration works correctly on iOS and Desktop application.

To Reproduce
Steps to reproduce the behavior (here we assume you have a own bot to interact with Telegram client):

  1. Use a bot to send inlineKeyboard with keyboardButtonCallback.
  2. Click on the button
  3. Bot receives callback query
  4. Bot sends a response in a form of messages.botCallbackAnswer with url and has_url fields accordingly to documentation
  5. Nothing happens on the client side

Expected behavior
Telegram client should switch the user to specified URL once messages.botCallbackAnswer received.

Desktop (please complete the following information):

  • Linux
  • Chrome
  • Version 113

Additional context
After quick overview, I have found a WebK source code responsible for processing of message field of the botCallbackAnswer. However there is nothing similar about url field.

Update:
I also found this works in Web A, there is a piece of code where exactly url field processed.

@IRuslan IRuslan added the bug Something isn't working label Nov 24, 2023
@morethanwords
Copy link
Owner

This will be implemented together with games.

@IRuslan
Copy link
Author

IRuslan commented Nov 25, 2023

I wonder if there is any roadmap or issue to track?

Also, just a feeling that this is a part related to bots functionality and partially to games. While other features related to bots working maybe it makes sense to treat it separately from games (sounds like a separate huge feature request).

@IRuslan
Copy link
Author

IRuslan commented Nov 27, 2023

Just as idea what need to be changed on line 4291 of buubles.ts.

if(typeof callbackAnswer.message === 'string' && callbackAnswer.message.length) {
  toast(wrapRichText(callbackAnswer.message, {noLinks: true, noLinebreaks: true}));
} else if(typeof callbackAnswer.url === 'string' && callbackAnswer.url.length) {
  window.open(callbackAnswer.url);
}

@morethanwords
Copy link
Owner

Just as idea what need to be changed on line 4291 of buubles.ts.

It's not that simple, see this. What do you need it for?

@IRuslan
Copy link
Author

IRuslan commented Nov 28, 2023

It's not that simple, see this.

Agree. I just was not aware if any similar implementation already exists in WebK version.

What do you need it for?

I want to build the following workflow for the bot:

  1. Bot send a message with inline button to Telegram group
  2. Telegram user presses the button
  3. Bot receives CallbackQuery event to provide initial processing
  4. Then based on results bot sets up a callbackAnswer to redirect user to DM with bot (Telegram API allows only this kind of URLs for callbackAnswer) to continue interaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants