onst rcsdk = new RC({
server: RINGCENTRAL_SERVER,
clientId: RINGCENTRAL_CLIENTID,
clientSecret: RINGCENTRAL_CLIENTSECRET,
});
const platform = rcsdk.platform();
platform.login({
jwt: RC_JWT,
});
platform.on(platform.events.loginSuccess, async () => {
const form = new FormData();
await send_fax(form);
});
const send_fax = async (formData) => {
const body = {
to: [{ phoneNumber: RECIPIENT }],
faxResolution: "High",
coverPageText: "This is a demo Fax page from Node JS",
};
formData.append("json", Buffer.from(JSON.stringify(body)), {
filename: "request.json",
contentType: "application/json",
});
formData.append(
"attachment",
require("fs").createReadStream("../../../assets/SampleFAXOut.pdf"),
{
filename: "testfax.pdf",
contentType: "application/pdf",
}
);
try {
// const token = Buffer.from(
// `${RINGCENTRAL_CLIENTID}:${RINGCENTRAL_CLIENTSECRET}`,
// "utf8"
// ).toString("base64");
const resp = await platform.post(
"/restapi/v1.0/account/~/extension/~/fax",
formData
// {
// Authorization: `Basic ${token}`,
// }
);
const jsonObj = await resp.json();
console.log("FAX sent. Message status: " + jsonObj.messageStatus);
} catch (e) {
console.log("Error Sending Fax:", e.message);
}
};Hi, I am using the above javascript code straight from here https://developers.ringcentral.com/guide/messaging/fax/sending-faxes, but I keep getting an "Authorization header is not specified" error I try the encoding also mentioned in dev guides with no luck. platform.events.loginSuccess is successful, all creds are valid. Is there something I am missing. I am running in a sandbox at the moment. can you please help?