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 中富連結 (Rich Link) 的 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"
}
]
}
]
}
}