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

HeaderValue
Content-Typeapplication/x-www-form-urlencoded
api_keyYour Gupshup account API key

Request body

KeyTypeDescriptionExample
channelstringThe channel for sending messages.whatsapp
sourcestringFor 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.namestringThe Gupshup app name registered against the phone number provided in the API.DemoAPI
destinationstringUser's phone number.919876543210
messageobjectThe message object will change depending on the type of message.Refer message object description
disablePreviewBooleanOptional
This will enable/disable preview for media messages.
true
encodeBooleanOptional
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.

HeaderValue
Content-Typetext/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.


What’s Next