Anyone else having problems with Xero node and Contacts?

Describe the issue/error/question

We’ve been using the Xero node to add/update Contacts for some time now with great success.

Specifically, when a contractor’s bank details are updated in our CRM, it sends a webhook with the update to N8N, which then, amongst other things, looks for the Contact in Xero, and either updates it, or creates it if it wasn’t there already.

This was working fine until recently.

If the Contact already exists, and we need to update the Bank Details (most common request), the call executes ok, but the result is NOT changed, and so we have to compare the returned value to the value we passed in and alert the user that the change failed and it needs to be done manually.

This, too, was working fine until recently.

Looking at the TS code in github, it looks ok to me, so I’m wondering if there is a problem at the Xero end. Ideally, I’d like to have a debug statement to log EXACTLY what was sent to Xero before I try and approach them with “Hey Mr. Xero, your API doesn’t work!”.

So, is anyone else having success (or failure) with Contacts in Xero now?

What is the error message (if any)?

Now, when we’re trying to create a new Contact, we get the following error, which suggests that the parameters into the node weren’t passed out in the HTTP call to Xero.

{“message”:“400 - {“ErrorNumber”:10,“Type”:“ValidationException”,“Message”:“A validation exception occurred”,“Elements”:[{“ContactID”:“00000000-0000-0000-0000-000000000000”,“Addresses”:[],“Phones”:[],“ContactGroups”:[],“ContactPersons”:[],“HasValidationErrors”:true,“ValidationErrors”:[{“Message”:“Contact name cannot be empty”}]}]}”,“name”:“Error”,“stack”:“Error: Request failed with status code 400\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (events.js:327:22)\n at endReadableNT (internal/streams/readable.js:1327:12)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)”}

The fields are definitely filled, and I can see the values in the failed execution, so it’s as though the content parameters are not being passed to the Xero API call.

Please share the workflow

Even a simple test workflow with dummy content fails to create a Contact when it should succeed (and did previously).

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "resource": "contact",
        "organizationId": "df3094b1-8d76-4771-959e-4872dcbe1809",
        "name": "Test Contact",
        "additionalFields": {}
      },
      "name": "Xero",
      "type": "n8n-nodes-base.xero",
      "typeVersion": 1,
      "position": [
        460,
        300
      ],
      "credentials": {
        "xeroOAuth2Api": {
          "id": "11",
          "name": "Xero Accounts"
        }
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Xero",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:0.163.1
  • **Database you’re using (default: SQLite):SQLite
  • **Running n8n with the execution process [own(default), main]:own
  • **Running n8n via [Docker, npm, n8n.cloud, desktop app]:Docker
  • **Accessing Xero in: Australia

Hi @ttsadmin, welcome to the community :tada:

I’m so sorry to hear you’re having trouble here. It looks like my Xero trial account has expired since I last looked at it but I shall set up a new one and give this a go.

I managed to reproduce the behaviour @ttsadmin and am a bit puzzled here tbh. I threw a bunch of console.log statements at our code to observe the request sent to Xero’s API. The payload includes "Contacts":[{"Name":"Foo"}], which appears to be the format required by Xero as per their documentation.

Even when rewriting the node code to use the “single contact” format without the aforementioned Contacts array I was getting the same error message.

I shall add this to our internal bug tracker for a closer look by the product & engineering teams but reaching out to Xero’s support from your end might be a good idea as well.

1 Like

Thank you @MutedJam , I am not surprised.

I will definitely contact them now that I know it’s not “our end” :slight_smile:

Of course, getting through the layers of “community experts” to someone who understands that we’re making correct API calls that are not behaving as expected is going to take some time.

Will keep you posted.

Cheers,

Matt

I just had the thought to try it in my free Integromat account, and I’m sorry to say that in there it worked as expected :frowning:

I can’t imagine they’re using a different API call to N8N, and it doesn’t appear to be an authentication issue … very puzzling.

Hi @ttsadmin
One of our engineers just checked it and could not reproduce the behaviour, it worked perfectly fine for creating, updating and getting contacts. Could you please check on your end as well?
Maybe it indeed was an issue on Xero’s side after all

@Michael_Kret

Got addressed in this PR.

2 Likes

Thanks everyone, yes I can confirm it is again working now :slight_smile:

Cheers

1 Like

Hi Everyone,

On n8n 0.173.1 and am now getting the same issue again

That is - it won’t pull the organization ID’s

Not sure if it stopped working for us as well (on 0.173.1) as I didn’t check, but I can confirm that it is working as expected on 0.178.2

1 Like