Class

INSearchForMessagesIntent

Requests a list of messages matching the specified criteria.

Overview

Siri creates INSearchForMessagesIntent objects when the user asks to see already sent or received messages. Implementation of this intent is required 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 that were sent or received on specific dates, or messages containing specific terms. When performing the search, use only the parameters that were provided 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 should confirm the request and create 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.

For a list of other intents in the messages domain, see INMessagesDomainHandling.

Additional Intent Attributes

Table 1 lists additional attributes of this intent object.

Table 1

Search messages intent attributes

Attribute

Description

Supported by

Siri

Always requires unlocked device

No

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.

Example Phrases

There are many ways in which users can ask Siri to search for messages. Table 2 provides a few sample phrases in different languages. You can use these phrases during testing to trigger your intents. This list is not exhaustive and Siri may recognize many other phrases.

Table 2

Siri phrases that trigger the searching of messages

Locale

Example 1

Example 2

en

Find messages from Scott on <appName>

Read my <appName> messages from Heather

zh_CN

查找小李发来的<appName>消息

读一下来自李宏辉的<appName>信息

zh_HK

<appName>搵Jeffrey俾我嘅新訊息

讀吓微信來自陳嘉杰嘅訊息

zh_TW

幫我找<appName>上來自健行的新訊息

幫我用<appName>找來自John的短訊

yue_CN

<appName>揾Jeffrey俾我嘅新讯息

读吓微信来自陈嘉杰嘅讯息

ar

أوجد رسائل من رنا على <appName>

أوجد رسالة <appName> من محمد

da

find beskeder på <appName> fra John

find beskeder fra Bob på <appName>

de

Nach <appName> Nachrichten von Kitty suchen

Finde <appName> Nachrichten von Andreas

es

Búscame el mensaje de Julián en <appName>

Leer los mensajes de <appName> de Carlos

fi

Hae Petterin viestit <appName>ssa

Hae Karilta tulleet <appName> viestit

fr

Cherche les messages <appName> envoyés par John

Cherche les messages de John sur <appName>

he

תמצא הודעת <appName> מיוני

תקרא את ההודעת <appName> מדויד

it

Cerca messaggi da Tiziana su <appName>

Leggi i miei messaggi <appName> da Riccardo

ja

<appName>で正夫からのメッセージを探して

正夫から<appName>のメッセージ来てる

ko

내 새로운 <appName> 메시지를 읽어줘

나의 <appName> 메시지 읽어줘

ms

Cari semua teks dari Bob di <appName>

Paparkan semua mesej daripada Ahmad dalam <appName>

nb

Finn meldinger på <appName> fra Kitty

Les <appName> meldingene mine fra Jonas

nl

Vind berichten van Victor in <appName>

Lees mijn <appName> berichten van Sofie

pt

Encontra mensagens do João no <appName>

Leia minhas mensagens no <appName> da Maria

ru

Найди <appName> сообщение от Феди

Найти сообщения от Наташи в <appName>

sv

Hitta meddelanden från Hans på <appName>

Hitta <appName> meddelanden från Sandra

th

หาข้อความของสมชายที่ส่งมาใน <appName>

อ่านข้อความ <appName> จากสมหญิง

tr

Hasan'dan gelen <appName> mesajını bul

Hasan'dan gelen <appName> mesajını göster

In the preceding examples, <appName> represents the name of the app whose Intents extension searches the user’s messages. If your app uses custom names for contacts, you can tell Siri about those names using the INVocabulary class.

Topics

Getting the Senders and Recipients

var recipients: [INPerson]?

The contacts who are the recipients of the messages.

var recipientsOperator: INConditionalOperator

The operator that defines how to use the recipients in the search criteria.

var senders: [INPerson]?

The senders of the messages to be found.

var sendersOperator: INConditionalOperator

The operator that defines how to use the senders in the search criteria.

var speakableGroupNames: [INSpeakableString]?

The names of any groups associated with the message.

var speakableGroupNamesOperator: INConditionalOperator

The operator that defines how to use the group names in the search criteria.

var groupNames: [String]?

The names of any groups associated with the message.

Deprecated
var groupNamesOperator: INConditionalOperator

The operator that defines how to use the group names in the search criteria.

Deprecated

Getting the Search Criteria

var searchTerms: [String]?

The terms to look for in the messages.

var searchTermsOperator: INConditionalOperator

The operator that defines how to use the set of terms in the search criteria.

var dateTimeRange: INDateComponentsRange?

The range of dates in which to search for messages.

var attributes: INMessageAttributeOptions

The attributes that must be present on a message to yield a match.

Specifying Message Identifiers

var identifiers: [String]?

The message identifiers to locate in your search.

var identifiersOperator: INConditionalOperator

The operator that defines how to use the identifiers in the search criteria.

var notificationIdentifiers: [String]?

The operator that defines how to use the notification identifiers in the search criteria.

var notificationIdentifiersOperator: INConditionalOperator

The operator that defines how to use the notification identifiers in the search criteria.

Relationships

Inherits From

Conforms To

See Also

Search for Messages

protocol INSearchForMessagesIntentHandling

Handles the searching of the current user’s messages.

class INSearchForMessagesIntentResponse

Contains your app’s response to a search for messages intent.