Versenden einer WhatsApp-Karussellvorlage
In dieser Anleitung wird gezeigt, wie Sie die Vorlage über die Messages API mit einem benutzerdefinierten Nachrichtentyp an einen Benutzer senden können.
Senden Sie die Karussellvorlage Nachricht
Nachdem eine Vorlage genehmigt wurde, senden Sie sie über die Messages API mit einem benutzerdefinierten Nachrichtentyp. Verwenden Sie die Messages API POST Endpunkt.
Karussellvorlagen werden als benutzerdefinierte Nachrichten mit "message_type": "custom" und "custom.type": "template"mit Parametern, die der Vorlagendefinition zugeordnet sind.
Karussell mit Produktempfehlungen versenden
{
"from":"<originating number>",
"to":"<destination number>",
"channel": "whatsapp",
"message_type": "custom",
"custom": {
"type": "template",
"template": {
"name": "sample_carousel_template10",
"language": {
"policy": "deterministic",
"code": "en"
},
"components": [
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "John"
}
]
},
{
"type": "CAROUSEL",
"cards": [
{
"card_index": 0,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://www.vonage.com/cdn-cgi/image/fit=contain,width=620,onerror=redirect/content/dam/vonage/us-en/api/imagery/VIDEO-API_HERO-IMG.png"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "TEXT",
"text": "0.00394"
}
]
}
]
},
{
"card_index": 1,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://www.vonage.com/cdn-cgi/image/fit=contain,width=510,onerror=redirect/content/dam/vonage/us-en/resources/imagery/article-thumbnails/VoIP-texting-thumbnail.png"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "TEXT",
"text": "0.00474"
}
]
}
]
},
{
"card_index": 2,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://www.vonage.com/cdn-cgi/image/fit=contain,width=510,onerror=redirect/content/dam/vonage/us-en/brand/GettyImages-1154717094-Voice.png"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "TEXT",
"text": "0.0039"
}
]
}
]
}
]
}
]
}
}
}

Dynamische Links senden Karussell
{
"from":"<originating number>",
"to":"<destination number>",
"channel": "whatsapp",
"message_type": "custom",
"custom": {
"type": "template",
"template": {
"name": "sample_carousel_dynamic_links10",
"language": {
"policy": "deterministic",
"code": "en"
},
"components": [
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "Pablo"
}
]
},
{
"type": "CAROUSEL",
"cards": [
{
"card_index": 0,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://www.vonage.com/cdn-cgi/image/fit=contain,width=510,onerror=redirect/content/dam/vonage/us-en/resources/imagery/article-thumbnails/VoIP-texting-thumbnail.png"
}
}
]
},
{
"type": "BODY"
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": 0,
"parameters": [
{
"type": "TEXT",
"text": "communications-apis/messages"
}
]
}
]
},
{
"card_index": 1,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://www.vonage.com/cdn-cgi/image/fit=contain,width=510,onerror=redirect/content/dam/vonage/us-en/brand/GettyImages-1154717094-Voice.png"
}
}
]
},
{
"type": "BODY"
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": 0,
"parameters": [
{
"type": "TEXT",
"text": "communications-apis/voice"
}
]
}
]
},
{
"card_index": 2,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://www.vonage.com/cdn-cgi/image/fit=contain,width=620,onerror=redirect/content/dam/vonage/us-en/api/imagery/VIDEO-API_HERO-IMG.png"
}
}
]
},
{
"type": "BODY"
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": 0,
"parameters": [
{
"type": "TEXT",
"text": "communications-apis/video"
}
]
}
]
}
]
}
]
}
}
}

Informationskarussell ohne Parameter senden - Schnellantwort
{
"from":"<originating number>",
"to":"<destination number>",
"channel": "whatsapp",
"message_type": "custom",
"custom": {
"type": "template",
"template": {
"name": "sample_carousel_quick_reply10",
"language": {
"policy": "deterministic",
"code": "en"
},
"components": [
{
"type": "BODY",
"parameters": []
},
{
"type": "CAROUSEL",
"cards": [
{
"card_index": 0,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://quicktests.showcpaas.com/sip-trunking.png"
}
}
]
},
{
"type": "BODY",
"parameters": []
}
]
},
{
"card_index": 1,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://quicktests.showcpaas.com/voice.png"
}
}
]
},
{
"type": "BODY",
"parameters": []
}
]
},
{
"card_index": 2,
"components":
[
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://quicktests.showcpaas.com/client-sdk.png"
}
}
]
},
{
"type": "BODY",
"parameters": []
}
]
}
]
}
]
}
}
}
