Any one created NodeJS Version of sending Fax? (Not a browser base)

  • 1
  • Idea
  • Updated 4 months ago
Photo of Jayson Vacaro

Jayson Vacaro

  • 70 Points

Posted 4 months ago

  • 1
Photo of Phong Vu

Phong Vu, Devangelist

  • 5,406 Points 5k badge 2x thumb
Hi Jayson,

Here you go. Just install the RingCentral Node JS SDK and the dotenv packages. Specify your app and login credentials in the .env file and run this code:

var RC = require('ringcentral')
var rcsdk = new RC({
  server: process.env.SERVER,
  appKey: process.env.APP_KEY,
  appSecret: process.env.APP_SECRET
var platform = rcsdk.platform()
function login(){
    username: process.env.USERNAME,
    password: process.env.PASSWORD
    throw e
function sendFAXMessage() {
  var toNumber = 'valid fax phone number'
  var FormData = require('form-data');
  formData = new FormData();
  var body = {
      to: [{'phoneNumber': toNumber}],
      faxResolution: 'High',
      coverPageText: "This is a demo Fax page"
  // This is the mandatory part, the name and type should always be as follows
  formData.append('json', new Buffer(JSON.stringify(body)), {filename: 'request.json', contentType: 'application/json'});
  var fs = require('fs');
  var sendFile = 'test.jpg'
  formData.append('attachment', fs.createReadStream(sendFile));
  return platform
    .post('/account/~/extension/~/fax', formData)
    .then(function (response) {
        console.log("FAX sent")
    .catch(function(e) {
        throw e;

Hope this helps!

+ Phong