Open rodnoycry opened 4 months ago
Thanks for the issue.
We found it not really long time ago. The problem is Telegram has 2 formats of sharing links, both of them doesn't work in some specific Telegram applications.
Related fresh issues: — Telegram Web K: https://github.com/morethanwords/tweb/issues/327 — Telegram for iOS: https://github.com/TelegramMessenger/Telegram-iOS/issues/1415
Oh, got it, thank you. Should I also add reproduction in these opened issues?
No. We are just waiting for the repositories owners to fix the problem
I have rolled out an update with the link changed, check out @tma.js/sdk@2.5.1
. Not closing the issue until the Telegram team fixes the problem on their side.
Telegram Application
Telegram for Android, Telegram for iOS, Telegram Desktop
Describe the Bug
shareURL
method creates link in the next format:Which should trigger share modal in the app according to official documentation of the Share links API. The thing is - this format works correctly only if link was opened outside of the telegram app, for example this link:
https://t.me/share?url=google.com
Will show share modal after redirecting to the app if was clicked in the web environment. But if you copy this exact link to the Telegram app and send it - the same link will give the next error (tested on Windows Desktop, iOS and Android app):
This is probably happening because Telegram thinks that t.me/share is actual link to the user with "@share" username, when link in such format used in the Telegram application
The same problem happened when I tried to use
shareURL
method inside my Telegram Mini App. I got error that user was not foundTo make link work you actually need to use this format:
With the additional
/url
part. Links in this format behaves correctly, you can check it out both inside and outside of the Telegram app:https://t.me/share/url?url=google.com
P.S. Links, that use
tg://msg_url
variation of links which are also described in docs and looks like this:Work as expected, but it's not possible to use links in this format in Telegram Mini App
To Reproduce
Steps to reproduce the behavior:
const [utils] = initUtils();