Apple Messages for Business is a channel built to reach customers through Messages on any Apple device. The channel prides itself on its rich set of messaging features including bot and AI capabilities, security, and ability to connect to the wide world of iOS apps and add-ons.
Apple Messages for Business is used for customer service interactions, scheduling tasks, and even payments. This means that customers interact with brands as easily as they message their friends and family. It’s discoverable from Apple Maps, Safari, and Search— or directly embedded into a brand’s website.
Apple Messages for Business requires all businesses to register with Apple before rolling out Messages for Business. A business will need to submit brand information, including addresses and logos, for Apple’s approval. As part of this process, you’ll be prompted to select a Messaging Service Provider. Here is where Zendesk’s Sunshine Conversations comes into play— as a Messaging Service Provider, we are certified by Apple to provide services and solutions for your Messages for Business needs. At the end of the registration process, you’ll receive a unique Messages for Business ID that will be used to connect to Sunshine Conversations.
See Register Your Account for more information.
To set up your Messages for Business Account in the Apple Business Register:
Sign into the Business Register and add a Messages for Business Account.
Go to register.apple.com.
Review the Messages for Business policies and click Next.
You’ll need to provide:
Finally, click Send for review to submit your application to Apple. You’ll be able to see the status of your application at the top of your Messages for Business Account page.
After you’ve been approved by Apple for Messages for Business, you’ll be issued an ID.
You can find the ID by going to your Messages for Business Account page and scrolling down to the Messaging Service Provider section.
From there, click on Test your Messaging Service Provider connection.
After that, you’ll be directed to a page where you can copy your Messages for Business ID.
Apple supports a wide variety of capabilities as seen in the channel capabilities grid. Below is a detailed view of each capability.
Delivery events allow you to track deliveries of Sunshine Conversations messages to Apple Messages for Business by subscribing to the conversation:message:delivery:channel
webhook. Failures to deliver a message to Apple Messages for Business can be detected by subscribing to the conversation:message:delivery:failure
webhook.
Apple’s documentation can be found here.
You will need to do the following:
<div>
container to house the button.The Messages for Business button must contain the following, at minimum:
data-apple-business-id
attribute with the business ID you received when you registered your company with Messages for Business.If you don’t have a Sunshine Conversations account yet, contact us from the Test your Messaging Service Provider connection in the Business Register to continue the integration process. From that page, you can click on the Connect button to send you to the Sunshine Conversations site.
Log into the Apple Business Register.
In a separate tab, log into your Sunshine Conversations Dashboard.
Copy your Messages for Business ID from the Test your Messaging Service Provider connection page in Apple Business Register.
In the Sunshine Conversations Dashboard, select Apple Messages for Business from the list of channel integrations.
Next, complete the following steps to connect your Apple Messages for Business integration.
Since Messages for Business IDs are public, Sunshine Conversations has implemented a security measure to ensure your brand’s Messages for Business ID stays linked to your Sunshine Conversations app. This means that a Messages for Business ID cannot be migrated from one app to another through the dashboard or API. If you need to remove your Apple Messages for Business integration and migrate it to another app, please contact our team for assistance using the help widget in your dashboard. Our team will release the Messages for Business ID on your behalf.
There are 3 different IDs required in the payload:
Apple makes it possible to publish a URL for users to tap that will bring them into iMessage to chat with the business.
In order to provide some context to the business about which link was clicked by the user, the biz-intent-id
and biz-group-id
parameters can be included as querystring parameters on the URL:
https://bcrw.apple.com/urn:biz:{businessId}?biz-intent-id=TestingBizIntent&biz-group-id=TestingBizGroup
Group and intent are both optional. If both are left unspecified, the client.raw
object will be absent and the message.source.group
and message.source.intent
fields will be absent.
Whenever Sunshine Conversations receives a group or intent attached to an Apple Messages for Business message, these values will be exposed in both the Sunshine Conversations message and client objects. For example, after a user clicks on such a link, the first message received by that user will trigger a message:appUser
webhook like this:
{
"trigger": "message:appUser",
"app": { "_id": "599349ff5f753aecf2e151c9" },
"messages": [
{
"authorId": "caf1dbe12cee751407bd53a6",
"received": 1512587862.523,
"type": "text",
"text": "Hi",
"name": "Glass Chameleon",
"role": "appUser",
"_id": "5a284256fbbc83ffb792e31c",
"source": {
"type": "apple",
"group": "TestingBizGroup",
"intent": "TestingBizIntent"
}
}
],
"appUser": {
"_id": "caf1dbe12cee751407bd53a6",
"signedUpAt": "2017-12-06T16:59:11.355Z",
"conversationStarted": true,
"credentialRequired": true,
"clients": [
{
"raw": {
"group": "TestingBizGroup",
"intent": "TestingBizIntent"
},
"id": "1da8d244-a389-4240-ae6e-4b6975c88236",
"platform": "apple",
"linkedAt": "2017-12-06T16:59:11.357Z",
"lastSeen": "2017-12-06T19:17:42.476Z",
"active": true,
"primary": true
}
]
}
}
Any group or intent received from Apple will be persisted in the client object. Each subsequent message:appUser
webhook payload will include those fields.
The last known group or intent will also be included under the message.source
, and will be replayed in future messages coming from that user so long as neither changes.
Clients and messages can also be retrieved at a later date via the user API and messages API respectively.
A user can click a different Messages for Business link with different biz-*
query parameters, thus changing the conversation’s group and intent. In this case, client.raw.group
and client.raw.intent
will be individually updated with any new values. Group and intent values that were received with previous messages will still be preserved in the message history under that message’s source.group
and source.intent
parameters.
If a user unsubscribes, the group and intent stored on the client will be cleared. If they later change their mind and send a new message to the business (without having clicked a Messages for Business link with query parameters) these parameters will be absent from the smooch client.
Apple Messages for Business supports several message types that can only be sent using message overrides such as:
For more details and examples on how to send these message types, consult the documentation for message overrides. We recommend using templates where possible, to avoid crafting complex messages each time they’re sent and also to avoid network delays when sending large messages.
To receive passthrough messages, subscribe to one of the passthrough webhook triggers through the Sunshine Conversations API. Note that these triggers must be explicitly subscribed for via the Sunshine Conversations API; they are not included in the *
trigger.
Trigger | Usage |
---|---|
passthrough:apple:extension | Triggered when a custom extension message is received |
passthrough:apple:interactive | Triggered when a list picker, time picker, or other
interactiveDataRef
is received |
The passthrough webhook payload includes the associated app
, appUser
, source
, and raw payload received from Apple.
Here is an example passthrough payload for a list picker selection:
{
"app": { "_id": "59a8866f19ac1e893d8f39fe" },
"appUser": { "_id": "12130c355cf163c2dca397a9" },
"payload": {
"apple": {
"destinationId": "9032e482-9c84-11e7-a303-c753b1bff6fa",
"id": "45e36836-fa85-41a1-8c25-359e6c941d40",
"interactiveData": {
"bid": "com.apple.messages.MSMessageExtensionBalloonPlugin:0000000000:com.apple.icloud.apps.messages.business.extension",
"data": {
"listPicker": {
"multipleSelection": true,
"sections": [
{
"items": [
{
"identifier": "taco-appetizer",
"order": 0,
"style": "default",
"subtitle": "Great tacos",
"title": "Tacos"
},
{
"identifier": "taco-meal",
"order": 0,
"style": "default",
"subtitle": "Great tacos",
"title": "Tacos"
}
],
"order": 0,
"title": "You Selected"
},
{
"items": [
{
"identifier": "burrito-appetizer",
"order": 1,
"style": "default",
"subtitle": "Good burritos",
"title": "Burritos"
},
{
"identifier": "burrito-meal",
"order": 3,
"style": "default",
"subtitle": "Good burritos",
"title": "Burritos"
}
],
"order": 1,
"title": "Others"
}
]
},
"mspVersion": "1.0",
"requestIdentifier": "food-picker-1"
}
},
"sourceId": "urn:mbid:AQAAY5fm8C1h9GM7PJdHm1px6YYbfTH7R5Psfj0Lhh9dYbswZ+zfZekvmh6j1zuXMs7bovQJZ4d1Mw3TssgRy7mu1dXyTAY2uFrMhLt2HQILH5E6Jyq7VhpncbbIm58Ow4J6PbwgyaShPuccYT67n2TzF98KNOs=",
"type": "interactive",
"v": 1
}
},
"source": { "type": "apple" },
"trigger": "passthrough"
}
Apple includes a capability-list
HTTP header when sending and receiving messages that identifies the Messages for Business features supported by the user’s device. We support the following capabilities:
QUICK - supports Quick Reply Messages. Quick Reply Messages provide users a list of choices. For example, they can select from a list of numbers from 1 to 5 to rate their customer satisfaction. You must use the Passthrough API for Quick Reply Messages.
LIST - supports List Picker Messages. List Picker Messages let users select from a list of items. Each item contains the item name and optionally a description or image. For example, a list of knowledge base articles is displayed to the user who then chooses the one they want to view. You must use the Passthrough API for List Picker Messages.
TIME - supports Time Picker Messages. Time Picker Messages let users pick a time slot for scheduling an event. For example, a user might select a time slot for a dentist visit from the list of available times. You must use the Passthrough API for Time Picker Messages.
FORM - support Forms Messages. Forms Message are interative flows and are supported only on iOS and iPadOS devices. For example, an interactive flow might be troubleshooting steps for debugging a computer firewall issue. You must use the Passthrough API for Form Messages.
AUTHENTICATION - support Authentication Messages. Authentication Messages allow users to validate their identity from within the conversation. You must use the Passthrough API for Authentication Messages.
For more information and examples of the above message types, see Interactive Message Types and Rich Link Messages. For more information and examples of how to send these types of messages, see Sending Apple messages.
Each time a new message is received from Apple Messages for Business, Sunshine Conversations includes the capability list in client.raw.capabilityList
so that you can prevent unsupported message types from being sent to the end-user’s device.
"appUser": {
"signedUpAt": "2022-05-31T18:09:59.116Z",
"hasPaymentInfo": false,
"_id": "bf5704bac22637ddea64fad3",
"conversationStarted": true,
"clients": [
{
"integrationId": "6296550888891d0c2263db32",
"id": "d3ab5219-16f7-403f-a19d-701fbca40dd7",
"status": "active",
"raw": {
"locale": "en_CA",
"capabilityList": "AUTH,LIST,TIME,QUICK"
},
...
},
],
...
}
If a user’s reply includes a large attachment or payload, Apple will provide an interactiveDataRef
in the response rather than the complete response. For more information, see Receiving an interactive messages in Apple’s developer documentation. To download this reference and access the complete response, you can use the API below and pass the interactiveDataRef
response obtained through your passthrough webhooks.
curl $SUNSHINE_CONV_ROOT/v2/apps/$APP_ID/conversations/$CONVERSATION_ID/download \
-X POST \
-H 'content-type: application/json' \
-H 'authorization: Bearer your-account-jwt' \
-d '{
"userId": $USER_ID,
"apple": {
"interactiveDataRef": {
"url": "https://p61-content.icloud.com/M58C0A1A2EB62B6E899B4F28996E8DA229E1914295299C39944B2F2CA7482AE50.C01USN00",
"bid": "com.apple.messages.MSMessageExtensionBalloonPlugin:0000000000:com.apple.icloud.apps.messages.business.extension",
"key": "00c0d1827fdc858fe7b42421de1fb289c2ee0a9463d787ce4f118506f970bd6e38",
"signature": "81a619c81da5a01c6139219a5d20e17430c631e1eb",
"owner": "M58C0A2A1EB62B4E859B4F28996E8DA229E1914295299C39944B2F2CA7482AE50.C01USN00",
}
}
}'
Users can opt out from receiving further messages. When a customer deletes a conversation in Messages, a dialog appears that asks if they want to stop receiving messages from the business. If the customer chooses to stop receiving messages, Messages for Business considers the conversation closed and sends a message of type close
to the Sunshine Conversations. You can read more about this in Apple’s Developer Docs.
Upon receiving a close
message, Sunshine Conversations will set client.status: blocked
on the client with platform: "apple"
of the corresponding appUser
.
A client:block
event will also be POSTed to subscribed webhooks.
The existing Sunshine Conversations /messages
and /templates
APIs will not accept payloads larger than 100kb.
In order to remain compatible with Apple’s large payloads, Sunshine Conversations offers separate APIs designed specifically for handling large Apple Messages for Business override payloads. The existing Sunshine Conversations /messages
and /templates
API accept the override parameter inside JSON payloads smaller than 100kb while a separate set of APIs will be offered that are designed to accept much larger payloads, up to 10mb.
Standard Sunshine Conversations API (v1) | Large Apple paylaods equivalent |
---|---|
POST
/v1/apps/:appId/appusers/:userId/messages | POST
/v1/apps/:appId/appusers/:userId/messages/large |
POST
/v1/apps/:appId/templates | POST
/v1/apps/:appId/templates/large |
PUT
/v1/apps/:appId/templates/:templateId | PUT
/v1/apps/:appId/templates/:templateId/large |
The large payload APIs may only be used for apps that have a valid Apple Messages for Business integration configured.
We strongly recommend using templates for sending large Messages for Business messages whenever possible as constantly transferring the same large payload when sending the same content to multiple users generates unnecessary network traffic, which may cause message delivery latency.
If your quick reply requires the use of interactive data because the reply is too large, please use the passthrough API to send that message.
The large payload APIs behave the same as their conventional equivalents, except for two key differences:
override.apple.payload
(or message.override.apple.override
for templates) is required in the request bodyLarge message and template processing is deferred to a processing queue and therefore large payload APIs return 202 Accepted along with a requestId. For example:
{"requestId":"dkgSujU2R62HF3W9PnRIGy8K"}
This requestId
can be used to track the success or failure of the request (message delivery or template creation/update) via two new webhook triggers: request:success
and request:failure
. The request body of request:success
webhooks have a response key, whose value matches the structure returned from the associated standard API. request:failure
webhooks have an “error” key mapping to an object containing error details. Possible error codes can be found here.
Example for POST /v1/apps/:appId/appusers/:userId/messages/large
:
request:success
example:
{
"trigger": "request:success",
"app": { "_id": "564f56151d195e2100c49f13" },
"appUser": { "_id": "4f75e8d7c26953e0df65bb40" },
"requestId": "dkgSujU2R62HF3W9PnRIGy8K",
"timestamp": 1534173863.84,
"response": {
"message": {
"_id": "5b71beb728ef8677a427c769",
...
},
"conversation": {
"_id": "1f706345a613e803962dfe54",
...
}
}
}
request:failure
example:
{
"trigger": "request:failure",
"app": { "_id": "564f56151d195e2100c49f13" },
"appUser": { "_id": "4f75e8d7c26953e0df65bb40" },
"requestId": "dkgSujU2R62HF3W9PnRIGy8K",
"error": {
"code": "bad_request",
"message": "Invalid JSON"
},
"timestamp": 1534173863.84
}
SUNSHINE_CONV_ROOT='https://api.smooch.io'
APP_ID='your_app_id'
APP_USER_ID='app_user_id'
MESSAGE=$(cat <<-END
{
"type": "text",
"text": "Hello non-apple channel",
"role": "appMaker",
"override": {
"apple": {
"payload": {
"type": "interactive",
"interactiveData": {
"bid": "com.apple.messages.MSMessageExtensionBalloonPlugin:0000000000:com.apple.icloud.apps.messages.business.extension",
"data": {
"version": "1.0",
"requestIdentifier": "",
"images": [
{
"data": "base64encoded-image-file",
"identifier": "1"
},
{
"data": "base64encoded-image-file",
"identifier": "2"
},
{
"data": "base64encoded-image-file",
"identifier": "3"
}
],
"listPicker": {
"sections": [
{
"title": "Appetizers",
"order": 0,
"items": [
{
"title": "Tacos",
"order": 0,
"identifier": "taco-appetizer",
"imageIdentifier": "2"
},
{
"title": "Burritos",
"order": 1,
"identifier": "burrito-appetizer",
"imageIdentifier": "3"
}
]
},
{
"title": "Meals",
"order": 1,
"items": [
{
"title": "Tacos",
"order": 0,
"identifier": "taco-meal",
"imageIdentifier": "2"
},
{
"title": "Burritos",
"order": 1,
"identifier": "burrito-meal",
"imageIdentifier": "3"
}
]
}
]
}
},
"receivedMessage": {
"style": "small",
"title": "Food Picker",
"subtitle": "Let\"s eat!",
"imageIdentifier": "1"
},
"replyMessage": {
"style": "small",
"title": "Selected food",
"subtitle": "Nutrition"
}
}
}
}
}
}
END
)
curl $SUNSHINE_CONV_ROOT/v1/apps/$APP_ID/appusers/$APP_USER_ID/messages/large \
-X POST \
-H 'content-type: application/json' \
-H 'authorization: Bearer your-account-jwt' \
-d "$MESSAGE"
curl $SUNSHINE_CONV_ROOT/v1/apps/$APP_ID/templates/large \
-X POST \
-H 'content-type: application/json' \
-H 'authorization: Bearer your-account-jwt' \
-d '{
"name": "test-template-1234",
"message":'"$MESSAGE"'
}'
TEMPLATE_ID='your_template_id'
curl $SUNSHINE_CONV_ROOT/v1/apps/$APP_ID/templates/$TEMPLATE_ID/large \
-X PUT \
-H 'content-type: application/json' \
-H 'authorization: Bearer your-account-jwt' \
-d '{
"name": "new-template-name",
"message":'"$MESSAGE"'
}'
Just like the traditional /messages
API, /messages/large
can be used to send messages to users on channels other than Apple Messages for Business. If you wish to target a user’s Apple client specifically you can do so via channel targeting.
Sending a large template is done using the standard /messages
API, as described here.
It’s possible to convert a standard template to a large one by calling the PUT /templates/:templateId/large
endpoint. Converting a large template to a standard one is also possible by calling the PUT /templates/:templateId
endpoint and providing the message in the request body.
Large templates are deleted the same way as standard templates, by calling the DELETE /templates/:templateId
endpoint.
Fetching large templates can be achieved by using the same APIs as for standard templates (GET /templates
and GET /templates/:templateId
). An isLarge
property set to true
will be included only for large templates (it won’t be present for standard templates.) Note that when retrieving a large template, the response will not include the Apple override section.