Want to send a fax from a different fax number to my ring central number or account(admin portal) using RingCentral sdk (fax API)
The code I am using is:-
require('vendor/autoload.php');
$dotenv = DotenvDotenv::createImmutable(__DIR__ . '/../');
$dotenv->load();
$RECIPIENT = $_ENV['FAX_RECIPIENT'];
$rcsdk = new RingCentralSDKSDK( $_ENV['RC_CLIENT_ID'],
$_ENV['RC_CLIENT_SECRET'],
$_ENV['RC_SERVER_URL'] );
$platform = $rcsdk->platform();
$platform->login( [ "jwt" => $_ENV['RC_JWT'] ] );
$request = $rcsdk->createMultipartBuilder()
->setBody(array(
'to' => array(array('phoneNumber' => $RECIPIENT)),
'faxResolution' => 'High',
))
->add(fopen('test.jpg', 'r'))
->request('/account/~/extension/~/fax');
$resp = $platform->sendRequest($request);
print_r ("FAX sent. Message status: " . $resp->json()->messageStatus);