# How Telegram Integrates Siri Shortcuts and SiriKit on iOS

> Discover how Telegram iOS integrates Siri Shortcuts and SiriKit. Learn about its dedicated Intents extension for seamless messaging and calls on your iPhone.

- Repository: [TelegramMessenger/Telegram-iOS](https://github.com/TelegramMessenger/Telegram-iOS)
- Tags: how-to-guide
- Published: 2026-04-07

---

**Telegram iOS implements Siri Shortcuts and SiriKit through a dedicated Siri Intents extension that handles standard intents like sending messages and starting calls using temporary sandboxed accounts, while the main app manages authorization and user preferences through specialized settings controllers.**

Telegram's iOS client leverages Apple's SiriKit framework to enable voice-activated messaging and shortcuts, implementing a multi-layered architecture that separates authorization, intent definition, and runtime handling across distinct bundles within the **TelegramMessenger/Telegram-iOS** repository. The integration spans the main application, a separate Siri Intents extension, and shared preference modules that synchronize user settings between the app and the extension.

## Authorization Flow and System Setup

The integration begins with explicit user authorization managed in [`submodules/TelegramUI/Sources/AppDelegate.swift`](https://github.com/TelegramMessenger/Telegram-iOS/blob/main/submodules/TelegramUI/Sources/AppDelegate.swift). During app initialization, the `AppDelegate` injects two critical closures into the shared `AccountContext` between lines 911 and 923:

```swift
requestSiriAuthorization: { completion in
    if #available(iOS 10, *) {
        INPreferences.requestSiriAuthorization { status in
            completion(status == .authorized)
        }
    } else {
        completion(false)
    }
},
siriAuthorization: {
    if #available(iOS 10, *) {
        switch INPreferences.siriAuthorizationStatus() {
        case .authorized:   return .allowed
        case .denied, .restricted: return .denied
        default:            return .notDetermined
        }
    } else {
        return .denied
    }
},

```

These closures enable the Siri Intents extension to check current permission status (`siriAuthorization`) and trigger the system permission prompt (`requestSiriAuthorization`) when needed. The app also declares the required `NSSiriUsageDescription` key in `Telegram/Telegram-iOS/Info.plist` to satisfy App Store review requirements for Siri access.

## Intent Definition and Extension Architecture

Telegram exposes both standard and custom intents through an **Intent Definition File** located at `Telegram/SiriIntents/en.lproj/Intents.intentdefinition`. This `.intentdefinition` file is compiled into a separate SiriIntents bundle that defines custom intents such as `SelectFriendsIntent` and `SelectAvatarFriendsIntent`.

The extension entry point is [`IntentHandler.swift`](https://github.com/TelegramMessenger/Telegram-iOS/blob/main/IntentHandler.swift), which subclasses `INExtension` and routes incoming intents to specialized handlers:

```swift
@objc(IntentHandler)
class IntentHandler: INExtension {
    override public func handler(for intent: INIntent) -> Any {
        if #available(iOSApplicationExtension 12.0, *) {
            if intent is SelectAvatarFriendsIntent { return AvatarsIntentHandler() }
            else if intent is SelectFriendsIntent { return FriendsIntentHandler() }
            else { return DefaultIntentHandler() }
        } else {
            return DefaultIntentHandler()
        }
    }
}

```

The `DefaultIntentHandler` class implements the core SiriKit protocols including `INSendMessageIntentHandling`, `INSearchForMessagesIntentHandling`, and `INStartCallIntentHandling`.

## Runtime Handling with Temporary Accounts

When Siri invokes an intent, the extension must access Telegram's messaging APIs without compromising the main app's security sandbox. The handler creates a **temporary Telegram account** using `AccountManager` and `ValueBoxEncryptionParameters`:

```swift
let account: Signal<Account?, NoError> = currentAccount(
    allocateIfNotExists: false,
    networkArguments: NetworkInitializationArguments(...),
    supplementary: true,
    manager: accountManager,
    rootPath: rootPath,
    auxiliaryMethods: accountAuxiliaryMethods,
    encryptionParameters: encryptionParameters)

```

Once the account signal resolves, the handler executes the intent. For message sending, the implementation resolves recipients and forwards the request to core Telegram APIs:

```swift
func handle(send intent: INSendMessageIntent,
            completion: @escaping (INSendMessageIntentResponse) -> Void) {
    
    resolveRecipients(for: intent) { recipients in
        let message = OutgoingMessage(
            peerId: recipients.first!.peerId,
            text: intent.content?.text ?? ""
        )
        self.accountPromise.set(.single(account))
        account?.sendMessage(message).start(completed: {
            completion(INSendMessageIntentResponse(code: .success, userActivity: nil))
        })
    }
}

```

This architecture ensures Siri-initiated actions respect the user's **TL-settings**, privacy preferences, and session state by utilizing the same networking stack as the main application.

## Siri Shortcuts and Share Sheet Configuration

Beyond voice intents, Telegram registers **Siri Shortcuts** that appear in the iOS Share Sheet. User preferences for these shortcuts are managed through [`IntentsSettings.swift`](https://github.com/TelegramMessenger/Telegram-iOS/blob/main/IntentsSettings.swift), a `Codable` struct that persists configuration data to `ApplicationSpecificSharedDataKeys.intentsSettings`.

The `IntentsSettingsController` (located in `submodules/SettingsUI/Sources/Data and Storage/IntentsSettingsController.swift`) provides the UI for toggling specific suggestion categories:

```swift
func toggleContacts(_ enabled: Bool) {
    updateSettings { $0.withUpdatedContacts(enabled) }
}

```

Users can enable or disable suggestions for **Contacts**, **Saved Messages**, **Private Chats**, and **Groups**. The `IntentHandler` reads these settings at runtime to filter which conversations appear in Siri's suggestion lists.

## Build System and Entitlements

The Siri Intents extension is conditionally compiled based on the `isSiriEnabled` flag exposed in [`submodules/BuildConfig/PublicHeaders/BuildConfig/BuildConfig.h`](https://github.com/TelegramMessenger/Telegram-iOS/blob/main/submodules/BuildConfig/PublicHeaders/BuildConfig/BuildConfig.h). The Bazel build configuration in `Telegram/BUILD` defines a separate target for the extension:

```bazel
srcs = ["SiriIntents/**/*.swift", "SiriIntents/*.lproj/Intents.intentdefinition"]
bundle_id = "{telegram_bundle_id}.SiriIntents"

```

The extension requires specific entitlements (`ph.telegra.Telegraph.SiriIntents`) which are verified during the build process via [`build-system/verify.sh`](https://github.com/TelegramMessenger/Telegram-iOS/blob/main/build-system/verify.sh). This ensures the Siri Intents target is correctly signed with the necessary capabilities to run as an app extension.

## Summary

- **Telegram iOS** implements Siri Shortcuts and SiriKit through a separate extension target that communicates with the main app via shared authorization closures and preference stores.
- The **IntentHandler** class routes Siri requests to specialized handlers that implement standard SiriKit protocols for messaging and search.
- Runtime execution uses **temporary sandboxed accounts** created through `AccountManager`, ensuring secure access to Telegram's core APIs without compromising the main app's data.
- User preferences for Siri suggestions are managed through **IntentsSettings** and exposed via a dedicated settings controller that controls Share Sheet behavior.
- The build system verifies **SiriIntents entitlements** and conditionally includes the extension based on the `isSiriEnabled` configuration flag.

## Frequently Asked Questions

### How does Telegram check if the user has granted Siri permission?

Telegram checks Siri authorization status through the `siriAuthorization` closure injected into `AccountContext` during `AppDelegate` initialization. This closure wraps `INPreferences.siriAuthorizationStatus()` and returns an enum value indicating whether Siri access is allowed, denied, or not determined. The extension can query this status without directly accessing `INPreferences` itself.

### What specific actions can users perform through Siri in Telegram?

According to the `IntentHandler` implementation in [`Telegram/SiriIntents/IntentHandler.swift`](https://github.com/TelegramMessenger/Telegram-iOS/blob/main/Telegram/SiriIntents/IntentHandler.swift), Telegram supports standard SiriKit intents including sending messages (`INSendMessageIntent`), searching message history (`INSearchForMessagesIntent`), and starting voice calls. The app also defines custom intents in `Intents.intentdefinition` for selecting friends and avatars specifically for Siri interactions.

### How does the Siri extension access Telegram messages without storing passwords?

The extension creates a **temporary account** using `currentAccount(allocateIfNotExists:supplementary:)` which loads existing session credentials from the keychain and encrypted database files. This approach allows the Siri process to access the Telegram network stack and send messages using the active session, without requiring the user to authenticate again or exposing persistent account state to the extension's sandbox.

### Where does Telegram store user preferences for Siri Shortcuts suggestions?

Siri Shortcuts preferences are stored in a `Codable` struct called `IntentsSettings`, defined in [`submodules/TelegramUIPreferences/Sources/IntentsSettings.swift`](https://github.com/TelegramMessenger/Telegram-iOS/blob/main/submodules/TelegramUIPreferences/Sources/IntentsSettings.swift). The settings persist to `ApplicationSpecificSharedDataKeys.intentsSettings` and control which chat types (contacts, groups, saved messages) appear in Siri suggestions and the Share Sheet interface.