Request Parameters
Key | Description | Value | Data type | Required/Optional | Constraints |
---|---|---|---|---|---|
Authorization | Access Token for the application | {{PARTNER_APP_TOKEN}} | String | Required | Should be a valid Partner 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. |
messaging_product | Messaging product | String | Required | ||
recipient_type | Recipient type | individual | String | Required | |
to | Destination phone no where the message need to be send | 91785876xxxx | String | Required | Must be a valid phone number |
type | Messaging type | text | String | Required | Type should be interactive to send interactive message. |
interactive | Add template body | template: {<body>} | object | Required | Key should be a template to send interactive message. |
Sample Request
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--data-raw '
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "{{DESTINATION_NUMBER}}",
"type": "template",
"template":
{
"name": "pix_test_template",
"language":
{
"policy": "deterministic",
"code": "en"
},
"components":
[
{
"type": "button",
"sub_type": "order_details",
"index": 0,
"parameters":
[
{
"type": "action",
"action":
{
"order_details":
{
"reference_id": "001517",
"type": "digital-goods",
"payment_type": "br",
"payment_settings":
[
{
"type": "pix_dynamic_code",
"pix_dynamic_code":
{
"code":"00020101021226900014br.gov.bcb.pix2568pix.sicoob.com.br/qr/payload/v2/085e4c08-dede-404f-b312-
6566c55d4b105204000053039865802BR5925VINICIUS SOARES DA SILVEI6013Nao_informado62070503***63041235",
"merchant_name": "Account holder name",
"key": "2461684000xxxx",
"key_type": "CNPJ"
}
}
],
"currency": "BRL",
"total_amount":
{
"value": 100,
"offset": 100
},
"order":
{
"status": "pending",
"tax":
{
"value": 0,
"offset": 100,
"description": "optional text"
},
"items":
[
{
"retailer_id": "1234567",
"name": "Cake",
"amount":
{
"value": 100,
"offset": 100
},
"quantity": 1
}
],
"subtotal":
{
"value": 100,
"offset": 100
}
}
}
}
}
]
}
]
}
}'
Sample Response
{
"messages":
[
{
"id": "GUPSHUP_MESSAGE_ID"
}
],
"messaging_product": "whatsapp",
"contacts":
[
{
"input": "DESTINATION_PHONE_NO",
"wa_id": "DESTINATION_PHONE_NO"
}
]
}
Status Codes
Status Code | Response | Comments |
---|---|---|
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 |