1. Home
  2. Docs
  3. Dokumentasi API
  4. POST /api/send-image-group-from-local

POST /api/send-image-group-from-local

<?php   
$token = "";                                     
$filename = $_FILES['upload_file']['tmp_name'];
$handle = fopen($filename, "r");
$file = fread($handle, filesize($filename));

$params = [
    'groupId' => '154xxxxx',
    'phone' => '081XXXXXXX',
    'caption' => 'hi', // can be null 
    'file' => base64_encode($file),
    'data' => json_encode($_FILES['upload_file'])
];

/**
 * bulk message
$params = [
    'phone' => '081XXXXXX91,0850011xxx',
    'caption' => 'hi', // can be null 
    'file' => base64_encode($file),
    'data' => json_encode($_FILES['upload_file'])
];
 */

$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER, [ "Authorization: $token" ] );
curl_setopt($curl, CURLOPT_URL, "http://app.absen.co.id/api/send-image-from-local");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($curl);
curl_close($curl);

echo "<pre>";
print_r($result);
?>
Request parameters:
AuthorizationRequiredYour Token from http://app.absen.co.id, can be seen in the menu: Device – Setting
groupIdRequiredThe ID number of WhatsApp group. You can check on message menu to looking ID Whatsapp group. Example: 15423xxxx
phoneRequiredWhatsapp numbers who is creator of group and don’t forget sender number must be admin of group. You can use the country code prefix or not. Example: 081223xxxx
captionOptionalText image must on the format: UTF-8 or UTF-16 string
support extensionjpg, jpeg, png, gif