Contents

INSearchForMessagesIntent

A request to list the messages that match the specified criteria.

Declaration

class INSearchForMessagesIntent

Mentioned in

Overview

Siri creates INSearchForMessagesIntent objects when the user asks to see sent or received messages. You must implement this intent to support the reading of messages by Siri. This intent object contains the values for you to match when searching the user’s messages. Users can search for messages involving a specific person, messages with specific sent or received dates, or messages containing specific terms. When performing the search, use only the provided parameters, and ignore any that have no values.

To handle this intent, the handler object in your Intents extension must adopt the INSearchForMessagesIntentHandling protocol. Your handler confirms the request and creates an INSearchForMessagesIntentResponse object with the results of the search. For successful searches, Siri offers the user a way to launch your app and see the results.

To allow a user wearing AirPods to automatically hear messages, you must implement both INSearchForMessagesIntent and INSendMessageIntent. Add announcement to the options when calling requestAuthorization(options:completionHandler:). Finally, add allowAnnouncement to the category option and INSearchForMessagesIntent to the category intent identifier.

Additional Intent Attributes

Additional attributes of this intent object include the following:

Attribute

Description

Supported by

Siri Intents

Requires unlocked device

Yes, unless Show Previews is in an enabled state on the user’s device.

Apps can optionally ask the user to unlock the device before handling this intent. To require unlocking of the device, include the name of this class in the IntentsRestrictedWhileLocked key of your Intents extension’s Info.plist file.

Topics

Creating the Intent Object

Getting the Senders and Recipients

Getting the Search Criteria

Specifying Message Identifiers

Deprecated Symbols

Initializers

Default Implementations

See Also

Searching for Messages