Envío de una plantilla de carrusel de WhatsApp
Esta guía le muestra cómo enviar la plantilla a un usuario utilizando el Messages API con un tipo de mensaje personalizado.
Enviar el mensaje de la plantilla «Carousel»
Una vez aprobada una plantilla, envíala mediante la Messages API con un tipo de mensaje personalizado. Utiliza la Messages API POST endpoint.
Las plantillas de carrusel se envían como mensajes personalizados con "message_type": "custom" y "custom.type": "template"con parámetros asignados a la definición del modelo.
Enviar un carrusel de recomendaciones de productos
Copia
{
"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"
}
]
}
]
}
]
}
]
}
}
}
Enviar carrusel de enlaces dinámicos
Copia
{
"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"
}
]
}
]
}
]
}
]
}
}
}
Enviar carrusel informativo sin parámetros - Respuesta rápida
Copia
{
"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": []
}
]
}
]
}
]
}
}
}