Carousel

cURL

curl --location '{{api_front_base_url}}/wa/api/v1/template/msg' \
--header 'apikey: {{apiKey}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source={{source phone number}}' \
--data-urlencode 'destination={{destination phone number}}' \
--data-urlencode 'src.name={{app_name}}' \
--data-urlencode 'template={"id":"<template_id>","params":[<list_of_template_parameters>]}' \
--data-urlencode 'message={{message}}'

📘

  • Carousel templates can only be sent via CAPI apps.
  • The template.params list will contain all variable parameter values, including those in main message bubble and individual cards, in order of their appearance
  • Omit the postbackTexts parameter in the curl above if the template doesn’t have quick reply buttons, or if it has but there’s no need for postback text support.

Request Parameters

ParameterLocationTypeDescriptionExample
apikeyHeaderstringYour account API key2xxc4x4xx2c94xxxc2f9xx9d43xxxx8a

Form Parameters (Request Body)

ParameterTypeRequiredDescriptionExample
sourcestringYesSender WhatsApp Number919163xxxxx3
src.namestringYesApp name that the source number belongs toDemoApp
destinationstringYesReceiver WhatsApp Number917839xxxxx3
templateobjectYesContains template id and list of template parameters, including the coupon codeSee below for detailed structure
messageobjectNoOptional; required for media templatesSee below for detailed structure
postbackTextsarrayNoList of objects containing postback text detailsSee below for detailed structure
channelstringNoMessaging Platform Namewhatsapp

template object structure:

FieldTypeDescriptionExample
idstringTemplate IDtemplate_id
paramsarrayList of template parameters; MUST include the coupon code value in order["125OFF"]

message object structure:

FieldTypeDescriptionExample
typestringType of messagecarousel
cardHeaderTypestringType of header in the carouselIMAGE / VIDEO
cardsarrayList of cards in the carouselSee below for detailed structure
cards object structure:
FieldTypeDescriptionExample
idstringMedia ID of the image or video"<image_media_id/video_media_id>"
linkstringMedia URL of the image or video"<image_media_url/video_media_url>"
postbackTextsarrayList of objects containing postback text detailsSee below for detailed structure
postbackTexts object structure:
FieldTypeDescriptionExample
indexintegerButton index (0-based)0
textstringPostback text for the buttonhello

postbackTexts object structure:

FieldTypeDescriptionExample
indexintegerButton index (0-based)0
textstringPostback text for the buttonhello

Status Codes

Status CodeDescriptionResponse Schema
202Success response{ "messageId": "message id", "status": "success" }
400Error response; in case of bad request{ "message": "Invalid Destination", "status": "error" }
401Error response; in case of authentication failure{ "message": "Authentication Failed", "status": "error" }
Language
Click Try It! to start a request and see the response here!