sending Video file mp4 via clickatel whatsapp api

73 Views Asked by At

I have a video file on a server that I would like to send via clickatell's whatsapp API, but I keep getting this error:

[statusCode] => 23
[status] => DELIVERY_FAILURE
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://platform.clickatell.com/v1/message');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"messages\": [{ \"channel\": \"whatsapp\", \"to\": \"27607876384\", \"media\": {
        \"fileId\": \"dcd97e173a484ed4bf3f22953103509a.mp4\",
        \"caption\": \"First Image File\"}}]}");

$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Accept: application/json';
$headers[] = 'Authorization: 9-QxGt35SM-CMm-060G5tA==';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $result;
}
curl_close($ch);

It would be great to do this inline, if possible.

0

There are 0 best solutions below