Contents

init(identifier:conversationIdentifier:content:dateSent:sender:recipients:groupName:messageType:serviceName:)

Creates a message with the specified content and an optional service name.

Declaration

init(identifier: String, conversationIdentifier: String?, content: String?, dateSent: Date?, sender: INPerson?, recipients: [INPerson]?, groupName: INSpeakableString?, messageType: INMessageType, serviceName: String?)

Parameters

  • identifier:

    The message’s unique identifier. Specify a value that you can later use to identify the same message.

  • conversationIdentifier:

    The identifier of the conversation that contains this message.

  • content:

    The text that Siri recites to the message recipient.

  • dateSent:

    The date and time the app sent the message to each recipient.

  • sender:

    The person who sent the message.

  • recipients:

    The people who recieved the message.

  • groupName:

    The name of the grouped conversation. Provide a value only when the message belongs to a named group; otherwise, specify nil.

  • messageType:

    The type of content the message contains. For possible values, see Inmessagetype.

  • serviceName:

    The name of the service that delivers the message.

Return Value

A message that SiriKit configures with the specified parameters, or nil if there was a problem creating the message.

Discussion

Use the conversationIdentifier parameter to associate individual messages with a larger discussion among a specific group of people.

For each participant in the message (sender and recipients), create an instance of INPerson using one of the initializers that require an isMe parameter. Use true for the participant that represents the user of the current device; for all other participants, use false. When creating each of those objects, provide enough information for you to later identify that same person.

If your app supports more than one message service, specify the serviceName parameter to indicate which service the app uses to deliver a specific message.

See Also

Creating a Message