Telegram 机器人 - 将唯一密钥添加到 /start 命令

Telegram bot - add unique key to /start command

我试图通过添加到 /start 命令的一些唯一密钥来识别每个用户。对于每个用户,我将生成一些密钥,并向用户显示 URL。这个在官方文档中是一步步描述的 https://core.telegram.org/bots#deep-linking

Link 用户的格式为:

https://telegram.me/ExampleBot?start=uniqueKey

它在电报应用程序中完美运行。问题是,在浏览器中打开时,只有按钮 "Start" 可见。当用户单击时,uniqueKey 不会发送到机器人。

如何将 uniqueKey 添加到 /start 命令以使其在电报网络应用程序中也能正常工作?生成的应该是什么样子的URL? 这样用户就可以直接点击,而不需要写代码?

将您的 uniqueKey 设置为 Base64 并再次测试...

Based on Telegram documents it is recommended to using base64url to encode parameters with binary and other types of content.