question

Keshab Acharya avatar image
Keshab Acharya asked Phong Vu answered

How can i send multiple fax to a single phone ?

It was mentioned in SMS and Fax API documentation that developers can send one or more documents at a time to a single recipient.

fax
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

I think you made a mistake in the title "multiple fax ...", coz your question is about "one or more documents at a time..."

To send multiple documents in a fax, just append more attachments to the FormData. Here is an example in Node JS using the RingCentral JS SDK.

async function send_fax() {
  try{

    var endpoint = "/restapi/v1.0/account/~/extension/~/fax"

    var FormData = require('form-data');
    formData = new FormData();
    var bodyParams = {
      to: [{'phoneNumber': RECIPIENT}],
      faxResolution: 'High',
      coverPageText: "This is a demo Fax page from Node JS"
    }

    formData.append('json', new Buffer.from(JSON.stringify(bodyParams)), {
        contentType: 'application/json'
        });

    formData.append('attachment', require('fs').createReadStream('test1.jpg'));
    formData.append('attachment', require('fs').createReadStream('test2.png'));
    formData.append('attachment', require('fs').createReadStream('test3.png'));

    var resp = await platform.post(endpoint, formData)
    var jsonObj = await resp.json()
    console.log("FAX sent. Current status: " + jsonObj.messageStatus + "/" + jsonObj.id)
    checkFaxStatus(jsonObj.id)
  }catch(e){
    console.log(e.messsage)
  }
}

async function checkFaxStatus(id){ 
  try{
    var resp = await platform.get(`/restapi/v1.0/account/~/extension/~/message-store/${id}`) 
    var jsonObj = await resp.json()
    console.log(jsonObj)
    if (jsonObj.messageStatus == 'Queued'){
      setTimeout(function () {
        checkFaxStatus(id)
      }, 5000)
    }
  }catch(e){
    console.log(e.message)
  }
}
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys