Xero integration
In short
Read and create invoices and contacts, read payments and reports. Connect it on the Integrations page; your app then calls Xero through Sapilon without ever holding a Xero credential.
Lets your app read and create Xero invoices and contacts, read accounts and payments, and run reports such as profit and loss, for the organisations the connecting user picks.
Connecting
On the Integrations page choose Connect on Xero, sign in to Xero and allow access. Under Advanced you can use your own Xero OAuth app instead of Sapilon’s.
- You choose which Xero organisations the app may use while connecting.
- Sapilon’s own Xero app is being registered. Until it is, Advanced → Bring your own OAuth app connects today.
What your app can do
Only these requests are available; anything else is refused.
GET /connectionsGET /OrganisationGET|POST /InvoicesGET|POST /Invoices/*GET|POST /ContactsGET|POST /Contacts/*GET /AccountsGET /PaymentsGET /Reports/*
How the agent uses it
Use integrations.request('xero', …); paths are relative to https://api.xero.com/api.xro/2.0.
Every call except /connections needs headers: { 'xero-tenant-id': '<tenantId>' }.
GET /connections(sent to api.xero.com) — the organisations and theirtenantId.GET /Organisation.GET|POST /Invoices— list (query: { where: 'Status=="AUTHORISED"', page: '1' }) or create. Example:{ method: 'POST', path: '/Invoices', headers: { 'xero-tenant-id': 't1' }, body: { Invoices: [{ Type: 'ACCREC', Contact: { ContactID: 'c1' }, LineItems: [{ Description: 'Consulting', Quantity: 2, UnitAmount: 120, AccountCode: '200' }], Status: 'DRAFT' }] } }.GET|POST /Invoices/{id}— read or update.GET|POST /Contacts,GET|POST /Contacts/{id}.GET /Accounts,GET /Payments.GET /Reports/{name}—ProfitAndLoss,BalanceSheet,AgedReceivablesByContact;query: { fromDate, toDate }.
Xero allows 60 calls a minute per organisation. Deleting and voiding are not allowed.
More from Xero: https://developer.xero.com/documentation/api/accounting/overview