https://api.gupshup.io/wa/app/{appId}/v3/marketing/msg
Key Description Value Data Types Require/Optional Constraints apikey Apikey of the account String Required - Should be a valid Gupshup App Access Token appId App ID to fetch the access token {App_ID}String Required - The Id should be a valid app Id of Gupshup. to to phone number where the message need to be send String Required Must be a valid phone no template meta template payload json Required This endpoint only supports marketing template. type Type in the value of what kind of message the user is sending template String Required set it’s value as template messaging_product Messaging product is a constant value i.e., whatsapp whatsapp String Required
cURL
curl --location '{{wa_base_url}}/wa/app/:appId/v3/marketing/msg' \
--header 'apikey: {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
"recipient_type": "individual",
"messaging_product": "whatsapp",
"to": "{{destination}}",
"type": "template",
"template": {
"language": {
"policy": "deterministic",
"code": "en"
},
"namespace": "5ff5f84e_789b_44df_80dd_6844d48a6a4a",
"name": "cc_temp_prod",
"components": [
{
"type": "body",
"parameters": []
},
{
"type": "button",
"sub_type": "copy_code",
"index": "0",
"parameters": [
{
"type": "coupon_code",
"coupon_code": "250FF"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": "1",
"parameters": [
{
"type": "text",
"text": "summer2023"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": "2",
"parameters": [
{
"type": "text",
"text": "summer2023"
}
]
}
]
}
}'
Key Description GUPSHUP_MESSAGE_ID Unique Message Id generated by gupshup for each message DESTINATION_PHONE_NO Destination phone no of the message sent
JSON
{
"messages": [
{
"id": "b7347903-476e-4c01-83a0-f1390cf3c36e"
}
],
"messaging_product": "whatsapp",
"contacts": [
{
"input": "9111111111",
"wa_id": "9111111111"
}
]
}
Status Code Response Comments Success 200 JSON
{
"messages": [
{
"id": "GUPSHUP_MESSAGE_ID"
}
],
"messaging_product": "whatsapp",
"contacts": [
{
"input": "DESTINATION_PHONE_NO",
"wa_id": "DESTINATION_PHONE_NO"
}
]
}Error 400 JSON
{
"status": "error",
"message": "MM lite is not enabled for this app"
}When mmLite config is not enabled for the given app. 400 JSON
{
"message": "Callback Billing must be enabled for this API",
"status": "error"
}if Callback billing is not enabled for the app 400 JSON
{
"message": "The provided app is not of the expected type for this API. Please ensure that the app is on cloud.",
"status": "error"
}if the app is onPrem app instead of cloud 400 JSON
{
"message": "Invalid App Details",
"status": "error"
}if app details are not found 401 JSON
{
"status": "error",
"message": "Authentication Failed"
}When API key authentication fails
Receiving webhooks : All incoming DLRs should be received and forwarded as per the existing mechanism. Webhooks / DLR payload will be the same as existing on V2 and V3, no change. Except - delivered, sent, read and billing event will indicate the message category as marketing_lite .