Comments (10)
Okay thanks .... I need to reread the docs. You've cleared some things up for me. Thanks again. I think that you can close this issue..
from vue-telegram.
This is a Telegram limitation, you can only use Telegram.WebApp.sendData
if the web app was launched from custom keyboard:
https://core.telegram.org/bots/webapps#keyboard-button-mini-apps
Telegram.WebApp.initData === ""
is the way to check this.
from vue-telegram.
I did in fact launch it from a Keyboard Button
Mini Apps launched from a web_app type keyboard button can send data back to the bot in a service message....To transmit data from the user back to the bot, the Mini App can call the Telegram.WebApp.sendData method) which is the only way that allows for Telegram.WebApp.sendData
with the following code from the telethon library:
async def web_app_button(event):
bl = types.ReplyInlineMarkup([
types.TypeKeyboardButtonRow([
types.KeyboardButtonWebView('Test!', WEB_URL),
])])
await event.respond("Open URL below", buttons=bl)
Shouldn't you be checking that there is, in fact, a string in Telegram.WebApp.initData
?
from vue-telegram.
types.ReplyInlineMarkup
As I can see you are using inline keyboard, this is a different type of keyboard and it does not support Telegram.WebApp.sendData
.
You need to use types.ReplyKeyboardMarkup
to send custom keyboard.
from vue-telegram.
from vue-telegram.
This limitation is documented in the description of the sendData method:
https://core.telegram.org/bots/webapps#initializing-mini-apps
from vue-telegram.
from vue-telegram.
... yes, I've mixed up the two ... thank you.... if I continue to use the inline button, did you implement Bot API method answerWebAppQuery
that can be used with an inline button?
from vue-telegram.
answerWebAppQuery
is part of the Bot API and vue-tg
is not a Bot API library, so you need some Bot API library like aiogram to use this method:
https://docs.aiogram.dev/en/dev-3.x/api/methods/answer_web_app_query.html
List of libraries for Python to work with Bot API:
https://core.telegram.org/bots/samples#python
from vue-telegram.
But if you are looking for a way to pass data from web app to bot, answerWebAppQuery
method is not what you need.
For non-replykeyboard web apps, you need to send a POST request to server to transfer data, just like in a normal (non-Telegram) web app.
from vue-telegram.
Related Issues (20)
- Open mini app with Expanded Viewport HOT 4
- Is it possible to disable app close when swipe down? HOT 20
- Add `<PopupButton>` component
- Add ability to create refs for Cloud Storage
- Interactive playground for components
- InitData doesn't return correct values after page Refresh HOT 16
- Method showPopup is not supported in version 6.0 HOT 2
- Improve `<BiometricManager>` component
- Web Site with Documentation seems doesn't work HOT 2
- Documentation is unavailable HOT 1
- [Event] closing a mini app? HOT 1
- Bot API 7.7 HOT 2
- Is there a monitoring event for this
- is Telegram Bot Api 7.7 supported? HOT 1
- [Telegram.WebApp] Changing swipes behavior is not supported in version 7.6 HOT 1
- How to update useWebAppTheme params to make them work in Nuxt3? HOT 4
- Add `<ClosingConfirmation/>` component
- Add `<ExpandedViewport/>` component
- Integrate with nuxt 3 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-telegram.