Media-Based Message Template

Use this API to send a media based message as template.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
📘

Note:

  1. Sending Marketing Templates through MM Lite for enhanced delivery optimization. For more details, refer to MM Lite document.
  2. Use the recipient parameter only when BSUID is enabled for the app.
  3. When both to and recipient fields are used in the payload, the to field gets the priority.

Request Parameters

KeyValueDescriptionData typeRequired/OptionalConstraints
Authorization{{PARTNER_APP_TOKEN}}Access Token for the applicationStringRequiredShould be a valid Partner App Access Token.
appId{{APP_ID}}App ID to fetch the access tokenStringRequiredThe ID should be a valid app Id of Gupshup.
messaging_productwhatsappMessaging productStringRequired
recipient_typeindividualRecipient typeStringRequired
to91785876xxxxDestination phone number where the message needs to be sentStringRequired (Can be optional if BSUID is enabled for the app and recipient parameter is used instead)Must be a valid phone number
recipientIN.461449821882xxxxDestination BSUID where the message needs to be sentStringOptionalMust be a valid BSUID
typetemplateMessaging typeStringRequiredThe type should be template to send a template message.
template{<BODY>}Template message inside bodyObjectRequired

Sample Request

curl --location 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'accept: application/json' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/json' \
--data '{
	"messaging_product": "whatsapp",
	"recipient_type": "individual",
  "to": "PHONE_NUMBER",
	"recipient": "BSUID",
	"type": "template",
	"template": {
		"name": "TEMPLATE_NAME",
		"language": {
			"code": "LANGUAGE_AND_LOCALE_CODE"
		},
		"components": [
			{
				"type": "header",
				"parameters": [
				{
					"type": "image",
					"image": {
						"link": "https://URL"
					}
				}
			]
		},
		{
			"type": "body",
			"parameters": [
				{
					"type": "text",
					"text": "TEXT-STRING"
				},
				{
					"type": "currency",
					"currency": {
					"fallback_value": "VALUE",
					"code": "USD",
					"amount_1000": "NUMBER"
					}
				},
				{
					"type": "date_time",
					"date_time": {
					"fallback_value": "MONTH DAY, YEAR"
					}
				}
			]
		}
	]
}

Sample Response

{  
	"messages": [  
		{  
			"id": "GUPSHUP_MESSAGE_ID"  
		}  
	],  
	"messaging_product": "whatsapp",  
	"contacts": [  
		{  
			"input": "DESTINATION_PHONE_NO",  
			"wa_id": "DESTINATION_PHONE_NO"  
		}  
	]  
}

Status Codes

Status CodeResponseComments
Success
200
{  
	"messages": [  
		{  
			"id": "GUPSHUP_MESSAGE_ID"  
		}  
	],  
	"messaging_product": "whatsapp",  
	"contacts": [  
		{  
			"input": "DESTINATION_PHONE_NO",  
			"wa_id": "DESTINATION_PHONE_NO"  
		}  
	]  
}
Error
400
{  
	"message": "Callback Billing must be enabled for this API",  
	"status": "error"  
}
if Callback billing is not
enabled for the app
400
{  
	"message": "Invalid App Details",  
	"status": "error"  
}
if app details are not found
401
{  
	"status": "error",  
	"message": "Authentication Failed"  
}
When API key authentication fails
Path Params
string
required

Unique identifier of the app.

Body Params
Headers
string
required

Your app token, please refer Get access token api to get the token from partner documentation.

Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json