Skip to main content

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

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