Coupon Code

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}}' \
--data-urlencode 'postbackTexts=[{"index":<qr_btn_index>,"text":"<postback_text>"}]'

📘

  • Include the message object in the curl above only if the template has media.
    Refer image, video and document template docs to get the corresponding message payloads.
  • 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 messageimage / video / document
imageobjectImage object containing id / linkSee below for detailed structure
videoobjectVideo object containing id / linkSee below for detailed structure
documentobjectDocument object containing id / linkSee below for detailed structure
image object structure:
FieldTypeDescriptionExample
linkstringMedia URL of the image"<image_media_url>"
idstringMedia ID of the image"<image_media_id>"
video object structure:
FieldTypeDescriptionExample
linkstringMedia URL of the video"<video_media_url>"
idstringMedia ID of the video"<video_media_id>"
document object structure:
FieldTypeDescriptionExample
linkstringMedia URL of the document"<document_media_url>"
idstringMedia ID of the document"<document_media_id>"
filenamestringName of the document file to be shown; optional"temp.pdf"

postbackTexts object structure:

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

Status Codes

Status CodeDescriptionResponse Body
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!