Catching Xero Webhook

Hi,

I would like to be able to catch a webhook from Xero but the webhook endpoint url uses port 5678.

Xero support says “the webhook receiver would need to run on the standard port for https: 443. I’m afraid you aren’t able to use an alternative port.”

Is anyone aware of a workaround please?

Thank you

Paul

Hey @paul2000!

Can you please share how are you using n8n? Are you self-hosting it on your own server? If yes, did you follow all the steps mentioned here? This guide shows how to set up n8n with Trafik as a reverse proxy. All the requests are made to port 443 and Traefik redirects them to the relevant location.

Hi @harshil1712, Thank you for your reply. I am using n8n self hosted on vultr. I did not use docker to install. I have found this page Nginx configuration - #7 by Arnaud and I think I understand that I can edit the nginx profile and setup the proxy. Can I ask please once this is done will my existing webhooks still be reachable on port 5678 and 443 both? Or to put it another way will webhooks using port 443 work as well as those using port 5678. Thank you!

Hi @harshil1712, I have now sorted out my ports and can collect the data sent from the Xero webhook but I am having trouble sending the required response.

I have used the below node but I can not get the values to match. I have found this page: Keeping your integration in sync: Implementing Xero webhooks using Node, Express, and ngrok | by Rett Behrens | Xero Developer but I am still stuck. Do you know what the solution would be please?

{
  "nodes": [
    {
      "parameters": {
        "action": "hmac",
        "type": "SHA256",
        "value": "={{JSON.stringify($json[\"body\"])}}",
        "secret": "=MySecretKey",
        "encoding": "base64"
      },
      "name": "Crypto",
      "type": "n8n-nodes-base.crypto",
      "typeVersion": 1,
      "position": [
        620,
        300
      ]
    }
  ],
  "connections": {}
}

Hey @paul2000,

Are you getting a response in the Webhook node when you click on the Send 'Intent to receive’ button? I went through the article you shared and the Xero documentation. However, I am not sure what response we are supposed to send. Is it just the 200 status code?

Hi @harshil1712, I am getting the response when I click on the Send ‘Intent to receive’ but I am unable to send the response xero wants. Xero does want 200 status code but also xero sends a ‘x-xero-signature’ which needs to match the key after some encoding. Sorry I don’t fully understand that part, but my son who does setup the node I have already provided tells me the options selected are correct and he does not know why we are unable to get the values to match as required by xero. This page also explains about the encoding https://developer.xero.com/documentation/guides/webhooks/configuring-your-server#intent-to-receive
What do you think please?