'send excel file as base64 via using WhatsApp api with Ultramsg

I am trying to convert excel file to base64 to send WhatsApp API with Ultramsg :

<?php

require_once ('vendor/autoload.php'); // if you use Composer
//require_once('ultramsg.class.php'); // if you download ultramsg.class.php
$token=""; // Ultramsg.com token
$instance_id=""; // Ultramsg.com instance id
$client = new UltraMsg\WhatsAppApi($token,$instance_id);
$to=""; 
$filename="test.xlsx"; 
$document = base64_encode(file_get_contents("test.xlsx"));
$api=$client->sendDocumentMessage($to,$filename,$document);
print_r($api);

But I see this error :

Array
(
    [error] => Array
        (
            [0] => Array
                (
                    [document] => file extension not supported
                )

        )

)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source