Apple Messages for Business 的 JSON 模式
在您的 Apple Messages for Business 渠道上发送消息时使用以下架构。用于以下模式元素的所有 ID 必须是唯一的。如果您引用了之前定义的元素,以确保事件发生在该特定元素上,例如回发时,则属于例外情况。
列表选取器
列表选取器的 ID 必须在随机 GUID 之前包含前缀 listPIcker_。如果没有此前缀,列表选取器将无法在 Apple Messages for Business 中运行。列表选取器中元素的 ID 无需此前缀。
Apple Messages for Business 中列表选取器的 JSON 模式
"messageContent": {
"type": "PLUGIN",
"payload": {
"postback": "",
"elements": [
{
"id": "listPicker_067d40c2-9580-49fe-8d7f-947b7e9e675a4",
"type": "MENU",
"elements": [
{
"id": "067d40c2-9580-49fe-8d7f-947b7e9e675a",
"type": "TITLE",
"text": "ListPicker Title"
},
{
"id": "067d40c2-9580-49fe-8d7f-947b7e9e671a",
"type": "BUTTON",
"text": "Choice 1",
"postback": "{\"identifier\": \"067d40c2-9580-49fe-8d7f-947b7e9e671a\"}"
},
{
"id": "067d40c2-9580-49fe-8d7f-947b7e9e672a",
"type": "BUTTON",
"text": "Choice 2",
"postback": "{\"identifier\": \"067d40c2-9580-49fe-8d7f-947b7e9e672a\"}"
}
]
}
]
}
}
时间选取器
时间选取器的 ID 必须在随机 GUID 之前包含前缀 timePIcker_。如果没有此前缀,时间选取器将无法在 Apple Messages for Business 中运行。时间选取器中元素的 ID 无需此前缀。
Apple Messages for Business 中时间选取器的 JSON 模式
"messageContent": {
"type": "PLUGIN",
"payload": {
"elements": [
{
"id": "timePicker_067d40c2-9580-49fe-8d7f-947b7e9e675a",
"type": "MENU",
"elements": [
{
"id": "067d40c2-9580-49fe-8d7f-947b7e9e125a",
"type": "TITLE",
"text": "TimePicker Title"
},
{
"id": "b1234",
"type": "BUTTON",
"text": "2022-05-12 08:30 (30 min)",
"postback": "{\"identifier\":\"b1234\",\"startTime\":\"2022-05-12T08:30:00+04:00\",\"durationInSeconds\":1800}"
},
{
"id": "c1234",
"type": "BUTTON",
"text": "2022-05-12 09:30 (30 min)",
"postback": "{\"identifier\":\"c1234\",\"startTime\":\"2022-05-12T09:30:00+04:00\",\"durationInSeconds\":1800}"
}
]
}
]
}
}
富链接
富链接的 ID 必须在随机 GUID 之前包含前缀 richLink_。如果没有此前缀,富链接将无法在 Apple Messages for Business 中运行。富链接中元素的 ID 无需此前缀。
Apple Messages for Business 中富链接的 JSON 模式
"messageContent": {
"type": "PLUGIN",
"payload": {
"elements": [
{
"id": "richLink_7329c009-4a36-493c-8435-80874a15175e",
"type": "MENU",
"elements": [
{
"id": "7329c009-4a36-493c-8435-80874a1517514",
"type": "FILE",
"filename": "pejsek-a-kocicka.jpg",
"url": "https://www.hrabova.info/wp-content/uploads/2019/02/pejsek-a-kocicka.jpg",
"mimeType": "image/jpeg"
},
{
"id": "7329c009-4a36-493c-8435-80874a1517524",
"type": "BUTTON",
"text": "RichLink Title",
"url": "https://www.seznam.cz/"
}
]
}
]
}
}
Apple Pay 消息
Apple Pay 消息的 ID 必须在随机 GUID 之前包含前缀 applePayMessage_。如果没有此前缀,Apple Pay 消息将无法在 Apple Messages for Business 中运行。Apple Pay 消息中元素的 ID 无需此前缀。
Apple Messages for Business 中 Apple Pay 的 JSON 模式
"messageContent": {
"type": "PLUGIN",
"payload": {
"postback": "{\"brandId\":1591,\"templateId\":\"d5677255-671b-426f-b4fa-5487ae8a8c81\"}",
"elements": [
{
"id": "applePayMessage_d5677255-671b-426f-b4fa-5487ae8a8c81",
"type": "MENU",
"elements": [
{
"id": "7329c009-4a36-493c-8435-80874a151751",
"type": "TITLE",
"text": "ApplePayMessage Title"
},
{
"id": "7329c009-4a36-493c-8435-80874a151752",
"type": "TEXT",
"text": "Item: 1 CZK",
"mimeType": "text/plain"
}
]
}
]
}
}