Sending a WhatsApp Carousel Template

This guide shows you how to send the template to a user using the Messages API with a custom message type.

After a template is approved, send it using the Messages API with a custom message type. Use the Messages API POST endpoint. Carousel templates are sent as custom messages with "message_type": "custom" and "custom.type": "template", with parameters mapped to the template definition.

{
    "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"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}
An example WhatsApp message showing a product recommendation card.
{
    "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"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}
An example WhatsApp message showing a product recommendation card with link.
{
    "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": []
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}
An example WhatsApp message showing a product recommendation card with quick reply.

Further Information