QuickBooks Online

This IntegrationIntegration - An integration is the place the you write your code to get things done! Written in NodeJS, an integration runs in Fusebit's secure and scalable environment to translate between the needs of your backend application and the remote service or services you're connecting to. allows full access to the QuickBooks Online API from your application. Fusebit's multi-tenant approach makes it easy for you to manage multiple QuickBooks connections on behalf of your app's users. Our Node.js-based programming model and lightweight deployment story make it easy to customize the Integration with any necessary business logic.

Getting Started

  1. Use the Fusebit Management PortalFusebit Management Portal - The Fusebit Management Portal enables you to easily setup and manage all your integrations in one place. Link: https://manage.fusebit.io to create an account and log in.
  2. Create a new Integration using one of our QuickBooks Online templates
  1. You will then be able to run the Integration, download it's code, modify it, and deploy your changes. Detailed instructions on how to get started with an Integration are available here.

Invoking the QuickBooks API

The Integration template comes pre-configured with some example calls that invoke QuickBooks' API, for example:

// API Reference: https://github.com/mcohen01/node-quickbooks
const accounts = await quickbooksClient.findAccounts();
ctx.body = { message: `Success! Account total: ${accounts.QueryResponse.Account.length}` };

The quickbooksClient object provided by Fusebit is an instance of the node-quickbooks npm package. The full reference documentation for the package is available here.

Fusebit ensures the above SDK object is already bootstrapped with the QuickBooks credentials of the user invoking the integration. You do not need to worry about obtaining an access token or refresh token -- Fusebit does that for you automatically.

Creating your own QuickBooks App

Out of the box, Fusebit's QuickBooks Integration uses our own demonstration application. This is to make it easier to get started, however you will likely need to register your own QuickBooks App for use in production.

To create your own QuickBooks App:

  1. Log into your Apps Dashboard using your Intuit developer account.
  2. Select Create an app and then specify a name. Select the com.intuit.quickbooks.accounting scope.
  1. Once your app is created, navigate to Development Settings > Keys & credentials*. Note the Client ID and Client Secret** values as you will need them later.
  1. Back in the portal, select the ConnectorConnector - A connector is the package from Fusebit that manages the relationship between one or more integrations and a specific service. One of the most common types of connector is an OAuth connector, which takes care of the OAuth negotiation between your customers and the service you're integrating, so that you don't have to! associated with your integration.
  1. Select Enable Production Credentials in the Connector Configuration and paste the Client ID and Client Secret values obtained from the Intuit Developer portal

🚧

When switching a Connector to a different QuickBooks App, all IdentityIdentity - An identity is a unique relationship one of your customers has with a service. An identity can be used by multiple integrations to act on that service on behalf of your customer. objects associated with that Connector will be deleted. Your users will need to re-authenticate against QuickBooks after you make the change.

  1. In the Fusebit Portal, copy the value from OAuth2 Redirect URL and paste it into the Redirect URIs section of the Intiuit Developer portal and hit Save

πŸ‘

Good Job!

Now, any time a new user installs your Integration, you should now see your QuickBooks App information displayed during the authorization step.

Going to production

The above steps allow you to configure a QuickBooks app against a Sandbox environment. When you are ready to go to production, you need to use a different Client ID and Client Secret provided in the Intuit Developer Portal.

You will also need to remove this line from the Integration itself.

process.env.QUICKBOOKS_USE_SANDBOX = '1';

Receiving events from QuickBooks

With this configuration, your Fusebit Integration will be able to post data to QuickBooks, but you are likely also interested to receive inbound events when data changes in QuickBooks. We can achieve this by configuring Webhooks support.

  1. Make sure you are using your own QuickBooks App and have configured your Connector with that app's secrets
  2. In your QuickBooks Connector configuration, copy the value for Webhook URL and paste it in the Webhooks section of the Intuit Developer portal
  1. Copy the Verifier Token value and paste it into your Connector configuration and hit Save
  1. In your Integration code, add the following handler to process the update
integration.event.on('/:componentName/webhook/dataChangeEvent', async (ctx) => { 
  const quickbooksClient = await integration.service.getSdk(ctx, ctx.params.componentName, ctx.req.body.installIds[0]);
  const event = ctx.req.body.data.dataChangeEvent;
  
  if(event.entities && event.entities[0] && event.entities[0].name === 'Customer'){
    // A Customer object was updated
    const updated = await quickbooksClient.getCustomer(event.entities[0].id);
    console.log("Updated customer: ", updated);
  }
});

Did this page help you?