Image Message

Use this API to send an image message to a WhatsApp user.

Image messages are messages that display a single image with a caption (optional).

Request Parameters

KeyDescriptionValuesData TypesRequired/OptionalConstraints
AuthorizationAccess Token for the application{{PARTNER_APP_TOKEN}}StringRequiredShould be a valid Partner App Access Token.
APP IDApp ID to fetch the access tokenbf9ee64c-3d4d-4ac4-xxxx-732e577007c4StringRequiredThe Id should be a valid app Id of Gupshup
messaging_productMessaging productwhatsappStringRequired
recipient_typeRecipient typeindividualStringRequired
toDestination phone no where the message need to be send91785876xxxxStringRequiredMust be a valid phone number.
typeMessaging typeinteractiveStringRequiredType should be interactive to send address message.
imageAdd image or link inside body{"image": { "id" : "1479537139650973", "caption": "The best succulent ever?" }}ObjectRequiredKey should be image to send image message.

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": "image",
  "image": {
    "id" : "{{MEDIA_ID}}", /* Only if using uploaded media */
    "link": "{{MEDIA_URL}}", /* Only if linking to your media */
    "caption": "{{IMAGE_CAPTION_TEXT}}"
  }
}'

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
401{"status": "error", "message": "Authentication Failed"}When API key authentication fails
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
Language
Click Try It! to start a request and see the response here!