Skip to main content

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);

To send a fax message using the Fax API, you cannot set the "from" phone number. The server will choose the preselected fax number from your extension outbound Fax settings in your [user extension service portal](https://service.ringcentral.com). If you want to change the default Outbound Fax settings (send from a company Fax number) for your extension, login the admin portal and change the Fax number to your own number.

screen-shot-2023-05-08-at-83121-am.png


Reply