I need to send the generated PDF as a whatsapp message, but it shows an error when I try to read my file.
easyinvoice.createInvoice(data, function(result) {
//The response will contain a base64 encoded PDF file
fs.writeFileSync("invoice.pdf", result.pdf, 'base64');
var s = result.pdf;
client.messages
.create({
mediaUrl: s,
body: 'invoice',
from: 'whatsapp:+somenumber',
to: 'whatsapp:+somenumber'
})
.then(message => console.log(message.sid))
.done();
});