Use this API to send a text message to a WhatsApp user.
Text messages are messages containing only a text body and an optional link preview.
Request Parameters
Key | Description | Values | Data Types | Required/Optional | Constraints |
---|---|---|---|---|---|
Authorization | Access Token for the application | {{PARTNER_APP_TOKEN}} | String | Required | Should be a valid Partner App Access Token. |
APP ID | App ID to fetch the access token |
| 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 |
| String | Required | Must be a valid phone number. |
type | Messaging type | interactive | String | Required | Type should be |
text | Text message inside body |
| Object | Required | Key should be |
Sample Request
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "{{WHATSAPP_USER_PHONE_NUMBER}}",
"type": "text",
"text": {
"body": "{{TEXT_BODY}}"
}
}'
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 |
| |
Error | ||
401 |
| When API key authentication fails |
400 |
| If Callback billing is not enabled for the app |
400 | { | If app details are not found |