SendMedia

Api Docs Sending Media Messages

SendMedia is an API that allows you to send media messages to WhatsApp numbers.

Endpoint : {!! config('app.base_node') !!}/api/send-media
Method : POST
media_type : image, video, audio, file
Download Example PHP : Download

{
  "api_key" => "{!! $main_device->api_key !!}",
  "receiver" => "628xxxxxxxx",
  "data": {
    "url": "https://i.ibb.co/QbmsBqs/code.png",
    "media_type": "image",
    "caption": "Hello World"
  }
}

curl -X POST \
'{!! config('app.base_node') !!}/api/send-media' \
--header 'Accept: */*' \
--header 'Content-Type: application/json' \
--data-raw '{
  "api_key": "{!! $main_device->api_key !!}",
  "receiver": "628xxxxxxxx",
  "data": {
    "url": "https://i.ibb.co/QbmsBqs/code.png",
    "media_type": "image",
    "caption": "Hello World"
  }
}

$body = array(
  "api_key" => "{!! $main_device->api_key !!}",
  "receiver" => "628xxxxxxxx",
  "data": array(
    "url" => "https://i.ibb.co/QbmsBqs/code.png",
    "media_type" => "image",
    "caption" => "Hello World"
  )
);

$curl = curl_init();
curl_setopt_array($curl, [
  CURLOPT_URL => "{!! config('app.base_node') !!}/api/send-media",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode($body),
  CURLOPT_HTTPHEADER => [
    "Accept: */*",
    "Content-Type: application/json",
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}