Image messages are messages that display a single image and an optional caption.
Use the POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages endpoint to send an image message to a WhatsApp user.
POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages
{ "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>" } }
Placeholder | Description | Example Value |
---|---|---|
String | Optional. Image caption text. Maximum 1024 characters. |
|
String | Required if using an uploaded media asset (recommended). Uploaded media asset ID. |
|
String | Required if linking to your media asset (not recommended) URL of image asset on your public server. For better performance, we recommend that you upload your media asset instead. |
|
String | Required. WhatsApp user phone number. |
|
Image Type | Extension | MIME Type | Max Size |
---|---|---|---|
JPEG | .jpeg | image/jpeg | 5 MB |
PNG | .png | image/png | 5 MB |
Example request to send an image message with a caption to a WhatsApp user.
curl 'https://graph.facebook.com/v21.0
/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "+16505551234",
"type": "image",
"image": {
"id" : "1479537139650973",
"caption": "The best succulent ever?"
}
}'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "+16505551234", "wa_id": "16505551234" } ], "messages": [ { "id": "wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI1RjQyNUE3NEYxMzAzMzQ5MkEA" } ] }