---
title: "init(recipients:senders:searchTerms:attributes:dateTimeRange:identifiers:notificationIdentifiers:speakableGroupNames:)"
framework: intents
role: symbol
role_heading: Initializer
path: "intents/insearchformessagesintent/init(recipients:senders:searchterms:attributes:datetimerange:identifiers:notificationidentifiers:speakablegroupnames:)"
---

# init(recipients:senders:searchTerms:attributes:dateTimeRange:identifiers:notificationIdentifiers:speakableGroupNames:)

Creates a search messages intent object with the specified search criteria.

## Declaration

```swift
convenience init(recipients: [INPerson]?, senders: [INPerson]?, searchTerms: [String]?, attributes: INMessageAttributeOptions = [], dateTimeRange: INDateComponentsRange?, identifiers: [String]?, notificationIdentifiers: [String]?, speakableGroupNames: [INSpeakableString]?)
```

## Parameters

- `recipients`: The recipients of the messages. You can specify multiple people to search for messages received by multiple users.
- `senders`: The senders of the messages. You can specify multiple people to search for messages sent by multiple users.
- `searchTerms`: An array of terms to look for in the message contents. Each term constitutes a search string to be matched in the message contents.
- `attributes`: Additional message attributes to consider during the search. For a list of possible values, see doc://com.apple.sirikit/documentation/Intents/INMessageAttributeOptions.
- `dateTimeRange`: The dates associated with the messages. Use this parameter to specify the range of dates to search.
- `identifiers`: The identifier strings of the messages. Use this parameter when you want to specify messages based on their unique ID.
- `notificationIdentifiers`: An array of identifiers from doc://com.apple.documentation/documentation/UserNotifications/UNNotification objects. Use this parameter to search the notifications associated with your app.
- `speakableGroupNames`: An array of strings representing any group addresses receiving the message.

## Return Value

Return Value An initialized intent or nil if the object could not be created.

## Discussion

Discussion Normally, you do not create instances of this class yourself. Instead, Siri creates instances when the user asks to search their messages. However, you can use this method during testing to create intent objects in order to validate your intent handling code paths. Specify nil for any parameters that you do not want used during the search.

## See Also

### Deprecated Symbols

- [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)
