Creating a Continuous Conversation with Siri Using App Intents

Hello,

I am working on an app that uses App Intents to enable users to interact with Siri. Here is the code I'm using:


struct SiriPassMeLuna: AppIntent {
    
    static var title: LocalizedStringResource = "Pass me Luna"
    static var description = IntentDescription("Lets you query Luna and receive a response.")
        
    @Parameter(title: "Phrase")
    var phrase: String?
    
    
    func perform() async throws -> some IntentResult {
        guard let providedPhrase = phrase else {
            throw $phrase.needsValueError("What do you need help with?")
        }
        
        let request = Request()
        let reply = request.sendRequest(transcription: providedPhrase)
        return .result(dialog: "\(reply)")
    }
}

struct SiriAppShortcuts: AppShortcutsProvider {
     static var appShortcuts: [AppShortcut] {
         AppShortcut(
             intent: SiriPassMeLuna(),
             phrases: ["Pass me \(.applicationName)"]
         )
     }
}

My goal is to create a continuous conversation with Siri, where the user can speak to the intent, and then the intent keeps listening and replying without the user having to invoke Siri and the intent each time.

Is there a way to achieve this behavior, so that the conversation with Siri is more seamless, and the user doesn't have to repeatedly say "Hey Siri" followed by the intent name?

Any guidance or suggestions would be greatly appreciated. Thank you!

Replies

create, share, open shortcut. may help you