airbyte icon indicating copy to clipboard operation
airbyte copied to clipboard

New Source: Xero

Open sherifnada opened this issue 4 years ago • 8 comments

Tell us about the new connector you’d like to have

https://developer.xero.com/

Describe the context around this new connector

Describe the alternative you are considering or using

sherifnada avatar Jul 09 '21 08:07 sherifnada

Integration Vetting

Webhook-based? (no/partially/yes) f partially, mention which endpoints are webhook-based no

Available authentication modes (API key/Oauth/other) OAuth 2.0 https://developer.xero.com/documentation/sdks-and-tools/tools/postman/#postman-and-xero

Connecting to the data source what kind of API is it? (SOAP/GraphQL/REST/other) Rest API

is there an SDK available? Can we connect with HTTP requests directly? SDK https://developer.xero.com/documentation/sdks-and-tools/libraries/overview/

If this is a database/datalake/pubsub source, does it have a JDBC driver or Java SDK? yes https://developer.xero.com/documentation/sdks-and-tools/tools/linx#linx-xero-api-plugin

Creating an account Select one of the below options self-service free account available?_ If yes then create it using [email protected] (you should be getting emails sent to this email address) 30-day free trial

karinakuz avatar Aug 27 '21 14:08 karinakuz

### Integration Vetting

Webhook-based? (no/partially/yes) if partially, mention which endpoints are webhook-based no

Available authentication modes (API key/Oauth/other) OAuth 2.0 https://developer.xero.com/documentation/sdks-and-tools/tools/postman/#postman-and-xero

Connecting to the data source what kind of API is it? (SOAP/GraphQL/REST/other) Rest API

is there an SDK available? Can we connect with HTTP requests directly? SDK https://developer.xero.com/documentation/sdks-and-tools/libraries/overview/

If this is a database/datalake/pubsub source, does it have a JDBC driver or Java SDK? yes https://developer.xero.com/documentation/sdks-and-tools/tools/linx#linx-xero-api-plugin

Creating an account Select one of the below options self-service free account available?_ If yes then create it using [email protected] (you should be getting emails sent to this email address) 30-day free trial

Will it require some work through the UI? If so, what is required? no

Available streams for sync If this is an API connector: Provide a link  to the reference docs https://developer.xero.com/documentation/guides/oauth2/scopes/#user-scopes

Main streams:

1. Contacts

  • Contacts https://developer.xero.com/documentation/api/accounting/contacts/

2. Business transactions:

  • Bank Transactions https://developer.xero.com/documentation/api/accounting/banktransactions/

  • Credit Notes https://developer.xero.com/documentation/api/accounting/creditnotes

  • Invoices https://developer.xero.com/documentation/api/accounting/invoices

  • Payments https://developer.xero.com/documentation/api/accounting/payments

  • Purchase Orders https://developer.xero.com/documentation/api/accounting/purchaseorders

  • Quotes https://developer.xero.com/documentation/api/accounting/quotes

3. Organisation settings

  • Items https://developer.xero.com/documentation/api/accounting/items

4. Reports:

  • Balance Sheet https://developer.xero.com/documentation/api/accounting/reports/#get-reports-balancesheet

  • Bank Summary https://developer.xero.com/documentation/api/accounting/reports/#get-reports-banksummary

  • Budget Summary https://developer.xero.com/documentation/api/accounting/reports/#get-reports-budgetsummary

  • Profit And Loss https://developer.xero.com/documentation/api/accounting/reports/#get-reports-profitandloss

  • Executive Summary https://developer.xero.com/documentation/api/accounting/reports/#get-reports-executivesummary

  • Trial Balance https://developer.xero.com/documentation/api/accounting/reports/#get-reports-trialbalance

Please mention if any of the endpoints are asynchronous (meaning we have to make a request, wait for the server to compute a response, then make another request to obtain the result) no

if this is a source where the schema is dynamic/not fixed e.g: database, mention the data model of the connector i.e: relational, document-based, graph-based, etc The Sisense Xero connector is a standalone connector that allows you to import data from Xero’s API into the ElastiCube Manager

Do any streams support incremental sync? not necessary to mention all of them, just saying “none”, “some”, or “all” is sufficient. If only some streams, please mention which ones support incremental sync Reports

karinakuz avatar Aug 31 '21 13:08 karinakuz

Preparation Creating the account [ ] create an account, get access credentials, add notes to LastPass Description with name "Xero" (4h)

Populating the account with data [ ] Do activities on the account. Populating account with the data. Creating API queries in Postman to get main streams data (8h).

[] Describing the output schema Schemas https://drive.google.com/drive/folders/1NZGEiXQUUCORXxKOQeAa3E-Jhl8fwzb4?usp=sharing (30m)

