---
title: INSearchForMessagesIntent
framework: intents
role: symbol
role_heading: Class
path: intents/insearchformessagesintent
---

# INSearchForMessagesIntent

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

## Declaration

```swift
class INSearchForMessagesIntent
```

## Mentioned in

Improving interactions between Siri and your messaging app

## Overview

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. important: To implement support for this intent fully, you must also implement support for the INSetMessageAttributeIntent class. After reading messages that your search returns, Siri marks them as read by modifying the attributes of the messages using that intent class. For more information about supporting the set message attribute intent, see INSetMessageAttributeIntent. 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:  |   |   |  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

- [init(recipients:senders:searchTerms:attributes:dateTime:identifiers:notificationIdentifiers:speakableGroupNames:conversationIdentifiers:)](intents/insearchformessagesintent/init(recipients:senders:searchterms:attributes:datetime:identifiers:notificationidentifiers:speakablegroupnames:conversationidentifiers:).md)

### Getting the Senders and Recipients

- [recipients](intents/insearchformessagesintent/recipients.md)
- [recipientsOperator](intents/insearchformessagesintent/recipientsoperator.md)
- [senders](intents/insearchformessagesintent/senders.md)
- [sendersOperator](intents/insearchformessagesintent/sendersoperator.md)
- [speakableGroupNames](intents/insearchformessagesintent/speakablegroupnames.md)
- [speakableGroupNamesOperator](intents/insearchformessagesintent/speakablegroupnamesoperator.md)

### Getting the Search Criteria

- [searchTerms](intents/insearchformessagesintent/searchterms.md)
- [searchTermsOperator](intents/insearchformessagesintent/searchtermsoperator.md)
- [dateTimeRange](intents/insearchformessagesintent/datetimerange.md)
- [attributes](intents/insearchformessagesintent/attributes.md)

### Specifying Message Identifiers

- [identifiers](intents/insearchformessagesintent/identifiers.md)
- [identifiersOperator](intents/insearchformessagesintent/identifiersoperator.md)
- [conversationIdentifiers](intents/insearchformessagesintent/conversationidentifiers.md)
- [conversationIdentifiersOperator](intents/insearchformessagesintent/conversationidentifiersoperator.md)
- [notificationIdentifiers](intents/insearchformessagesintent/notificationidentifiers.md)
- [notificationIdentifiersOperator](intents/insearchformessagesintent/notificationidentifiersoperator.md)

### Deprecated Symbols

- [init(recipients:senders:searchTerms:attributes:dateTimeRange:identifiers:notificationIdentifiers:speakableGroupNames:)](intents/insearchformessagesintent/init(recipients:senders:searchterms:attributes:datetimerange:identifiers:notificationidentifiers:speakablegroupnames:).md)
- [init(recipients:senders:searchTerms:attributes:dateTimeRange:identifiers:notificationIdentifiers:groupNames:)](intents/insearchformessagesintent/init(recipients:senders:searchterms:attributes:datetimerange:identifiers:notificationidentifiers:groupnames:).md)
- [groupNames](intents/insearchformessagesintent/groupnames.md)
- [groupNamesOperator](intents/insearchformessagesintent/groupnamesoperator.md)

### Initializers

- [init(recipients:senders:searchTerms:attributes:dateTime:identifiers:notificationIdentifiers:groupNames:)](intents/insearchformessagesintent/init(recipients:senders:searchterms:attributes:datetime:identifiers:notificationidentifiers:groupnames:).md)
- [init(recipients:senders:searchTerms:attributes:dateTime:identifiers:notificationIdentifiers:speakableGroupNames:)](intents/insearchformessagesintent/init(recipients:senders:searchterms:attributes:datetime:identifiers:notificationidentifiers:speakablegroupnames:).md)
- [init(recipients:senders:searchTerms:attributes:dateTimeRange:identifiers:notificationIdentifiers:speakableGroupNames:conversationIdentifiers:)](intents/insearchformessagesintent/init(recipients:senders:searchterms:attributes:datetimerange:identifiers:notificationidentifiers:speakablegroupnames:conversationidentifiers:).md)

### Default Implementations

- [INSearchForMessagesIntent Implementations](intents/insearchformessagesintent/insearchformessagesintent-implementations.md)

## Relationships

### Inherits From

- [INIntent](intents/inintent.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [INIntentSetImageKeyPath](intents/inintentsetimagekeypath.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Searching for Messages

- [INSearchForMessagesIntentHandling](intents/insearchformessagesintenthandling.md)
- [INSearchForMessagesIntentResponse](intents/insearchformessagesintentresponse.md)
