tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
6.97k stars 1.43k forks source link

for Bot's Web App, is the main button implemented at client side? #2581

Closed vincentneo closed 1 year ago

vincentneo commented 1 year ago

I was looking at implementing to let users access web apps used in bot chats, when accessed via my client.

Testing using @DurgerKingBot from the link above, I am unable to see the web app's MainButton, so I am assuming it should be implemented from the client side, rather than it being a html button?

The url used for displaying the web app, is from the result of calling openWebApp in TDLib.

For visual context, I am referring to the green button on the bottom of the web app:

Official app:

screenshot of durger king web app running within Telegram for Mac.

Third party watchOS based client browser: screenshot of durger king web app running within Apple watchOS browser environment

pantojax23 commented 1 year ago

Va

El dom., 20 de agosto de 2023 4:47 a. m., Vincent Neo < @.***> escribió:

I was looking at implementing to let users access web apps https://core.telegram.org/bots/webapps used in bot chats, when accessed via my client.

Testing using @DurgerKingBot https://t.me/durgerkingbot from the link above, I am unable to see the web app's MainButton https://core.telegram.org/bots/webapps#mainbutton, so I am assuming it should be implemented from the client side, rather than it being a html button?

The url used for displaying the web app, is from the result of calling openWebApp in TDLib.

For visual context, I am referring to the green button on the bottom of the web app:

Official app: [image: screenshot of durger king web app running within Telegram for Mac.] https://user-images.githubusercontent.com/23420208/261843988-95fbd9e0-61e9-4591-b406-afcb9e9f0b67.png

Third party watchOS based client browser: [image: screenshot of durger king web app running within Apple watchOS browser environment] https://user-images.githubusercontent.com/23420208/261844071-79aaf8c4-68e9-4dd2-be18-2e1733bd2908.png

— Reply to this email directly, view it on GitHub https://github.com/tdlib/td/issues/2581, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB5YK32EJ3U5HTSWH372W5DXWHMLRANCNFSM6AAAAAA3XFJGN4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

levlam commented 1 year ago

Yes, the main button is added by the app. The Web App can control the main button by sending "web_app_setup_main_button" events to the application.

vincentneo commented 1 year ago

How does the TDLib based client receive the event though, is there a particular update that should be looked at?

levlam commented 1 year ago

The interaction is done directly between the Web App and the app as described in https://core.telegram.org/api/web-events#webviewproxy.

vincentneo commented 1 year ago

oh so basically it is communicated via javascript?

levlam commented 1 year ago

Yes.

vincentneo commented 1 year ago

Alright! Thanks for the clarification.