Is it possible to have a Siri shortcut with a variable parameter?
Asked Answered
C

1

8

There are a dozen related actions that users of my app can perform, and I'd like to let them do it with Siri, but I'm unsure how to effectively do that. I know I can donate a INIntent when a user performs an action, but is it possible to donate an action with a customizable parameter? The user could, for example say "Perform action 1", 1 being the parameter. Would the user have to perform each of the 12 actions before they could do that with Siri? I also know it's possible to use NSUserActivity and INInteractions to make it easier for users to use Siri with an app, but I can't find any resources that will let me know if what I want to do is at all possible...

Chacon answered 13/11, 2018 at 21:14 Comment(1)
Did you find the solution for your problem? I'm also having this issue.Preter
O
2

It is not possible to have a variable parameter. Siri shortcuts are for actions, which are executed by the user, so all needed information should be available when donated. If you want to perform actions with different parameters, you have to donate for each of these actions.

You can also check this post in the apple developer forum about the same problem: https://forums.developer.apple.com/message/326487#326487

Ouse answered 22/11, 2018 at 14:9 Comment(5)
But how do apps like f.e. Things 3 have that?Gunthar
Please provide me a concrete example what Things 3 can do regarding to your problem. I do not have the app. But from their description, they do not have variable parameters from Siri.Ouse
It's basically the same as if you f.e. take a reminder shortcut. You get a card with fields where you can define f.e. that the user has to input something. So Things 3 is a 3rd party app and it can do something a first party app can do. But I haven't found out how...Gunthar
I have looked a little bit at an online article about Things. What I have understood from there, is that through the Siri Shortcut, a task is created inside the app. The view, which is presented to add information, should be in the application itself, and not in the "Siri view". The shortcut does not take any of these parameters from the spoken phrase. The spoken phrase just triggers the creation of a task. So basically, Things 3 is opened by a shortcut and recognizes that it was opened by a shortcut, so it can present you the necessary view to input the information.Ouse
In iOS 13 you can finally add parameters in shortcuts. You can look at the WWDC 2019 section for more details: developer.apple.com/videos/play/wwdc2019/213Mcgruder

© 2022 - 2024 — McMap. All rights reserved.