Power Automate and Power Apps presently support more than 900 connectors, which let us communicate with other online services. What happens, though, if the connector we need somehow doesn’t exist? We can build our own connectors for any online service that offers a REST API thanks to custom connectors. The best thing is that once constructed, custom connectors are reused in any project, allowing us to set triggers and actions based on our own requirements. Xero custom connector allow us to connect to our Xero accounting data, via the Xero api.
This custom connector will be used in a scenario where organization sell their services and wants to save their invoice on Xero API, so this can’t be possible without custom connector as built-in connector of Xero is not available.
Pre-requisites:
Step 1:
Make an account on https://developer.xero.com with your official Microsoft account so that we won’t face any authentication issues while connecting from the Microsoft environment.
Step 2:
After making an account, create an app on Xero.
Copy client ID and secret from this app so that it can be used while building a custom connector.
- Create Custom Connector Go to power automate environment. Navigate to Data > Custom Connectors and then click New Custom Connector > Create from blank. In the general tab give general information providing icon and colour and also other information. In the Security tab select Authorization type as OAuth 2.0 and give following details including client ID and secret copied from Xero App.Now go to the Definition tab and create actions for performing requests to Xero API. I have created three actions as seen below:Give above details and for request URL click on Import from sample in the Request portion just below general.Click on Get request and type this URL https://api.xero.com/api.xro/2.0/Invoices and add following headers:Now click on import. you will see headers will be added in the request portion.Now edit these headers, set them to the required field and give them some default values. Leave other details as it is.
Now click on the Create Connector option. Now navigate to the security tab and you will see that Redirect URL is generated so copy this URL and paste it in Xero App.
Testing Custom Connector
Now test your custom connector. Click on the new Connection button, it will prompt you for login in the Xero app, give your credentials and select organizations. Provide tenant-id, this id can be retrieve through postman collection.
We will get following response:
Now we can read and write data from, and in Xero in PowerApps with the help of Custom Connector.
We have shown the Create Read Update and Delete (CRUD) actions with basic screens in Power Apps.
I hope you found it useful. If you have any queries, please feel free to contact us [email protected]