Siri not calling AppIntents

I am very new to App Intents and I am trying to add them to my On Device LLM ChatBot app so my users can get answers to any questions anywhere in iOS.

I have the following code and it is working wonderfully in the Shortcuts app.

import AppIntents

struct AskAi: AppIntent {
    static var openAppWhenRun: Bool = false
    static let title: LocalizedStringResource = "Ask Ai About"
    static let description = "Gets an answer from Ai for your question."
    
    @Parameter(title: "Question")
    var question: String
    
    static var parameterSummary: some ParameterSummary {
        Summary("Ask Ai About \(\.$question)")
    }
    
    @MainActor
    func perform() async throws -> some IntentResult & ReturnsValue<String> {
        let bot: Bot = Bot()
        await bot.respond(to: self.question)
        
        return .result(
            value: bot.output
        )
    }
}

class AppShortcuts: AppShortcutsProvider {
    static var appShortcuts: [AppShortcut] {
        AppShortcut(
            intent: AskAi(),
            phrases: [
                "Ask \(.applicationName) \(\.$question)",
                "Get \(.applicationName) answer for \(\.$question)",
                "Open \(\.$question) using \(.applicationName) ",
                "Using \(.applicationName) get help with \(\.$question)"
            ],
            shortTitle: "Ask Ai",
            systemImageName: "sparkles"
        )
    }
}

I can create a shortcut for this AppIntent and that allows me say speak the response.

I can call my shortcut via iOS 18 Beta 1 by the Shortcut name I set in the Shortcuts app and that allows it to work.

It does not work at all by just Asking Siri any of the phrases I have defined.

The info.plist has an app name alias defined just to be sure.

I even added the Siri capability in Xcode-beta.

I also tried using the ProvidesDialog return type too.

Whatever I do the AppIntent is invisible to Siri.

Siri tries to search the web, looking for my app name in the contacts or have an error Apple Cash which has nothing to do with what I was talking about.

Is there anything else I am missing for setting up iOS AppIntents to work with Siri?

Answered by HelloBlaine in 791343022

I found out what it was...

the Phrases just needed to be set without using my String Parameter "question"

This phrase fixed my issue: "Ask \(.applicationName)",

Confirmed that this also is not working with iOS 17 Siri either. so something likely isn't setup properly I'm just not sure what.

Accepted Answer

I found out what it was...

the Phrases just needed to be set without using my String Parameter "question"

This phrase fixed my issue: "Ask \(.applicationName)",

Hi @HelloBlaine ,

I have the same issue. But how can I then pass parameters immediately if the $question is not allowed?

Also the sample code from the AcceleratingAppInteractionsWithAppIntents example project shows exactly that this is the way to go.

 static var appShortcuts: [AppShortcut] {
        /**
         Records activity on a trail, such as hiking. On Apple Watch, `StartTrailActivity` creates a workout session.
         
         Use the `$workoutStyle` parameter from the intent to allow people to ask the app to start tracking an activity by the
         activity name. The system creates an App Shortcut for each possible value in the `ActivityStyle` enumeration. The complete set of
         generated App Shortcuts for this intent are visible in the Shortcuts app, or by following the `ShortcutsLink` at the bottom of
         `SidebarColumn`.
         */
        AppShortcut(intent: StartTrailActivity(), phrases: [
            "Track my \(\.$workoutStyle) in \(.applicationName)",
            "Start tracking my \(\.$workoutStyle) with \(.applicationName)",
            "Start a workout in \(.applicationName)",
            "Start a \(.applicationName) workout"
        ],
        shortTitle: "Start Activity",
        systemImageName: "shoeprints.fill")
        [....]
Siri not calling AppIntents
 
 
Q