Article

Sending a Custom Interactive Message

Provide a unique user experience with custom interactive messages.

Overview

You can use your custom interactive message—by setting the bid, appId, appName, and appIcon to reference your extension.

When sending a custom interactive message, use the type value of interactive and include the interactiveData field in the message JSON. The interactiveData field is a dictionary that describes the iMessages extension to use. The dictionary also contains data that the Messages app passes to the extension.

To control the appearance of the interactive message that Messages displays on the customer’s device, use the receivedMessage dictionary. Note that the Messages app ignores the imageIdentifier and style keys when using a custom interactive message. For the list of received message dictionary keys, see receivedMessage dictionary.

Listing 1

A sample custom interactive message

{
    "type": "interactive",
    "interactiveData": {
      "appId": app-store-id,
      "appName": "Name of the App",
      "bid": "com.apple.messages.MSMessageExtensionBalloonPlugin:{team-id}:{ext-bundle-id}",
      "URL": "?data=passed-to-app&data2=more-data-passed-to-app",
      "sessionIdentifier": "uuid-for-this-interaction",
      "receivedMessage": {
        "title": "Title of Bubble",
        "subtitle": "Subtitle to be displayed under title",
        "imageTitle": "Title of image attachment",
        "imageSubtitle": "Subtitle of the image attachment.",
        "secondarySubtitle": "Title that is aligned right",
        "tertiarySubtitle": "Subtitle that is aligned right"
      }
    },
    "sourceId": "",
    "destinationId": "",
    "v": 1,
    "id": "d2f99c0e-f64c-4c3b-abbf-4a8567891ef5"
}