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

1 Like

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?

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 Configuring your server | Xero Developer
What do you think please?

1 Like

Any update on how to tackle Xero webhooks intent-to-receive response in n8n?

Hey @sscarduzio,

Looking at the Xero documentation something like the workflow below might do the job although I have not tested it so you may need to make some changes.

Example Workflow
1 Like

Hi @Jon thanks for providing a starting point, but it was more complicated than a sha256, so I had to move to a function in order to make this work.

NB: I had to add this environment variable to n8n in order to make the function work:

NODE_FUNCTION_ALLOW_BUILTIN=crypto

4 Likes

Hey @sscarduzio,

Nice work, One day I will set up a Xero test environment to have a play and see if we can do it with the standard nodes.

1 Like

I’m no expert about n8n basic building blocks but, it looks a bit convoluted.

I’d rather wish the Xero node would provide a special “Xero webhook” module with a xero_webhook_key configuration parameter.

For context, I based my JS implementation on this article, which uses this code.

1 Like

Hi @sscarduzio,

It would probably be a new trigger node for Xero that would be needed, I can’t see an existing feature request for one though so it could be worth creating one.

1 Like

Thanx @sscarduzio for the example. I was battling this for a few hours.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.