Uploading Attachment to Xero using Xero node or HTTP

Hi There,

Been messing around with n8n for a few weeks now - good job guys!! Next best thing to sliced bread!

I’ve been trying to create a workflow where i can generate an invoice to a customer as well as attach an excel sheet. I run a query using the postgres node and from that data generate a spreadsheet. So far all good from here.

Next i want to create an invoice using the Xero node (also, so far so good). Then use the invoice ID that was created in the previous node and do an update to the earlier created invoice and attach the spreadsheet file (binary). The current node does not support this as according to xero’s documentation the scope required for uploading attachments is accounting.attachments.

I have also tried using the HTTP Request node - but not getting too much luck with the Authentication.

I guess my question is 2 fold:

  1. To add the accounting.attachment scope to the existing node - is this possible?
  2. Has anybody had success with the HTTP Request node to authenticate with Xero? And if so, would it be possible to share what you did to get it working?

Thanks in advance.

Hi @kevintee, welcome to the community!

I am sorry to hear you’re having trouble. Adding a new scope requires changing n8n’s source code, in particular this file: n8n/XeroOAuth2Api.credentials.ts at master · n8n-io/n8n · GitHub

You should, however, be able to use Generic OAuth2 credentials as well. The file above shows what n8n’s Xero credentials use and you should be able to configure the same setting in the UI. Can you confirm which problem exactly you are getting when trying to authenticate?