Sending Image Messages
Use this api to send image messages.
API_TOKEN
Developers can authenticate their API calls with the API_TOKEN
generated in App Dashboard > Phone Numbers > Detail > Api
. To send a image message, make a POST
call to /messages
and attach a message object with type=image
.
Parameters
This is the main parameter used in send image message requests:
Name | Description |
---|---|
to | Required WhatsApp ID or phone number for the person you want to send a message to. The phone numbers in this requests can be provided in any dialable format, as long as they include their country code. It's recommended that you explicitly prefix the country code with a plus sign (+). Here are some examples of supported phone number formats:
|
reply_message_id | Optional You can send any message as a reply to a previous message in a conversation by including the previous message's ID. The recipient will receive the new message along with a contextual bubble that displays the previous message's content. |
type | Required The type of message you want to send. Set this as individual image . |
image | Required A image object. |
image.id | Optional Required when you are not using a link.The media object ID. |
image.link | Optional Required when you are not using an uploaded media ID.The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. |
image.caption | Optional Describes the specified image. |
Example
Sample request:
curl -X POST 'https://waofficial.botika.online/api/whatsapp/v1/messages' \ -H 'Authorization: Bearer {{ API_TOKEN }}' \ -H 'Content-Type: application/json' \ -d '{ "to": "+62821xxxxxx", "reply_message_id": "{{ MESSAGE_ID }}", "type": "image", "image": { "id": "{{ MEDIA_ID }}", # OR "link": "http(s)://image-url", "caption": "IMAGE_CAPTION" } }'
A successful response includes an object with an identifier for the message:
{ "data": { "id": "{{ MESSAGE_ID }}" } }