How can I use a custom type with Siri Intent?

I want my user to be able to use my app with Siri Shortcuts to improve their automation workflow. My app lets users invite people to parties, and the Siri Shortcut I am creating let's users select a party and enter the guest's details to invite them. I would like the user to be able to tap Party and get displayed with a list of parties they have created in my app. Similar to how Contacts works in the Siri Shortcuts app. With the Select Contacts Shortcut, the user is able to tap Contact and get displayed a list of all of their contacts.


How can I do this in my app?

Replies

You can:

  • create an intent for "Show all parties"
  • create a custom type for "Party Details" with all the information you want the user to access (name, location, guests etc)
  • in the intent's response, add a response parameter that is an array of objects of the type "Party Details"

Thank you for your reply. I have created a custom intent called "Invite" that takes in a party and a list of contacts. I have also created a custom type called "Party." When I tap on "Party" in the Siri Shortcuts app, a view controller gets presented, however, an alert appears that says "Can't communicate with App." What am I doing wrong? Also, how can I supply the list of parties to Siri Shortcuts?

You would have to handle the intent using SiriKit. Please watch the WWDC videos from 2018 and 2019 to see how to implement Siri Intents extensions.