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.
Request Body
Section titled “Request Body”Via URL (link)
Section titled “Via URL (link)”{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "image", "image": { "link": "https://example.com/produk.jpg", "caption": "Produk terbaru kami!" }}Via Media ID (id)
Section titled “Via Media ID (id)”{ "messaging_product": "whatsapp", "to": "6281234567890", "type": "image", "image": { "id": "f7a816e2-8397-11f0-8e34-010203040506", "caption": "Produk terbaru kami!" }}Field image
Section titled “Field image”| Field | Type | Required | Description |
|---|---|---|---|
link | string | Yes* | Public URL to the image file. The system will download and send it. |
id | string (UUID) | Yes* | Media ID from a previous upload via endpoint /media. |
caption | string | No | Image caption, maximum 1024 characters. |
* Use one of: link or id. If both are included, id takes precedence.
Supported Formats
Section titled “Supported Formats”| Format | Extension | Maximum Size |
|---|---|---|
| JPEG | .jpg, .jpeg | 5 MB |
| PNG | .png | 5 MB |
| WebP | .webp | 5 MB |
Complete Example
Section titled “Complete Example”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!" } }'import requests
url = "https://messaging.mahadata.io/v1/YOUR_PHONE_NUMBER_ID/messages"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}payload = { "messaging_product": "whatsapp", "to": "6281234567890", "type": "image", "image": { "link": "https://example.com/produk.jpg", "caption": "Lihat produk terbaru kami!" }}
response = requests.post(url, json=payload, headers=headers)print(response.json())const response = await fetch( 'https://messaging.mahadata.io/v1/YOUR_PHONE_NUMBER_ID/messages', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ messaging_product: 'whatsapp', to: '6281234567890', type: 'image', image: { link: 'https://example.com/produk.jpg', caption: 'Lihat produk terbaru kami!', }, }), });const data = await response.json();console.log(data);Response
Section titled “Response”{ "messaging_product": "whatsapp", "messages": [ { "id": "msg_f7a816e2-8397-11f0-8e34-010203040506" } ]}Webhook Statuses You Will Receive
Section titled “Webhook Statuses You Will Receive”message.status.sent— Image was successfully sent to the WhatsApp networkmessage.status.delivered— Image reached the recipient’s devicemessage.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.