Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Dynamic parameters in shortcuts

I need to have a dynamic parameter for Shortcuts, so a person can say something like Hey Siri, order a pizza with <insert app name here>

The parameter code in the appIntent is

@Parameter(title: "Title")
var itemName: String

In the Shortcut I use:

   AppShortcut(
        intent: NewItemIntent(),
        phrases: [
            "order \(\.$itemName) using \(.applicationName)"
        ],
        shortTitle: "Order Item",
        systemImageName: "sparkles"
    )

When I call it "hey Siri, order pizza using ***" where pizza should be passed via the parameter then handed off to the appintent. However, it ignores the spoken parameter in lieu of putting up a dialog asking "What's the name?" I can say "pizza" and it now works. How can I pick up the parameter without having to go to that second step as the code implies?

App Shortcuts do not support arbitrary string parameters in the invocation phrase. Please see the following other threads for some discussion about this:

— Ed Ford,  DTS Engineer

Thanks Ed for the input. There is a way after a fashion to allow flexible shortcuts and that is using AppEntities. We can create N shortcuts based on user input instead of having to settle for the 10 limit of fixed-predefined shortcuts. However, this works ONLY when the app is actually running. Different behavior from the standard fixed shortcuts which will launch the app if needed. If the app isn't running, then we're faced with the dilemma of the user having to do multiple actions therefore, instead of the single voice invocation which is severely limiting.

In other words, the user needs to be able to invoke a command in a single step with a user defined string at runtime.

You're correct that there are ways of configuring parameters that will work in an App Shortcut invocation phase. As one example, if you have an AppEnum for common order requests, you could have a case in the enum that represents "Today's Special Pizza" and another that is "My Usual Order", and then your app logic can resolve those to the specific pizza at the time of the order. It's just open-ended string parameters that aren't supported in an App Shortcut invocation phase.

— Ed Ford,  DTS Engineer

So what you are saying is that even though these look like shortcuts in the Shortcut app, they don't act like true shortcuts.

Dynamic parameters in shortcuts
 
 
Q