Send an Image
Method sends a image message to a single recipient
Url:
https://ongair.im/api/v1/base/send_image
Method:
POST
Params:
Field | Type | Mandatory | Format | Meaning |
---|---|---|---|---|
phone_number | String | Yes | (country code)(phone number) e.g. 254722200200 | Phone number to send to |
image | String/File | Yes | Either the URL of the image (must be publicly accessible) or the image uploaded | The image to be sent |
Caption | String | No | The caption for the image | A brief text to accompany the image |
content_type | String | Yes | image/file_extension_here eg image/jpg or /image/png etc. | The content type of the image file you want to send |
Response:
The server responds with a JSON message:
{"sent":true,"id":2067}
Field | Type | Meaning |
---|---|---|
sent | Boolean | True or False if the image |
id | Integer | An Identifier for the message. This is used when delivering receipts |
At this stage, the message has been sent to the WhatsApp server for delivery
Error:
If there is an error or the phone number does not exist, the server returns an error message and response code of 422.
{"error":"Contact with phone number 25470586564 does not exists"}