Link to plugin page: https://zeroqode.com/plugin/xero-accounting-1546872666890x498865460961869800
There are a few things needed to get started, first you will want to head over to your Xero Developers Console, Create an account & Create a new 'Public App'. Once done you will have the required 'Consumer Key' & 'Consumer Secret' to provide to the bubble plugin.
In your Bubble app, select the data tab and then open the 'User' data tab. We need to add a few fields here so that the authorization process is easier to manage. The fields are case sensitive & need to be created exactly as shown below including the type of field.
The workflow to complete the authorization between your user & Xero is fairly easy and overall looks like this,
The steps of the above flow are as follows,
Once the user is returned to your site we will now need to run a flow to exchange the request token for an access token, here is the flow,
The flow broken down,
Now you can setup your calls, After making sure your app is exposing a Workflow API, navigate there and create endpoints. To provide some insight on what we are doing imagine that when you make a call to Xero for data using the 'Xero Get Data' flow, that the requested data is now going to be packaged up and sent to your endpoint.
So if I were to make a data call and was after 'Invoices', i would make this call,
The first time you make this call you will need to use the initialize address for the endpoint and make sure you have auto detect selected and running in a new window.
Why do we use this method?
* You are able to then select what field types you require in the returned data.
* You can make calls to Xero's endpoints that are not predefined in the plugin.
* You can add parameters to the data call's url to narrow down the requested results
* Your able to receive complete records, so in the above example we are returned every single invoice object available - Great for sync type calls where you pull all data from endpoints and your done.
How do you know who the returned data is for?
Buy ensuring you have the 'Include headers in the detected data' selected, you will see each time data is posted to the endpoint you will have a header labeled 'bubble\_user' and the value is the currant user's unique ID.