Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

support new Telegram web apps

Open arsikurin opened this issue 2 years ago • 12 comments

Particularly, a new type of button, which opens a web app. (bot API 6) Example: https://t.me/DurgerKingBot

For more info: https://core.telegram.org/bots/webapps

arsikurin avatar Apr 16 '22 19:04 arsikurin

How I can to do a product menu as DurgerKingBot? DurgerKinBot is open source?

fr20587 avatar Apr 17 '22 14:04 fr20587

it is new in bot API 6. You can make similar interface with JavaScript

arsikurin avatar Apr 17 '22 14:04 arsikurin

you can see an example here: https://github.com/revenkroz/telegram-web-app-bot-example

arsikurin avatar Apr 17 '22 14:04 arsikurin

it is new in bot API 6. You can make similar interface with JavaScript

I can do a similar interface with a JS Framewors like Angular? and them implementing in Telegram?, excuse my ignorance, is that yesterday I saw DurgerKinBot video and I thought it was great

fr20587 avatar Apr 17 '22 14:04 fr20587

telegram has its own framework, I guess. (Have no experience with JS) Just look closely at the repository I mentioned in the last message

arsikurin avatar Apr 17 '22 14:04 arsikurin

aiogram supports it btw

arsikurin avatar Apr 17 '22 14:04 arsikurin

aiogram

Many thanks, for yours comments 👌

fr20587 avatar Apr 17 '22 14:04 fr20587

you can see an example here: https://github.com/revenkroz/telegram-web-app-bot-example

@arsikurin @fr20587 Thx, for simple example! Btw, I didnt understand from official docs two moments:

  1. Telegram WebApp- is it a common web app on Spring framework mb? Do you have any example of the Telegram WebApp, that you call in web_app.url button field?
  2. Where I need index.js with row <script src="https://telegram.org/js/telegram-web-app.js"></script>? I have my bot written with java8 & Spring 5, I dont have index.js file.
  3. I dont see official Git repo with @DurgerKingBot - https://t.me/durgerkingbot project, do you have link?
  4. I check your bot, in index.html see work logic via Telegram.WebApp. I have my bot on Java8/Spring5, how to copy your logic (Telegram.WebApp calls), to java code?

DmitryBobryakov avatar Apr 18 '22 07:04 DmitryBobryakov

you can see an example here: https://github.com/revenkroz/telegram-web-app-bot-example

@arsikurin @fr20587 Thx, for simple example! Btw, I didnt understand from official docs two moments:

  1. Telegram WebApp- is it a common web app on Spring framework mb? Do you have any example of the Telegram WebApp, that you call in web_app.url button field?
  2. Where I need index.js with row <script src="https://telegram.org/js/telegram-web-app.js"></script>? I have my bot written with java8 & Spring 5, I dont have index.js file.
  3. I dont see official Git repo with @DurgerKingBot - https://t.me/durgerkingbot project, do you have link?
  4. I check your bot, in index.html see work logic via Telegram.WebApp. I have my bot on Java8/Spring5, how to copy your logic (Telegram.WebApp calls), to java code?

It isn't my bot, actually. You should add web_app url to any button. It will open like web view application. This is how it is done in aiogram: types.InlineKeyboardButton("button name", web_app=types.WebAppInfo(url="https://example.com"))

arsikurin avatar Apr 18 '22 09:04 arsikurin

@arsikurin I undertood that, thx. The main point- do you have simple example of web app to call from web_app.url? Any framework- React/Angular/Spring Ui. I dont understand how to give answer to telegram bot and telegram itself, which calls web app by the button.

DmitryBobryakov avatar Apr 18 '22 10:04 DmitryBobryakov

@arsikurin I undertood that, thx. The main point- do you have simple example of web app to call from web_app.url? Any framework- React/Angular/Spring Ui. I dont understand how to give answer to telegram bot and telegram itself, which calls web app by the button.

it is explained in official docs

arsikurin avatar Apr 18 '22 10:04 arsikurin

Locking because it keeps getting offtopic comments. I'm leaving it open to track the implementation of this feature in the library, but the issues section is not for support on usage.

Lonami avatar Apr 18 '22 12:04 Lonami

v1.25 available in PyPi offers the new buttons through raw API.

Lonami avatar Sep 20 '22 13:09 Lonami