INSendMessageIntent has no recipients when replying to a message provided by INSearchForMessagesIntentHandling

INSendMessageIntent has no recipient when replying to a message provided by INSearchForMessagesIntentHandling provider.

A user would expect that if Siri just read them a message from an app implementing INSearchForMessagesIntentHandling that they would be able to reply directly without having to look up the recipient.

When handling INSearchForMessagesIntentHandling I find the messages in my local DB and create INMessage objects that have INPerson objects embedded in them. We have our own internal contacts, so I fill out the INPerson object as follows:

INPerson(
                    personHandle: INPersonHandle(value: "Name", type: .unknown),
                    nameComponents: nil,
                    displayName: "Name",
                    image: nil,
                    contactIdentifier: nil,
                    customIdentifier: "localContactIdentifier"
                )

After reading every conversation Siri asks "Would you like to reply?", and if the user answers in the affirmative, Siri always answers "To who?" because my INSendMessageIntentHandling.resolveRecipients never gets any recipients.

I have attempted to donate all of my contacts using INVocabulary.shared().setVocabulary but that didn't help.

Replies

The empty recipient filed is expected for the INSendMessageIntent that Siri sends as a reply. Instead, the intent has conversationIdentifier field populated that identifies the specific conversation the reply has to go to: https://developer.apple.com/documentation/sirikit/insendmessageintent/2866586-conversationidentifier

The idea behind this is that recipient list may be ambiguous which would be a problem for reply use case, hence the use of the conversation ID. The source of this ID is the actual message that Siri read - INMessage.conversationIdentifier that was provided by the app as part of INSearchForMessagesIntent response: https://developer.apple.com/documentation/sirikit/inmessage/2867834-conversationidentifier

So your app should make sure to resolve conversationIdentifier parameter on the INSendMessageIntent and populate the intent object with the correct recipient list or a group name (“speakableGroupName”) for the conversation identified by the conversationIdentifier