I've created a custom action in the Zapier Developer Platform. My task is to load a PDF file from the Xero accounting software into Zapier so that I can use it in my zap to attach to an email.
So far I have the code below which returns a successful response, but unfortunately the PDF file is always blank:
const pdfURL = {
url: 'https://api.xero.com/api.xro/2.0/Quotes/' + bundle.inputData.QuoteID,
method: 'GET',
headers: {
'Accept': 'application/pdf',
'Authorization': `Bearer ${bundle.authData.access_token}`,
'Xero-tenant-id': bundle.inputData.TenantID
}
};
const fileRequest = await z.request(pdfURL);
const url = await z.stashFile(fileRequest); // knownLength and filename will be sniffed from the request. contentType will be binary/octet-stream
return {url};
Any ideas what could be wrong?
Thanks in advance.