Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this support dual sided communication with Siri? #43

Closed
KinanKazmi opened this issue Apr 1, 2020 · 14 comments
Closed

Does this support dual sided communication with Siri? #43

KinanKazmi opened this issue Apr 1, 2020 · 14 comments

Comments

@KinanKazmi
Copy link

Suppose i want to create something that does this.
I register "create a data model" as a shortcut with Siri (already works).

User: "Hey siri, create a data model"
Siri: "Sure, select a model type"
User: "Model ABC"
=> Here Siri sends "Model ABC" to my app and i use some API to check on my server if that Model exists or if the user is allowed to choose that option and pass result back to Siri.
Siri: (if the app sends true response) : "Model added!" and opens the app.
Siri: (if the app sends false response) : "Sorry, that model doesn't exist Please select another!"

Something like this?

@Gustash
Copy link
Owner

Gustash commented Apr 1, 2020

This is somewhat related to #3.

As mentioned there, you need to create an extension on Xcode, and the JS bridge cannot run there. So unfortunately, for more complex scenarios like the one you presented, you'll have to do it in native.

It's probably better if you look up Apple's Documentation on it.

You can definitely use this for more straight forward tasks like opening a specific section of your app, or basically any kind of one-shot interaction that can be done with the app open.

@Gustash Gustash closed this as completed Apr 1, 2020
@KinanKazmi
Copy link
Author

Alright thanks!

@ovidiu-balau
Copy link

ovidiu-balau commented Aug 18, 2020

Is it possible to link an intent from XCode via the AddToSiri component?

@Gustash
Copy link
Owner

Gustash commented Aug 18, 2020

@ovidiu-balau these are the only properties the INUIAddVoiceShortcutButton takes. I assume that if it is possible, that you'd need to link your shortcut to an intent in Xcode

@tamirla
Copy link

tamirla commented Oct 27, 2020

@ovidiu-balau these are the only properties the INUIAddVoiceShortcutButton takes. I assume that if it is possible, that you'd need to link your shortcut to an intent in Xcode

@Gustash in my case I don't need dual side communication, since all my logic is done in native code, however I still want to able to add shortcut to custom intent using AddToSiriButton.

As explained in this article:

https://medium.com/@neobeppe/quick-win-for-you-app-add-to-siri-button-7f4badf38e92

button's shortcut can accept either NSUserActivity or CustomIntent, however checking the code of SiriButtonView.setShortcut, I see that it's always creating NSUserActivity, so I suppose it's currently not possible to add shortcut for custom intent without changing native code, however it looks like a simple change to support both options.

@tamirla
Copy link

tamirla commented Oct 27, 2020

@ovidiu-balau these are the only properties the INUIAddVoiceShortcutButton takes. I assume that if it is possible, that you'd need to link your shortcut to an intent in Xcode

@Gustash in my case I don't need dual side communication, since all my logic is done in native code, however I still want to able to add shortcut to custom intent using AddToSiriButton.

As explained in this article:

https://medium.com/@neobeppe/quick-win-for-you-app-add-to-siri-button-7f4badf38e92

button's shortcut can accept either NSUserActivity or CustomIntent, however checking the code of SiriButtonView.setShortcut, I see that it's always creating NSUserActivity, so I suppose it's currently not possible to add shortcut for custom intent without changing native code, however it looks like a simple change to support both options.

@Gustash sorry, just realized that CustomIntent in this sample code should be the Intent class I created in my extension, so I guess it will be more challenging to instantiate this class inside your code

@Gustash
Copy link
Owner

Gustash commented Oct 27, 2020

@tamirla Yeah, unfortunately since intents are custom classes, you'd need to extend this library's code on a case per case basis. Let me know if you need any help setting that up

@tamirla
Copy link

tamirla commented Oct 27, 2020

@Gustash ok. no problem, I'll do it & will let you know if I'll need any help. Thanks !

@sinclas
Copy link

sinclas commented Mar 19, 2021

Look like the best method is to create custom intent classes with parameters and implement everything in native for an existing RN app? Create the intent, plist changes, etc. for more complex interactions? If so, what would be the issues if developing that with the UI? -Thanks for this thread!

@Gustash
Copy link
Owner

Gustash commented Mar 22, 2021

@sinclas I don't think that would be a problem, very likely doable. It's just a logistic nightmare to have that as a supported feature of this package. I recommend people implement it themselves on a per-app basis, and use as much from this package as possible in order to simplify the implementation

@sinclas
Copy link

sinclas commented Mar 22, 2021 via email

@Gustash
Copy link
Owner

Gustash commented Mar 23, 2021

Not that I'm aware of, but the Apple docs aren't too bad

@shrshk
Copy link

shrshk commented Mar 23, 2021

Can we do something like what Google App on iOS does, for example:
Add a shortcut called open Assistant and do below
"Hey Siri, open assistant"
and Siri says "what do you want to ask assistant"
User: "how is the weather"
Google App opens and all subsequent interactions are handled there

I want to replicate this flow by doing all user voice interactions inside the app (with google web speech and dialog flow) but replicate above.

@neduck
Copy link

neduck commented Jul 9, 2021

@sinclas, were you able to configure? I have a strange error: the application ignores the handlerForIntent method in the AppDelegate and the Shortcut app submit error An unknown error occurred when I try to set a value for a dynamic property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants