Help setting up a Mendix app to consume Xero webhook events

0
I'm trying to subscribe to Xero webhook events, which should trigger a microflow that acts on a single field from the payload. I found this blog post with a very helpful description on how to get something similar running using Slack as an example. While I can see how to translate the blog post example to the Xero webhook, I am stuck on the authentication section.Xero seems to work differently, as described here. It seems that the webhook validation ("Intent to receive") requires computing an HMAC-SHA256 hash of the raw request body using a webhook signing key. Does anyone have any advice on how to process the Xero signature? Will this require a custom request handler? If yes, how can I set one up?
asked
1 answers
1

You can create a published rest service, point that to a microflow with a System.HttpRequest input parameter and then in the flow do the validation on HttpRequest.Content. You can retrieve the headers and find the right one using the find by expression list activity and condition something like

toLowerCase($currentObject/Key) = 'x-xero-signature' 

Then if the content is validated you can do your import mapping on the HttpRequest.

You can also add a System.HttpResponse input parameter in the flow and change its StatusCode to 401 if the validation falis. Mendix will automatically populate the request and response parameters.

answered