Send an image on WhatsApp.
http://HOST:PORT/base64/imageSend a JSON body.
| Parameter | Required | Description |
recipient |
YES | The phone number to send to. |
file |
YES | The file, base64 encoded. |
caption |
NO | A caption for the image. |
name |
YES | The name of the file, for example Image_File.png. |
isDocument |
NO | true to send the image as a document, false to send it as a picture. |
password |
YES | The password for your WhatsApp app. Ask us for it. |
curl --location --request POST 'http://HOST:PORT/base64/image' \
--header 'Content-Type: application/json' \
--data '{
"recipient": "recipient",
"file": "base64_encoded_file_content",
"caption": "Your caption here",
"name": "Image_File.png",
"password": "Ask_for_the_password",
"isDocument": "true/false"
}'
curl --location --request POST "http://HOST:PORT/base64/image" ^
--header "Content-Type: application/json" ^
--data "{\"recipient\":\"recipient\",\"file\":\"base64_encoded_file_content\",\"caption\":\"Your caption here\",\"name\":\"Image_File.png\",\"password\":\"Ask_for_the_password\",\"isDocument\":\"true/false\"}"
<?php
$headers = [
'Content-Type: application/json',
];
$data = [
'recipient' => 'recipient',
'file' => 'base64_encoded_file_content',
'caption' => 'Your caption here',
'name' => 'Image_File.png',
'password' => 'Ask_for_the_password',
'isDocument' => 'true/false'
];
$ch = curl_init('http://HOST:PORT/base64/image');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
const axios = require('axios');
axios.request({
method: 'post',
url: 'http://HOST:PORT/base64/image',
headers: {
'Content-Type': 'application/json'
},
data: {
"recipient": "recipient",
"file": "base64_encoded_file_content",
"caption": "Your caption here",
"name": "Image_File.png",
"password": "Ask_for_the_password",
"isDocument": "true/false"
}
}).then((res) => console.log(res.data))
.catch((err) => console.error(err.response ? err.response.data : err.message));
import requests
headers = {
'Content-Type': 'application/json'
}
payload = {
'recipient': 'recipient',
'file': 'base64_encoded_file_content',
'caption': 'Your caption here',
'name': 'Image_File.png',
'password': 'Ask_for_the_password',
'isDocument': 'true/false'
}
response = requests.request('POST', 'http://HOST:PORT/base64/image', headers=headers, json=payload)
print(response.json())