Install the Fax.Plus Javascript SDK package

// with npm
npm install @alohi/faxplus-api

// with yarn
yarn add @alohi/faxplus-api

Getting Started

const axios = require('axios');
const Configuration = require('@alohi/faxplus-api').Configuration;
const FaxesApiFp = require('@alohi/faxplus-api').FaxesApiFp;
const FilesApiFp = require('@alohi/faxplus-api').FilesApiFp;

const accessToken = "YOUR_ACCESS_TOKEN"
const configuration = new Configuration({
    accessToken: accessToken,
    basePath: 'https://restapi.fax.plus/v3',
});

// Get the first entry in the corporate member's inbox
const request = await FaxesApiFp(configuration).listFaxes({userId: "self"});

const response = await request(axios);

const cdrId = response.data.data.records[0].id;

// Upload file
const request = await FilesApiFp(configuration).uploadFile("self",
  fs.createReadStream("./test/sample.pdf")
);

const response = await request(axios);

// Send fax