Xero Webhooks Using Claris Connect
You can use Claris Connect to create a flow to handle incoming webhooks from Xero and receive notifications about certain events - currently this is limited to contact and invoice events. This is a much simpler process than using the supplied PHP files for the FileMaker Data API as you don't need to worry about hosting the files and dealing with web servers and PHP configuration changes etc. You can setup a new Claris Connect Flow in a few minutes which can receive incoming webhooks from Xero: for example when a Contact or Invoice has been created/updated in Xero.
For information on the supported versions of FileMaker Server/FileMaker Cloud and other minimum requirements please see our Claris Connect Webhooks FAQ article.
N.B. we have added a new script - processXeroWebHookClarisConnect - to fmAccounting Link (Xero Edition) v2.2 which is required by the Claris Connect flow. You can copy/paste this script into earlier versions of the fmAccounting Link file that already had support for Xero webhooks (v2.1 or later).
In the following example we will show you how to create a Claris Connect flow to receive invoice update notifications from Xero (similar to the fmAccountingLinkWebhook.php file). You can also adapt this for other supported Xero webhooks such as contact updates.
To setup a new Claris Connect Flow to receive incoming webhooks from Xero:
1. login to Claris Connect and create a new Project and give the Project a Name (e.g. Xero Invoice Updates)
2. click the Create New Flow button
3. search for Xero in the list of triggers and click on the Xero app:
4. select the required Xero trigger action - e.g. Invoice updated - and click Continue:
5. you will be prompted to sign into your Xero account and approve access to your selected Xero Organisation:
6. after successfully signing in click Continue:
and you will then be prompted to make an update in Xero so a notification will be sent from Xero. Login to Xero in another browser window and perform the request action (e.g.updating a sales invoice in the following screenshot for the update Invoice trigger):
After the update in Xero has been performed and sent to Claris Connect it should show the Success message:
Click Save Trigger once this has been successfully tested.
7. you now need to add another action to the Claris Connect Flow which will create a new record in the Webhooks table in the fmAccounting Link (Xero Edition) file and populate the relevant fields with data from the incoming webhook. Click the + button and select Action to add a new Action:
In the list of apps search for 'FileMaker' and select the appropriate option for where your copy of fmAccounting Link (Xero Edition) is hosted:
After selecting the appropriate Claris FileMaker option choose the Create record option and click Continue:
8. you will then be prompted to authenticate with your Claris FileMaker server (the process is slightly different for each option):
You can use the same FileMaker account that the fmAccountingLinkWebhook.php file uses here as it has the required access privileges for receiving incoming updates via the Data API. After you have successfully authenticated click the Continue button:
9. you then need to choose the FileMaker layout to use - select the Webhooks layout which is the same layout the PHP files use and has the necessary fields:
To map the Xero Webhook data to the matching FileMaker field click the blue icon to the right of the following fields and select the option from the list (you should see the data from your Xero update webhook notification):
We are replicating the same behaviour as the fmAccountingLinkWebhook.php file - a new record is created in the Webhooks table and the Payload field is populated with the complete body of the webhook JSON data.
Click the Save button - your Flow should now show the following 2 actions:
10. We now need to add another Action to retrieve the newly created Webhook record to get the value of the _kp_WebhookID field in the Webhooks table which we will be using as a script parameter in a subsequent step. Click the + button to the right of the Create record action and select Action:
We are going to select the same FileMaker app that we used for the previous action. Select your FileMaker Server that was previously created which should appear under Your Apps and click Continue:
Select the Get record by ID option and click Continue:
Then click the Continue button at the next screen:
Select the Webhooks layout again and for the Record ID click the blue icon to the right of the field and select this option from the list when clicking on the Claris FileMaker Server Create record option:
It should look like the following screenshot:
Click Save to return to the flow summary. You should now have the following steps:
11. We now need to add another Action to perform a FileMaker script after the new Webhook record has been created by the webhook and the Get record by ID action has been performed.. Click the + button to the right of the Get record by ID action and select Action:
We are going to select the same FileMaker app that we used for the previous action. Select your FileMaker Server that was previously created which should appear under Your Apps and click Continue:
Select the Execute script option and click Continue:
Then click the Continue button at the next screen:
Select the Webhooks layout again and the processXeroWebHookClarisConnect script. For the Script parameter we are going to pass in the value from the _kp_WebhookID for the newly created record in the Webhooks table which you can select from the Xero payload as you previously did by clicking the blue icon to the right of the Script parameter field and clicking on Step 3 Get record by ID to locate the _kp_WebhookID field:
It should look like the following screenshot once you have made your selections;
Click the Save button - your Flow should now show the following 4 steps:
You can now toggle the Disabled option to Enabled - you will receive the following prompt:
Click Save to make your Flow active. You can now test this is working successfully by performing the same action in Xero that you completed at Step 6 above and you should see the new Webhook record created and the data for the webhooks populated into the appropriate fields and the matching record either update or created.
You can replicate this Claris Connect flow for the other support triggers as required (Contact created, Contact updated, Invoice created and Invoice updated).