The "right" way to add parameters to Siri voice operations

In this thread, I asked about adding parameters to App Shortcuts. The conclusion that I've drawn so far is that for App Shortcuts, there cannot be any parameters in the prompt, otherwise the system cannot find the AppShortcutsProvider. While this is fine for Shortcuts and non-voice interaction, I'd like to find a way to add parameters to the prompt. Here is the scenario:

My app controls a device that displays some content on "pages." The pages are defined in an AppEnum, which I use for Shortcuts integration via App Intents. The App Intent functions as expected, and is able to change the page based on the user selection within Shortcuts (or prompted if using the App Shortcut). What I'd like to do is allow the user to be able to say "Siri, open <Page Name> with <my app name>."

So far, The closest I've come to understanding how this works is through the .intentsdefinition file you can create (and SiriKit in general), however the part that really confused me there is a button in the File Editor that says "Convert to App Intent." To me, this means that I should be able to use the app intent I've already authored and hook that into Siri, rather than making an entirely new function/code-block that does exactly the same thing. Ideally, that's what I want to do.

What's the right way to define this behavior?

p.s. If I had to pick an intent schema in the context of AssistantSchemas, I'd say it's closest to the "Open File" one, if that helps. I'd ultimately like to make the "pages" user-customizable so in the long run, that would be what I'd do.

Answered by bondad in 820968022

Hey @DustinKazi,

App Shortcuts can be parameterized, they just can't be open ended (like an Int or String for example). In your situation, defining set values at whatever granularity makes sense for your app as AppEnum cases could work for your SetBrightnessIntent.

Check out this clip from WWDC23 – Spotlight your app with App Shortcuts.

App Shortcuts supports parameters that have a fixed set of well-known parameter values that you can specify to Siri ahead of time. They do not support open-ended values like "Search my app for X," where X can be any input from the user. You can use parameters that are App Enums, in which case, the values are known ahead of time, or you could use parameters that are App Entities to be fully dynamic. All you need to do is return a list of entities in your query via suggestedEntities, like in my app.

This whole session from WWDC24 is great too – Bring your app's core features to users with App Intents.

An important distinction is that an App Shortcut is a higher level wrapper around an App Intent. And a parameterized App Shortcut is only valid with the parameter types mentioned above. That being said, you can still create an App Intent with an open ended parameter type. Any valid app intent can be exposed as an action building block for users in the Shortcuts app. The limitation is just around what intents can be used in a developer pre-defined App Shortcut.

re: SiriKit - this framework predates App Intents and is only relevant today if your app aligns with one of the predefined SiriKit domains. If you were looking to create a custom SiriKit intent, then you should just start with App Intents.

Accepted Answer

Hey @DustinKazi,

App Shortcuts can be parameterized, they just can't be open ended (like an Int or String for example). In your situation, defining set values at whatever granularity makes sense for your app as AppEnum cases could work for your SetBrightnessIntent.

Check out this clip from WWDC23 – Spotlight your app with App Shortcuts.

App Shortcuts supports parameters that have a fixed set of well-known parameter values that you can specify to Siri ahead of time. They do not support open-ended values like "Search my app for X," where X can be any input from the user. You can use parameters that are App Enums, in which case, the values are known ahead of time, or you could use parameters that are App Entities to be fully dynamic. All you need to do is return a list of entities in your query via suggestedEntities, like in my app.

This whole session from WWDC24 is great too – Bring your app's core features to users with App Intents.

An important distinction is that an App Shortcut is a higher level wrapper around an App Intent. And a parameterized App Shortcut is only valid with the parameter types mentioned above. That being said, you can still create an App Intent with an open ended parameter type. Any valid app intent can be exposed as an action building block for users in the Shortcuts app. The limitation is just around what intents can be used in a developer pre-defined App Shortcut.

re: SiriKit - this framework predates App Intents and is only relevant today if your app aligns with one of the predefined SiriKit domains. If you were looking to create a custom SiriKit intent, then you should just start with App Intents.

@bondad's answer above is very good (thank you @bondad!). I want to add to it in the context of the Assistant schemas.

p.s. If I had to pick an intent schema in the context of AssistantSchemas, I'd say it's closest to the "Open File" one, if that helps.

Without knowing what your apps does, there's also a word processor schema, or a reader schema. Hopefully you did see those and saw that they weren't a match, so I'm just making sure you saw those exist.

If your app naturally fits within a schema for one of your needs, that opens up more flexibility beyond App Shortcuts. But if there isn't a schema that fits your needs well right now, then @bondad has the right info for you above.

—Ed Ford,  DTS Engineer

The "right" way to add parameters to Siri voice operations
 
 
Q