A step by step tutorial to get you started with creating custom fax cover page in Node.js.
Start TutorialTo install NPM, please install Node.js
Edit the .env
file to configure your client ID, client secret and redirect URL, etc.
$ cp .env.sample .env
$ vi .env
Please visit Developer Portal to apply client ID and secret. And ensure the redirect URI in your config file has been entered in your app settings. By default, the URL is set to the following for this demo:
http://localhost:8080/callback
In the node.js entry file, create RingCentral SDK instance with parameters from the configuration file.
RingCentral platform accepts fax data in the form of multipart/form-data
. In node.js, we use a module form-data
to create multipart/form-data
conveniently. This is our fax data holder.
Fax meta data is a json object where we can specify receivers, fax resolution and other properties of fax. After creating the meta data, append it to the formData
.
RingCentral custom fax cover page can be rendered from HTML. Create an HTML page by Handlebars
template engine. Append the HTML to the formData
and set the contentType
as text/html
.
RingCentral custom fax cover page can be also rendered from PDF and multiple custom cover pages are accepted. Read the PDF file with node.js file stream and append it to the formData
and set the contentType
as application/pdf
. Now the fax data is ready.
Log into RingCentral with password authentication flow.
After login, make POST
request to RingCentral platform fax endpoint /account/~/extension/~/fax
along with formData
to send the fax.