Node.JS Fax - Cancel outbound faxes in process

This is a Node.JS code sample to show how to retrieve the list of all faxes submitted and cancel those faxes that are still in process. This code sample is based on the Node.JS library for InterFAX available on Github.

This sample demonstrates how to retrieve all of the faxes submitted to InterFAX and then looping through all faxes and checking the status of each fax -- if the status of the fax is < 0 (i.e. still in process), the sample shows how to submit a request to cancel this fax.

  
     // get all recent faxes
interfax.outbound.all()
  .then(cancelPending);

// cancel all processing faxes
function cancelPending(faxes) {
  for (var fax in faxes) {
    if (fax.status < 0) {
      fax.cancel();
    }
  }
}

  

Please note, once a fax has been cancelled, the fax will be marked with a special status code and no further attempts will be made on this fax.

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today