You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何打开预加载文本消息的指定Telegram账号?相关链接有效性咨询

如何打开预加载文本消息的指定Telegram账号?

Hey there! Let's walk through this step by step—this is a super common use case with Telegram's built-in deep linking system, and your proposed links are actually spot-on.

核心实现逻辑

Telegram supports deep links that let you directly open a chat with a specific user/bot and pre-fill a message for the user to send. This works seamlessly across desktop, mobile apps, and the Telegram web interface.

你提供的两种链接是否有效?

Absolutely! Both formats are officially supported, just tailored for slightly different scenarios:

  • tg:// protocol link: This is designed to directly launch the local Telegram app (if it's installed on the user's device). The format you shared is correct:
    tg://resolve?domain={USER_NAME}&text=Hi, default message
    
    Replace {USER_NAME} with the target account's username (without the @ symbol). For example, if the account is @JaneSmith, the link becomes tg://resolve?domain=JaneSmith&text=Hi, default message.
  • https://t.me web/app link: This is a universal link that works across all devices—if the user has the Telegram app installed, it'll open the app; if not, it'll redirect to the Telegram web interface. Your format here is also correct:
    https://t.me/{USER_NAME}?text=Hi, default message
    
    Again, swap {USER_NAME} for the actual username (no @). For @JaneSmith, that would be https://t.me/JaneSmith?text=Hi, default message.

关键注意事项

  • URL-encode special characters: If your pre-filled text includes spaces, commas, question marks, or other special characters, you'll need to URL-encode them to avoid breaking the link. For example:
    • A space becomes %20
    • A comma becomes %2C
    • A question mark becomes %3F
      So the message Hi, how's it going? would become Hi%2C%20how%27s%20it%20going%3F, making the full link:
    https://t.me/JaneSmith?text=Hi%2C%20how%27s%20it%20going%3F
    
  • Bot vs. User accounts: These links work for both regular user accounts and Telegram bots—no extra setup needed as long as the target account has a public username.

内容的提问来源于stack exchange,提问作者H Aßdöü

火山引擎 最新活动