karinakuz avatar Aug 31 '21 14:08 karinakuz

Anyone working on it? Eager to contribute

zkid18 avatar Oct 26 '21 19:10 zkid18

Hey team, I'd love to help contribute to this (if needed)! I've started messing around with developing the source out of curiosity.

mitchealex1 avatar Jan 20 '22 02:01 mitchealex1

@zkid18 @mitchealex1 Airbyte is powered by its community and we would love for you to contribute to this connector! Do you need any help to get started?

YowanR avatar Aug 30 '22 22:08 YowanR

@YowanR let me take a stab at it... I also noticed that there is a Singer tap for Xero. Would that be a good starting point?

altern8tif avatar Sep 13 '22 06:09 altern8tif

@altern8tif, you can use my code sample. I haven't run it for a year or so; connecting to Xero was not an easy catch.

import json
import requests
import webbrowser
import base64

client_id = 'your_client_id'
client_secret = 'your_client_secret'
redirect_url = 'https://xero.com/'
scope = 'offline_access accounting.transactions'
b64_id_secret = base64.b64encode(bytes(client_id + ':' + client_secret, 'utf-8')).decode('utf-8')

def XeroFirstAuth():
    # 1. Send a user to authorize your app
    auth_url = ('''https://login.xero.com/identity/connect/authorize?''' +
                '''response_type=code''' +
                '''&client_id=''' + client_id +
                '''&redirect_uri=''' + redirect_url +
                '''&scope=''' + scope +
                '''&state=123''')
    webbrowser.open_new(auth_url)
    
    # 2. Users are redirected back to you with a code
    auth_res_url = input('What is the response URL? ')
    start_number = auth_res_url.find('code=') + len('code=')
    end_number = auth_res_url.find('&scope')
    auth_code = auth_res_url[start_number:end_number]
    print(auth_code)
    print('\n')
    
    # 3. Exchange the code
    exchange_code_url = 'https://identity.xero.com/connect/token'
    response = requests.post(exchange_code_url, 
                            headers = {
                                'Authorization': 'Basic ' + b64_id_secret
                            },
                            data = {
                                'grant_type': 'authorization_code',
                                'code': auth_code,
                                'redirect_uri': redirect_url
                            })
    json_response = response.json()
    print(json_response)
    print('\n')
    
    # 4. Receive your tokens
    return [json_response['access_token'], json_response['refresh_token']]import json
import requests
import webbrowser
import base64

client_id = 'your_client_id'
client_secret = 'your_client_secret'
redirect_url = 'https://xero.com/'
scope = 'offline_access accounting.transactions'
b64_id_secret = base64.b64encode(bytes(client_id + ':' + client_secret, 'utf-8')).decode('utf-8')

def XeroFirstAuth():
    # 1. Send a user to authorize your app
    auth_url = ('''https://login.xero.com/identity/connect/authorize?''' +
                '''response_type=code''' +
                '''&client_id=''' + client_id +
                '''&redirect_uri=''' + redirect_url +
                '''&scope=''' + scope +
                '''&state=123''')
    webbrowser.open_new(auth_url)
    
    # 2. Users are redirected back to you with a code
    auth_res_url = input('What is the response URL? ')
    start_number = auth_res_url.find('code=') + len('code=')
    end_number = auth_res_url.find('&scope')
    auth_code = auth_res_url[start_number:end_number]
    print(auth_code)
    print('\n')
    
    # 3. Exchange the code
    exchange_code_url = 'https://identity.xero.com/connect/token'
    response = requests.post(exchange_code_url, 
                            headers = {
                                'Authorization': 'Basic ' + b64_id_secret
                            },
                            data = {
                                'grant_type': 'authorization_code',
                                'code': auth_code,
                                'redirect_uri': redirect_url
                            })
    json_response = response.json()
    print(json_response)
    print('\n')
    
    # 4. Receive your tokens
    return [json_response['access_token'], json_response['refresh_token']]

zkid18 avatar Sep 13 '22 20:09 zkid18

@YowanR How much users(tenants) are expected to use app? Because the app can be connected to 25 users only. Certification of the app is quite difficult https://developer.xero.com/documentation/xero-app-store/app-partner-guides/app-partner-steps/

ycherniaiev avatar Oct 18 '22 08:10 ycherniaiev

scoping - https://docs.google.com/document/d/1mXRwF6FieQqzZv8Jee7JwPi1n927e8NHpxzy46aJ9pY/edit

lazebnyi avatar Oct 31 '22 14:10 lazebnyi

Closing as this connector was already released in OSS.

YowanR avatar Feb 14 '23 02:02 YowanR