GET http://localhost:8080
Send Message Text
<?php
$curl = curl_init();
$data = [
'act' => 'send_message',
'phone' => '081XXXXXXX',
'caption' => base64_encode('test pesan from ezwapi.com'),
'type' => 'text',
'to' => '081XXXXXXX',
];
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, "http://localhost:8080?".http_build_query($data));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($curl);
curl_close($curl);
print_r($result);
?>
GET http://localhost:8080
Send Message File
<?php
$curl = curl_init();
$data = [
'act' => 'send_message',
'phone' => '081XXXXXXX',
'caption' => base64_encode('test pesan from ezwapi.com'),
'url' => base64_encode('http://example.com/test.jpg'),
'type' => 'file',
'to' => '081XXXXXXX',
];
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, "http://localhost:8080?".http_build_query($data));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($curl);
curl_close($curl);
print_r($result);
?>
Request parameters:
act |
Required |
send_message |
type |
Required |
file |
phone |
Required |
Whatsapp numbers that will send messages. You can use the country code prefix or not. Example: 081223xxxx |
to |
Required |
Whatsapp numbers that will receive messages. You can use the country code prefix or not. Example: 081223xxxx |
caption |
Required |
Base64 encode Text message to be sent. Format: UTF-8 or UTF-16 string. for single newline (\n), double newline (\n2) |
url |
Required |
Base64 encode url file (jpg, png, txt, pdf, doc, docx, xls, csv, xml, zip, mp3, mp4) |
GET http://localhost:8080
Filter Number
<?php
$curl = curl_init();
$data = [
'act' => 'filter_number',
'phone' => '081XXXXXXX',
'target' => '081XXXXXXX',
];
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, "http://localhost:8080?".http_build_query($data));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($curl);
curl_close($curl);
print_r($result);
?>
Request parameters:
act |
Required |
filter_number |
phone |
Required |
Whatsapp numbers that will send messages. You can use the country code prefix or not. Example: 081223xxxx |
target |
Required |
Whatsapp numbers that will receive messages. You can use the country code prefix or not. Example: 081223xxxx |
Webhook
Code webhook
<?php
header('Content-Type: application/json');
if(isset($_POST['data'])){
$data = json_decode($_POST['data'],true);
$result['from'] = $data['sender']['id'];
$result['name'] = $data['sender']['name'];
$result['to'] = $data['to'];
$result['message'] = $data['body'];
print_r(json_encode($result));
}
die();
Output Webhook:
{"from":"[email protected]","name":"ezWapi","to":"[email protected]","message":"Test message"}