Skip to content

Comments

Siri matching for non-Telegram Contacts with open chat and iOS Contact using peer id URL - bots allowed if all conditions met#2021

Open
huntharo wants to merge 2 commits intoTelegramMessenger:masterfrom
huntharo:siri-for-bot-ios-contacts
Open

Siri matching for non-Telegram Contacts with open chat and iOS Contact using peer id URL - bots allowed if all conditions met#2021
huntharo wants to merge 2 commits intoTelegramMessenger:masterfrom
huntharo:siri-for-bot-ios-contacts

Conversation

@huntharo
Copy link

Summary

Fixes #1960: allow Siri recipient resolution for Telegram bots (which cannot be Telegram contacts) by matching an iOS Contact URL that encodes the bot peer id.

What Changed

  • Kept existing Siri contact matching behavior for Telegram contacts/phone numbers.
  • Added a separate open-chat matcher for non-contact CloudUser peers in the root chat list.
  • Bot/open-chat matching only runs for device contacts that were not already matched by existing cloud-contact logic (to avoid changing already-matched behavior).

How To Use / Verify

  1. Create a Telegram bot with BotFather.
  2. Get the bot id from the HTTP token (the number to the left of :).
  3. Create an iOS Contact with a Siri-distinguishable first name (example: Cookie).
  4. In that contact, tap add url.
  5. Change the URL label from homepage to custom label Telegram (case-sensitive).
  6. Set URL to https://t.me/@id<bot_id> (example: https://t.me/@id12345678).
  7. Install this local Telegram build.
  8. Ensure there is an active DM/open chat with the bot in the root chat list.
  9. Say: Siri, message Cookie on Telegram
    Expected: Telegram opens with the correct bot target.
  10. Say: Siri, message Cookie
    Expected: also resolves correctly when the contact has no competing phone/contact data.
  11. With CarPlay Siri, message Cookie
    Expected: resolves correctly and sends the message

Security Concerns

Bots do not appear to be eligible to be saved as contacts in Telegram. This means we cannot signal that we want to be able to address a bot (e.g. an OpenClaw bot private to the user) by saving them as a Contact in Telegram.

Allowing arbitrary matches with any open bot conversation, or matching by @usernamebot, would be risky as it could lead to bots stealing conversations meant for other users, simply by changing their name or by a bot getting deleted and recreated by another owner with the same username.

Creating an iOS Contact with a Peer ID-specific URL is an intentional act that is a strong indication that the user wants to talk to this bot. This also gives it a name that will be stable that is outside of control of the bot or any other user on Telegram.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram with Siri on CarPlay cannot find the name of a bot to start messaging

2 participants