Closed svscorp closed 4 weeks ago
Hello again :)
a) The example bot doesn't do any of that; it's up to you how you want to implement it. Ultimately the webapp is just website, so you can decide if you want to do things dynamically clientside with APIs, or statically on the server side. If you really want things to go through telegram, you can use sendData, which will send a service message to the bot with the web_app_data
field. But then you would still need a way to send data from the server to the webapp, so thats another issue.
b) Sure. Again, it's up to your own implementation on how you want to display things. Probably easiest to use sendData for that specific case, unless you want the data to be shown IN the webapp, not the chat.
From your questions, I'm not sure if you've understood the difference between how bots and webapps work. Put simplyf, webapps really are just websites that know which user opened them - they're barely bots anymore. Hopefully that clarifies things.
Let me know if that answers your questions!
Hey @PaulSonOfLars,
I'm mastering WebApps. It's clear that they operate differently, of course. I've resolved this issue and created API version that uses webhook for bot itself, but also allow using a webapp, that is in somewhat connected to Telegram (i.e. Mini-App). I may add a PR later to show it as example, if relevant of course.
Thanks for your great work, Paul.
Hi @PaulSonOfLars ,
Me again. Have a question about webapp. In your webapp sample you demonstrated basic implementation, where: 1) /start is sent to the bot through telegram message 2) return is the webapp
My question is, how did you design further communication from WebApp to the server?
Actually two subquestions: a) What handler is used to handle queries sent from the webapp? b) And whether it is possible to handle similar command (i.e. som "history") both via the "/history" command through the chat message and "history" button on the webapp?
"history" here is an example functionality that returns some usage history