LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
9.88k stars 1.4k forks source link

Start param doesn't get passed to telegram mini app RequestWebViewRequest #4487

Closed irhamdz closed 3 days ago

irhamdz commented 3 days ago

Code that causes the issue

Hi i try to passing the start param using RequestWebViewRequest

bot = await self.tg_client.get_input_entity("seed_coin_bot")
app = InputBotAppShortName(bot_id=bot.user_id, short_name="app")
start_param = settings.REF_ID if settings.REF_ID else "441146600"

#Request app web view
web_view = await self.tg_client(
    RequestWebViewRequest(
        peer=bot,
        bot=bot,
        platform="android",
        from_bot_menu=False,
        url="https://cf.seeddao.org/",
        start_param=start_param,
    )
)
url = web_view.url

but when I check in the url, the start param given doesn't exists there, how to pass it ? or did i code it wrong? Thanks

Expected behavior

expecting there are some like start_param=xxxxx

Actual behavior

https://cf.seeddao.org/#tgWebAppData=query_id%3DAAHijlFRAwAAAOKOUVGBwkX6%26user%3D%257B%2522id%2522%253A7806750434%252C%2522first_name%2522%253A%2522Maria%2522%252C%2522last_name%2522%253A%2522Smith%2522%252C%2522language_code%2522%253A%2522id%2522%257D%26auth_date%3D1728971584%26hash%3D23fc8fb7ee577acc6d3ecaed188840a50388c7154bffe61187d19XXXXXXXXX&tgWebAppVersion=7.10&tgWebAppPlatform=android

i edited the last hash

Traceback

No response

Telethon version

1.37.0

Python version

3.10.14

Operating system (including distribution name and version)

Mac OS version 15.0

Other details

No response

Checklist

Lonami commented 3 days ago

Hi, this is not an issue with the library but rather a question. The issues section in GitHub is only to report bugs or enhancements in the library itself. If you have usage questions, you should ask those in StackOverflow or the @TelethonChat group.

You are also using raw API, which means the results you are getting come directly from Telegram, and Telethon is not changing them in any way (other than adapting some input parameters where needed, all while respecting the intended values). Unfortunately this means it's something Telethon cannot "fix" and it's just the way Telegram's API works.

To be frank, I have no idea how this works, but I do know all of the following exists:

and I suppose one of them will do what you need. But again no experience here.