Siri not picking up app intent

Hello,

I have written the following app intent and I can access it via shortcuts. But I can't get Siri to pick it up. I want it to have a dynamic book title (which could be anything) so that the user can say "Add (bookname) to my (app name). I need it to work for ios 17.1 onwards. I have added siri as a capability for my ios app.

import AppIntents

struct AddBookToReadingListIntent: AppIntent {
    static var title: LocalizedStringResource = "Add my Book"
    
    @Parameter(title: "Book Title", requestValueDialog: "What's the title of the book you want to add?")
    var bookTitle: String
    
    static var parameterSummary: some ParameterSummary {
        Summary("Add my '\(\.$bookTitle)'")
    }
    
    func perform() async throws -> some IntentResult & ReturnsValue<String> {
        return .result(value: "Added '\(bookTitle)' to your app")
    }
}

struct AppShortcuts: AppShortcutsProvider {
    static var appShortcuts: [AppShortcut] {
        AppShortcut(
            intent: AddBookToReadingListIntent(),
            phrases: [
                "Add \(\.$bookTitle) in \(.applicationName)"
            ],
            shortTitle: "Add Book to app name",
            systemImageName: "book"
        )
    }
}

Hi, I got the same problem. If I use the phrases "Add book in (.applicationName)", It can pick up siri and ask the param of bookTitle. But if I use "Add (.$bookTitle) in (.applicationName)", it cant be used.

The system offers intents as App Intent Domains for books, so in general for your app, take a look at those intents as a starting point. That said, your specific example here for adding books to a reading list isn't covered by the books domain, so I suggest you file an enhancement request so we can consider adding support APIs an action like this in the future. If you do file that enhancement request, please post the FB number here.

Since your needs aren't covered by the books domain, that brings us to implementing your intent as a custom App Shortcut, which is where your code snippet shows. For App Shortcuts, open-ended string parameters, like the book title, are not available for use in the shortcut invocation phrase. So as @josh_yan said, you can create an App Shortcut with a phrase "Add book to (.applicationName) reading list", you can't have a phrase that includes the book title. You can request the book title as part of the intent's execution and requesting that parameter that way.

When your app is compiled, Xcode statically extracts the app intent information from your app so that when your app is installed, the system uses this data to show off your intents throughout the system, such as in the Shortcuts app. For an App Shortcut, the system is also able to use this extracted data to understand the possible phrases a person could ask Siri to invoke the App Shortcut for parameters that are finite, such as an AppEnum parameter. If you had multiple reading lists in your app, you could represent them as an AppEnum, and then you could have an App Shortcut invocation phrase that includes the name of the reading list. Since String parameters can contain anything (or even nothing!), there isn't anything that the system can statically extract for such a parameter to inform how users may use the App Shortcut phrase, since the realm of possibilities for a String parameter is infinite.

—Ed Ford,  DTS Engineer

Siri not picking up app intent
 
 
Q