Skip to content

Image Message

Image message using type: "image" with the imageobject. You can send an image via a Public URL (link) or media ID (id) that was previously uploaded.

{
"messaging_product": "whatsapp",
"to": "6281234567890",
"type": "image",
"image": {
"link": "https://example.com/produk.jpg",
"caption": "Produk terbaru kami!"
}
}
{
"messaging_product": "whatsapp",
"to": "6281234567890",
"type": "image",
"image": {
"id": "f7a816e2-8397-11f0-8e34-010203040506",
"caption": "Produk terbaru kami!"
}
}
FieldTypeRequiredDescription
linkstringYes*Public URL to the image file. The system will download and send it.
idstring (UUID)Yes*Media ID from a previous upload via endpoint /media.
captionstringNoImage caption, maximum 1024 characters.

* Use one of: link or id. If both are included, id takes precedence.

FormatExtensionMaximum Size
JPEG.jpg, .jpeg5 MB
PNG.png5 MB
WebP.webp5 MB
Terminal window
curl -X POST https://messaging.mahadata.io/v1/YOUR_PHONE_NUMBER_ID/messages \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"messaging_product": "whatsapp",
"to": "6281234567890",
"type": "image",
"image": {
"link": "https://example.com/produk.jpg",
"caption": "Lihat produk terbaru kami!"
}
}'
{
"messaging_product": "whatsapp",
"messages": [
{
"id": "msg_f7a816e2-8397-11f0-8e34-010203040506"
}
]
}
  1. message.status.sent — Image was successfully sent to the WhatsApp network
  2. message.status.delivered — Image reached the recipient’s device
  3. message.status.read — Image was opened by the recipient

If it fails, you receive message.status.failed.

See the page Webhook for details on the payload format of each event.