Skip to main content
Question

How can i send multiple fax to a single phone ?

  • October 5, 2023
  • 1 reply
  • 64 views

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

1 reply

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2344 replies
  • October 5, 2023

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

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings