API reference
Send message API
The following guide will help you understand Gupshup's send message API. Using a single endpoint, you can send various messages to users on WhatsApp.
API Endpoint
Headers
Header | Value |
---|---|
Content-Type | application/x-www-form-urlencoded |
api_key | Your Gupshup account API key |
Request body
Key | Type | Description | Example |
---|---|---|---|
channel | string | The channel for sending messages. | |
source | string | For Live apps - Your registered WhatsApp Business API phone number. For Sandbox apps - Gupshup's sandbox/proxy number 917834811114 The number must be in E. 164 format. | 917834811114 |
src.name | string | The Gupshup app name registered against the phone number provided in the API. | DemoAPI |
destination | string | User's phone number. | 919876543210 |
message | object | The message object will change depending on the type of message. | Refer message object description |
disablePreview | Boolean | Optional This will enable/disable preview for media messages. | true |
encode | Boolean | Optional This flag is used for sending an emoji in an Interactive List message. If the list message consists of emojis, set the encode flag to 'true'. This flag will not affect any other type of message. | true |
API Response
Send message API requests received by our platform are processed asynchronously, and hence you will always get an HTTP_SUCCESS(200 to 299) response range if the API request made is correct. The API response includes an object with a Gupshup unique message identifier and status as submitted. Your callback URL/webhook will receive a message event stating the submitted message to the WhatsApp API client(which eventually sends the message to the customer) is enqueued or has failed.
Header | Value |
---|---|
Content-Type | text/html |
{
"status":"submitted",
"messageId":"ee4a68a0-1203-4c85-8dc3-49d0b3226a35"
}
The Gupshup unique message identifier that is the messageId
in the API response will help you track messages through the inbound message events - enqueued, failed, sent, delivered, and read that you obtain on your webhook/callback URL.
Updated 4 months ago