QuickBooks API Integration With Power Automate Using Custom Connectors

Published Aug 09 2021 08:43 AM 1,536 Views
Regular Visitor

In this article, we will be exploring the below concepts,

 

  • Understand QuickBooks Online APIs
  • Trying QuickBooks API from the postman
  • Create MS flow custom connectors.
  • Integrating QuickBooks API from Power automate(MS flow) using Custom connectors.

Suppose you have some business process working in SharePoint/Power automate where employees are filling timesheets and after approval, you want to generate invoices in Quick books online (QBO). Or you want to record expense(bill) in QBO once your vendor has submitted his invoice due to you, maybe via power apps forms or SharePoint online list. Office 365 products like SharePoint, Power Automate, Power apps will allow us to automate a business process like approval, review, etc. And once this process is completed, we wanted to do accounting entries in our accounting software (in this case Quick books online).

So Let’s get started.

What do you need?

  • Quick book online account.
  • Intuit developer account.
  • Postman
  • Power automate (MS flow) license.

Quick book online account

Create a Quickbook online account (if not already) by subscribing to the plan as per your requirement. For this sample, I have created a 30 days trial account. You can check different pricing available at this link, based on your country different pricing and subscription are available.

Intuit developer account

You would need to create Intuit (company owning Quickbook) developer account.

  1. Go here

On the top menu, follow the last link to sign up. The below screen will open, fill in the below details.

SiddharthVaghasia_0-1628135161016.png

 

  1. Once sign in, you can follow this link to create an APP. Ignore Steps 3 and 4 for now from this link. Make note of client id and client secret, Please note that your sandbox client id and client secret will be different. For this demo, we will create production keys so that we can make the actual calls to our live environment.
  2. Below is how my developer dashboard looks like,

SiddharthVaghasia_1-1628135161497.png

 

So we have all the things required from the QBO side of integration, let's move ahead. 

Assuming now you already have Postman and MS flow license, let us go ahead and see the overall approach we will follow for this integration.

  1. Import postman collection,
  2. Create a new collection and copy/try the API calls from postman for required endpoints (web service we want to integrate)
  3. Setup authorization in postman to get access token.
  4. Call a simple web service.
  5. Export the collection.
  6. Create custom connector in Powerautomate
  7. Create Power automate(flow) and use actions to call Quickbooks API

Step 1

Import Postman collection of All APIs available in Quick book online. This export of collections is provided by Quickbooks at this link(refer to screenshot below).

SiddharthVaghasia_2-1628135161255.png

 

This will directly ask to open postman and it will open collection like in the below screenshot.

SiddharthVaghasia_3-1628135161604.png

 

Step 2 - Create a new empty collection

SiddharthVaghasia_4-1628135161655.png

 

Now go to Imported postman collection and expand the Invoice.

SiddharthVaghasia_5-1628135161514.png

 

We will use 2 API(invoice read by Id and create an invoice). Open one by one and click on Save as to save in our custom-created collection(QBOMSflowIntegration).

SiddharthVaghasia_6-1628135161650.png

 

SiddharthVaghasia_7-1628135161752.png

 

Please follow the same step for API ‘Create Invoice’.

Now, Let set up an environment variable for dynamic values to be passed in URL.

Follow the below screenshot,

SiddharthVaghasia_8-1628135161722.png

 

Create 3 URLs,

Base URL

Sandbox Base URL - sandbox-quickbooks.api.intuit.com

Product Base URL - quickbooks.api.intuit.com (Production)

Company ID – You can find company ID by following this link

Invoice Id – Set is 1(we will query invoiced Id 1 in one Get Invoice Webservice)

Step 3 – Setup authorization

Now let us set up authorization details to get the access token and pass it to the actual API call.

Please follow along with the below screenshot.

SiddharthVaghasia_9-1628135161520.png

 

It should open the below popup box, enter the below details here.

Client Authentication – Select. Send client credentials in the body.

Before clicking on Request Token, we need to add a call-back URL to in developer dashboard.

Login to the developer dashboard at this link.

Click on My Apps, select targeted app, and refer to the below screenshot to add.

SiddharthVaghasia_10-1628135161610.png

 

Once this is done, come back to Postman and Click on Request token, it will ask you to authenticate with your Quickbook account, login with a valid account, and follow along. Once you are logged in you should see the below popup, rename the token name with your preference and click on use token.

SiddharthVaghasia_11-1628135161603.png

 

Select that token name in the available tokens dropdown.

SiddharthVaghasia_12-1628135161649.png

 

Now make sure, you match the environment variable name in the URL and what we used while created in the above step.

SiddharthVaghasia_13-1628135161644.png

 

Step 4 – Call a simple web service

Now we are ready to test, click on the send button. If everything is set up correctly, we can see the below output.

SiddharthVaghasia_14-1628135161638.png

 

In the same way, you can test Create invoice method. Make sure in the authorization tab you have selected the newly generated token. Follow the below screenshot, if you notice, there is already a JSON object in the body which is the bare minimum thing required to create an invoice. Click on send.

SiddharthVaghasia_15-1628135161634.png

 

In your real case, you would have to pass many more things, for that you can always refer to Quick Book API documentation at this link.

Step 5 – Export collection

Now we are done with the postman and it's time to export this collection, which will be used in Power automate to create the custom connector.

SiddharthVaghasia_16-1628135161616.png

 

Once you click one export, it will ask you to save the exported file, save it at your preferred location.

Step 6 – Create a custom connector

Now it's time to go to Power automate and create a custom connector.

Go here.

Follow the below screenshot,

SiddharthVaghasia_17-1628135161596.png

 

It will open below popup, select the JSON file which was imported in step 5. Give your preferred name. Click on Continue.

SiddharthVaghasia_18-1628135160901.png

 

We will now be taken into a wizard where we have to setup our connector, In first (below screenshot) enter details are per your preference, we will keep default but enter the base URL.

SiddharthVaghasia_19-1628135161522.png

 

Click on Security Tab and select oAuth 2.0 in Authentication Type.

SiddharthVaghasia_20-1628135161374.png

 

Below is for your quick reference, most of them are the same as we did in postman in Step 3.

Note - Leave Redirect URL blank, for now, this will be auto-generated. We need to come back here and then copy this URL to add this in Intuit developer dashboard in Allowed Redirect URL, the way we did it for the postman.

Click on Definition –Here we will see below screen,

SiddharthVaghasia_21-1628135161481.png

 

Now comes the tricky part, By default the definition we imported using the swagger file does not understand the dynamic variables like BaseURL, CompanyId, and InvoiceId. This is because the syntax of the postman to pass dynamic variable is different than the swagger for Flow. So what we will do here is modify the swagger file manually so that we can pass company id, base URL, and Invoice id dynamically while configuring action in actual Flow implementation. Please note this is to demonstrate how to make your URLs dynamic (because in real use cases, we won’t call webservice via hardcoded data).

Enable Swagger Editor(as in the above screenshot)

We will need to change the path both webservice url and add parameters definition

Get Invoice webservice path
/v3/company/%7B%7Bcompanyid%7D%7D/invoice/147:
TO
/v3/company/{companyid}/invoice/{invoiceId}:
Create invoice webservice Path
/v3/company/%7B%7Bcompanyid%7D%7D/invoice:
TO
/v3/company/{companyid}/invoice:
 

For Get Invoice parameters we added

- {name: companyid, default: '{{companyid}}', in: path, type: string, required: true}

- {name: invoiceId, default: '{{invoiceId}}', in: path, type: string, required: true}

For Create Invoice parameters we added.

- {name: companyid, default: '{{companyid}}', in: path, type: string, required: true}

This is how it will look after the change.

SiddharthVaghasia_22-1628135161636.png

 

Please make sure there is no error while making this change, space is very important, for e.g if you missed a space as in the below screenshot it will give you a parser error.

SiddharthVaghasia_23-1628135161733.png

 

Below is have it will look like if you made all entries correct.

SiddharthVaghasia_24-1628135161735.png

 

You can Toggle Enable Swagger and click on create connector button.

It will validate and save your connector.

Now before moving forward, let us go back to the security tab and copy the redirect URL. Go to Intuit developer dashboard and add this in the Allowed redirect URL(as we did for postman).

In most cases, it would be below,

https://global.consent.azure-apim.net/redirect

Now let’s test. Click on the Test tab, Click on New connection. It will ask us to login to Quickbooks, follow all steps as required. Enter companyid, invoice id as in below screenshot and click on Test operation, If you got output as marked as no.5, we are good. :smiling_face_with_smiling_eyes:

SiddharthVaghasia_25-1628135161760.png

 

Congratulation our custom connector is created successfully, now it's time to create a sample flow to use this connector and its methods. For sake of simplicity, I am creating a flow with Manual Trigger.

SiddharthVaghasia_26-1628135161718.png

 

Now add a new step, in action, select the custom tab, select our custom connector,

SiddharthVaghasia_27-1628135160899.png

 

It will ask us to choose from 2 actions, first, add the Get invoice. Repeat this step and add Create Invoice also as the next step.

Configure both actions as in below,

SiddharthVaghasia_28-1628135161719.png

 

Please note that for Create invoice, we need to pass Line as an array of the JSON objects. Copy it from the postman, below is for quick reference.

[{
    "Amount": 100.00,
    "DetailType": "SalesItemLineDetail",
    "SalesItemLineDetail": {
        "ItemRef": {
            "value": "1",
            "name": "From MS Flow demo"
        },
        "TaxCodeRef": {
            "value": "2"
        }
    }
}]
 

Value is customer Id on whose account we need to generate Invoice, so adding 1 here, make sure you have customer created with that Id.

We are done with setting up our actions, let us run it. Save flow,

Click on Test,

Select I’ll perform the trigger action. Click on Save and test.

SiddharthVaghasia_29-1628135161013.png

 

Click continue -> Run Flow. Wait for some time. If everything goes well, you see the below message.

SiddharthVaghasia_30-1628135161134.png

 

You can expand actions and check responses returned in both actions.

Login to Quick book, From left navigation Go to Sales->Invoices and you will see a new invoice generated. In my case, below are some generated invoices that I created from flow(except the first one) while testing flow.

SiddharthVaghasia_31-1628135161766.png

 

So that’s come to end to the long article. To conclude, Please note we can create any operations available in quick books API from flow, we have to use first use postman to add the required API endpoint and then configure while creating custom connectors. Hope this helps and gives you a basic idea on getting started.

%3CLINGO-SUB%20id%3D%22lingo-sub-2613452%22%20slang%3D%22en-US%22%3EQuickBooks%20API%20Integration%20With%20Power%20Automate%20Using%20Custom%20Connectors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2613452%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20article%2C%20we%20will%20be%20exploring%20the%20below%20concepts%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3EUnderstand%20QuickBooks%20Online%20APIs%20Trying%20QuickBooks%20API%20from%20the%20postman%20Create%20MS%20flow%20custom%20connectors.%20Integrating%20QuickBooks%20API%20from%20Power%20automate(MS%20flow)%20using%20Custom%20connectors.%3CP%3ESuppose%20you%20have%20some%20business%20process%20working%20in%20SharePoint%2FPower%20automate%20where%20employees%20are%20filling%20timesheets%20and%20after%20approval%2C%20you%20want%20to%20generate%20invoices%20in%20Quick%20books%20online%20(QBO).%20Or%20you%20want%20to%20record%20expense(bill)%20in%20QBO%20once%20your%20vendor%20has%20submitted%20his%20invoice%20due%20to%20you%2C%20maybe%20via%20power%20apps%20forms%20or%20SharePoint%20online%20list.%20Office%20365%20products%20like%20SharePoint%2C%20Power%20Automate%2C%20Power%20apps%20will%20allow%20us%20to%20automate%20a%20business%20process%20like%20approval%2C%20review%2C%20etc.%20And%20once%20this%20process%20is%20completed%2C%20we%20wanted%20to%20do%20accounting%20entries%20in%20our%20accounting%20software%20(in%20this%20case%20Quick%20books%20online).%3C%2FP%3E%3CP%3ESo%20Let%E2%80%99s%20get%20started.%3C%2FP%3EWhat%20do%20you%20need%3F%20Quick%20book%20online%20account.%20Intuit%20developer%20account.%20Postman%20Power%20automate%20(MS%20flow)%20license.%20Quick%20book%20online%20account%3CP%3ECreate%20a%20Quickbook%20online%20account%20(if%20not%20already)%20by%20subscribing%20to%20the%20plan%20as%20per%20your%20requirement.%20For%20this%20sample%2C%20I%20have%20created%20a%2030%20days%20trial%20account.%20You%20can%20check%20different%20pricing%20available%20at%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fquickbooks.intuit.com%2Fin%2Fpricing%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Elink%3C%2FA%3E%2C%20based%20on%20your%20country%20different%20pricing%20and%20subscription%20are%20available.%3C%2FP%3EIntuit%20developer%20account%3CP%3EYou%20would%20need%20to%20create%20Intuit%20(company%20owning%20Quickbook)%20developer%20account.%3C%2FP%3EGo%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.intuit.com%2Fapp%2Fdeveloper%2Fhomepage%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehere%3C%2FA%3E%3CP%3EOn%20the%20top%20menu%2C%20follow%20the%20last%20link%20to%20sign%20up.%20The%20below%20screen%20will%20open%2C%20fill%20in%20the%20below%20details.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3EOnce%20sign%20in%2C%20you%20can%20follow%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.intuit.com%2Fapp%2Fdeveloper%2Fqbo%2Fdocs%2Fget-started%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Elink%3C%2FA%3E%26nbsp%3Bto%20create%20an%20APP.%20Ignore%20Steps%203%20and%204%20for%20now%20from%20this%20link.%20Make%20note%20of%20client%20id%20and%20client%20secret%2C%20Please%20note%20that%20your%20sandbox%20client%20id%20and%20client%20secret%20will%20be%20different.%20For%20this%20demo%2C%20we%20will%20create%20production%20keys%20so%20that%20we%20can%20make%20the%20actual%20calls%20to%20our%20live%20environment.%20Below%20is%20how%20my%20developer%20dashboard%20looks%20like%2C%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20we%20have%20all%20the%20things%20required%20from%20the%20QBO%20side%20of%20integration%2C%20let's%20move%20ahead.%26nbsp%3B%3C%2FP%3E%3CP%3EAssuming%20now%20you%20already%20have%20Postman%20and%20MS%20flow%20license%2C%20let%20us%20go%20ahead%20and%20see%20the%20overall%20approach%20we%20will%20follow%20for%20this%20integration.%3C%2FP%3EImport%20postman%20collection%2C%20Create%20a%20new%20collection%20and%20copy%2Ftry%20the%20API%20calls%20from%20postman%20for%20required%20endpoints%20(web%20service%20we%20want%20to%20integrate)%20Setup%20authorization%20in%20postman%20to%20get%20access%20token.%20Call%20a%20simple%20web%20service.%20Export%20the%20collection.%20Create%20custom%20connector%20in%20Powerautomate%20Create%20Power%20automate(flow)%20and%20use%20actions%20to%20call%20Quickbooks%20API%3CP%3EStep%201%3C%2FP%3E%3CP%3EImport%20Postman%20collection%20of%20All%20APIs%20available%20in%20Quick%20book%20online.%20This%20export%20of%20collections%20is%20provided%20by%20Quickbooks%20at%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.intuit.com%2Fapp%2Fdeveloper%2Fqbo%2Fdocs%2Fdevelop%2Fpostman%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Elink%3C%2FA%3E(refer%20to%20screenshot%20below).%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20will%20directly%20ask%20to%20open%20postman%20and%20it%20will%20open%20collection%20like%20in%20the%20below%20screenshot.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EStep%202%20-%20Create%20a%20new%20empty%20collection%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20go%20to%20Imported%20postman%20collection%20and%20expand%20the%20Invoice.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20will%20use%202%20API(invoice%20read%20by%20Id%20and%20create%20an%20invoice).%20Open%20one%20by%20one%20and%20click%20on%20Save%20as%20to%20save%20in%20our%20custom-created%20collection(QBOMSflowIntegration).%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20follow%20the%20same%20step%20for%20API%20%E2%80%98Create%20Invoice%E2%80%99.%3C%2FP%3E%3CP%3ENow%2C%20Let%20set%20up%20an%20environment%20variable%20for%20dynamic%20values%20to%20be%20passed%20in%20URL.%3C%2FP%3E%3CP%3EFollow%20the%20below%20screenshot%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECreate%203%20URLs%2C%3C%2FP%3E%3CP%3EBase%20URL%3C%2FP%3E%3CP%3ESandbox%20Base%20URL%20-%20sandbox-quickbooks.api.intuit.com%3C%2FP%3E%3CP%3EProduct%20Base%20URL%20-%20quickbooks.api.intuit.com%20(Production)%3C%2FP%3E%3CP%3ECompany%20ID%20%E2%80%93%20You%20can%20find%20company%20ID%20by%20following%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fquickbooks.intuit.com%2Flearn-support%2Fen-us%2Fcustomer-company-settings%2Ffind-your-quickbooks-online-company-id%2F00%2F185551%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Elink%3C%2FA%3E%3C%2FP%3E%3CP%3EInvoice%20Id%20%E2%80%93%20Set%20is%201(we%20will%20query%20invoiced%20Id%201%20in%20one%20Get%20Invoice%20Webservice)%3C%2FP%3E%3CP%3EStep%203%20%E2%80%93%20Setup%20authorization%3C%2FP%3E%3CP%3ENow%20let%20us%20set%20up%20authorization%20details%20to%20get%20the%20access%20token%20and%20pass%20it%20to%20the%20actual%20API%20call.%3C%2FP%3E%3CP%3EPlease%20follow%20along%20with%20the%20below%20screenshot.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20should%20open%20the%20below%20popup%20box%2C%20enter%20the%20below%20details%20here.%3C%2FP%3EToken%20Name%20-%20Enter%20your%20preferred%20name%20Grant%20Type%20%E2%80%93%20Select%20Authorization%20Code%20Call%20Back%20URL%20-%20%3CA%20href%3D%22https%3A%2F%2Fapp.getpostman.com%2Foauth2%2Fcallback%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fapp.getpostman.com%2Foauth2%2Fcallback%3C%2FA%3E%20(this%20URL%20should%20be%20in%20Allowed%20redirect%20URL%20in%20Intuit%20developer%20dashboard%2C%20we%20will%20see%20how%20to%20do%20this%20later)%20Auth%20URL%20-%20%3CA%20href%3D%22https%3A%2F%2Fappcenter.intuit.com%2Fconnect%2Foauth2%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fappcenter.intuit.com%2Fconnect%2Foauth2%3C%2FA%3E%20Access%20Token%20URL%20-%20%3CA%20href%3D%22https%3A%2F%2Foauth.platform.intuit.com%2Foauth2%2Fv1%2Ftokens%2Fbearer%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Foauth.platform.intuit.com%2Foauth2%2Fv1%2Ftokens%2Fbearer%3C%2FA%3E%20Client%20ID%20%E2%80%93%20This%20needs%20to%20be%20copied%20from%20intuit%20developer%20dashboard(use%20according%20to%20the%20environment)%20Client%20Secret%20-%20This%20needs%20to%20be%20copied%20from%20intuit%20developer%20dashboard(use%20according%20to%20the%20environment)%20Scope%20-%20com.intuit.quickbooks.accounting%20OpenID%20email%20profile%20State%20%E2%80%93%20mydemostateobject123213(this%20can%20be%20anything)%3CP%3EClient%20Authentication%20%E2%80%93%20Select.%20Send%20client%20credentials%20in%20the%20body.%3C%2FP%3E%3CP%3EBefore%20clicking%20on%20Request%20Token%2C%20we%20need%20to%20add%20a%20call-back%20URL%20to%20in%20developer%20dashboard.%3C%2FP%3E%3CP%3ELogin%20to%20the%20developer%20dashboard%20at%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.intuit.com%2Fapp%2Fdeveloper%2Fhomepage%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Elink%3C%2FA%3E.%3C%2FP%3E%3CP%3EClick%20on%20My%20Apps%2C%20select%20targeted%20app%2C%20and%20refer%20to%20the%20below%20screenshot%20to%20add.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOnce%20this%20is%20done%2C%20come%20back%20to%20Postman%20and%20Click%20on%20Request%20token%2C%20it%20will%20ask%20you%20to%20authenticate%20with%20your%20Quickbook%20account%2C%20login%20with%20a%20valid%20account%2C%20and%20follow%20along.%20Once%20you%20are%20logged%20in%20you%20should%20see%20the%20below%20popup%2C%20rename%20the%20token%20name%20with%20your%20preference%20and%20click%20on%20use%20token.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESelect%20that%20token%20name%20in%20the%20available%20tokens%20dropdown.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20make%20sure%2C%20you%20match%20the%20environment%20variable%20name%20in%20the%20URL%20and%20what%20we%20used%20while%20created%20in%20the%20above%20step.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EStep%204%20%E2%80%93%20Call%20a%20simple%20web%20service%3C%2FP%3E%3CP%3ENow%20we%20are%20ready%20to%20test%2C%20click%20on%20the%20send%20button.%20If%20everything%20is%20set%20up%20correctly%2C%20we%20can%20see%20the%20below%20output.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20same%26nbsp%3Bway%2C%20you%20can%20test%20Create%20invoice%20method.%20Make%20sure%20in%20the%20authorization%20tab%20you%20have%20selected%20the%20newly%20generated%20token.%20Follow%20the%20below%20screenshot%2C%20if%20you%20notice%2C%20there%20is%20already%20a%20JSON%20object%20in%20the%20body%20which%20is%20the%20bare%20minimum%20thing%20required%20to%20create%20an%20invoice.%20Click%20on%20send.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20your%20real%20case%2C%20you%20would%20have%20to%20pass%20many%20more%20things%2C%20for%20that%20you%20can%20always%20refer%20to%20Quick%20Book%20API%20documentation%20at%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.intuit.com%2Fapp%2Fdeveloper%2Fqbo%2Fdocs%2Fapi%2Faccounting%2Fmost-commonly-used%2Finvoice%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Elink%3C%2FA%3E.%3C%2FP%3E%3CP%3EStep%205%20%E2%80%93%20Export%20collection%3C%2FP%3E%3CP%3ENow%20we%20are%20done%20with%20the%20postman%20and%20it's%20time%20to%20export%20this%20collection%2C%20which%20will%20be%20used%20in%20Power%20automate%20to%20create%20the%20custom%20connector.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOnce%20you%20click%20one%20export%2C%20it%20will%20ask%20you%20to%20save%20the%20exported%20file%2C%20save%20it%20at%20your%20preferred%20location.%3C%2FP%3E%3CP%3EStep%206%20%E2%80%93%20Create%20a%20custom%20connector%3C%2FP%3E%3CP%3ENow%20it's%20time%20to%20go%20to%20Power%20automate%20and%20create%20a%20custom%20connector.%3C%2FP%3E%3CP%3EGo%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fflow.microsoft.com%2F%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%3CP%3EFollow%20the%20below%20screenshot%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20will%20open%20below%20popup%2C%20select%20the%20JSON%20file%20which%20was%20imported%20in%20step%205.%20Give%20your%20preferred%20name.%20Click%20on%20Continue.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20will%20now%20be%20taken%20into%20a%20wizard%20where%20we%20have%20to%20setup%20our%20connector%2C%20In%20first%20(below%20screenshot)%20enter%20details%20are%20per%20your%20preference%2C%20we%20will%20keep%20default%20but%20enter%20the%20base%20URL.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EClick%20on%20Security%20Tab%20and%20select%20oAuth%202.0%20in%20Authentication%20Type.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBelow%20is%20for%20your%20quick%20reference%2C%20most%20of%20them%20are%20the%20same%20as%20we%20did%20in%20postman%20in%20Step%203.%3C%2FP%3EIdentity%20Provider%20-%20Generic%20OAuth%202%20Client%20ID%20%E2%80%93%20Our%20App%20Client%20ID%20Client%20Secret%20%E2%80%93%20Our%20App%20Client%20Secret%20Authorization%20URL-%20%3CA%20href%3D%22https%3A%2F%2Fappcenter.intuit.com%2Fconnect%2Foauth2%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fappcenter.intuit.com%2Fconnect%2Foauth2%3C%2FA%3E%20Token%20URL%20-%20%3CA%20href%3D%22https%3A%2F%2Foauth.platform.intuit.com%2Foauth2%2Fv1%2Ftokens%2Fbearer%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Foauth.platform.intuit.com%2Foauth2%2Fv1%2Ftokens%2Fbearer%3C%2FA%3E%20Refresh%20URL%20-%20%3CA%20href%3D%22https%3A%2F%2Foauth.platform.intuit.com%2Foauth2%2Fv1%2Ftokens%2Fbearer%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Foauth.platform.intuit.com%2Foauth2%2Fv1%2Ftokens%2Fbearer%3C%2FA%3E%20(Same%20as%20Token%20URL)%20Scope%20-%20com.intuit.quickbooks.accounting%20Redirect%20URL%20%E2%80%93%20Leave%20it%20blank.%3CP%3ENote%20-%20Leave%20Redirect%20URL%20blank%2C%20for%20now%2C%20this%20will%20be%20auto-generated.%20We%20need%20to%20come%20back%20here%20and%20then%20copy%20this%20URL%20to%20add%20this%20in%20Intuit%20developer%20dashboard%20in%20Allowed%20Redirect%20URL%2C%20the%20way%20we%20did%20it%20for%20the%20postman.%3C%2FP%3E%3CP%3EClick%20on%20Definition%20%E2%80%93Here%20we%20will%20see%20below%20screen%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20comes%20the%20tricky%20part%2C%20By%20default%20the%20definition%20we%20imported%20using%20the%20swagger%20file%20does%20not%20understand%20the%20dynamic%20variables%20like%20BaseURL%2C%20CompanyId%2C%20and%20InvoiceId.%20This%20is%20because%20the%20syntax%20of%20the%20postman%20to%20pass%20dynamic%20variable%20is%20different%20than%20the%20swagger%20for%20Flow.%20So%20what%20we%20will%20do%20here%20is%20modify%20the%20swagger%20file%20manually%20so%20that%20we%20can%20pass%20company%20id%2C%20base%20URL%2C%20and%20Invoice%20id%20dynamically%20while%20configuring%20action%20in%20actual%20Flow%20implementation.%20Please%20note%20this%20is%20to%20demonstrate%20how%20to%20make%20your%20URLs%20dynamic%20(because%20in%20real%20use%20cases%2C%20we%20won%E2%80%99t%20call%20webservice%20via%20hardcoded%20data).%3C%2FP%3E%3CP%3EEnable%20Swagger%20Editor(as%20in%20the%20above%20screenshot)%3C%2FP%3E%3CP%3EWe%20will%20need%20to%20change%20the%20path%20both%20webservice%20url%20and%20add%20parameters%20definition%3C%2FP%3EGet%20Invoice%20webservice%20path%20%2Fv3%2Fcompany%2F%257B%257Bcompanyid%257D%257D%2Finvoice%2F147%3A%20TO%20%2Fv3%2Fcompany%2F%7Bcompanyid%7D%2Finvoice%2F%7BinvoiceId%7D%3A%20Create%20invoice%20webservice%20Path%20%2Fv3%2Fcompany%2F%257B%257Bcompanyid%257D%257D%2Finvoice%3A%20TO%20%2Fv3%2Fcompany%2F%7Bcompanyid%7D%2Finvoice%3A%20%26nbsp%3B%3CP%3EFor%20Get%20Invoice%20parameters%20we%20added%3C%2FP%3E%3CP%3E-%20%7Bname%3A%20companyid%2C%20default%3A%20'%7B%7Bcompanyid%7D%7D'%2C%20in%3A%20path%2C%20type%3A%20string%2C%20required%3A%20true%7D%3C%2FP%3E%3CP%3E-%20%7Bname%3A%20invoiceId%2C%20default%3A%20'%7B%7BinvoiceId%7D%7D'%2C%20in%3A%20path%2C%20type%3A%20string%2C%20required%3A%20true%7D%3C%2FP%3E%3CP%3EFor%20Create%20Invoice%20parameters%20we%20added.%3C%2FP%3E%3CP%3E-%20%7Bname%3A%20companyid%2C%20default%3A%20'%7B%7Bcompanyid%7D%7D'%2C%20in%3A%20path%2C%20type%3A%20string%2C%20required%3A%20true%7D%3C%2FP%3E%3CP%3EThis%20is%20how%20it%20will%20look%20after%20the%20change.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20make%20sure%20there%20is%20no%20error%20while%20making%20this%20change%2C%20space%20is%20very%20important%2C%20for%20e.g%20if%20you%20missed%20a%20space%20as%20in%20the%20below%20screenshot%20it%20will%20give%20you%20a%20parser%20error.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBelow%20is%20have%20it%20will%20look%20like%20if%20you%20made%20all%20entries%20correct.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20Toggle%20Enable%20Swagger%20and%20click%20on%20create%20connector%20button.%3C%2FP%3E%3CP%3EIt%20will%20validate%20and%20save%20your%20connector.%3C%2FP%3E%3CP%3ENow%20before%20moving%20forward%2C%20let%20us%20go%20back%20to%20the%20security%20tab%20and%20copy%20the%20redirect%20URL.%20Go%20to%20Intuit%20developer%20dashboard%20and%20add%20this%20in%20the%20Allowed%20redirect%20URL(as%20we%20did%20for%20postman).%3C%2FP%3E%3CP%3EIn%20most%20cases%2C%20it%20would%20be%20below%2C%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fglobal.consent.azure-apim.net%2Fredirect%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fglobal.consent.azure-apim.net%2Fredirect%3C%2FA%3E%3C%2FP%3E%3CP%3ENow%20let%E2%80%99s%20test.%20Click%20on%20the%20Test%20tab%2C%20Click%20on%20New%20connection.%20It%20will%20ask%20us%20to%20login%20to%20Quickbooks%2C%20follow%20all%20steps%20as%20required.%20Enter%20companyid%2C%20invoice%20id%20as%20in%20below%20screenshot%20and%20click%20on%20Test%20operation%2C%20If%20you%20got%20output%20as%20marked%20as%20no.5%2C%20we%20are%20good.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECongratulation%20our%20custom%20connector%20is%20created%20successfully%2C%20now%20it's%20time%20to%20create%20a%20sample%20flow%20to%20use%20this%20connector%20and%20its%20methods.%20For%20sake%20of%20simplicity%2C%20I%20am%20creating%20a%20flow%20with%20Manual%20Trigger.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20add%20a%20new%20step%2C%20in%20action%2C%20select%20the%20custom%20tab%2C%20select%20our%20custom%20connector%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20will%20ask%20us%20to%20choose%20from%202%20actions%2C%20first%2C%20add%20the%20Get%20invoice.%20Repeat%20this%20step%20and%20add%20Create%20Invoice%20also%20as%20the%20next%20step.%3C%2FP%3E%3CP%3EConfigure%20both%20actions%20as%20in%20below%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20note%20that%20for%20Create%20invoice%2C%20we%20need%20to%20pass%20Line%20as%20an%20array%20of%20the%20JSON%20objects.%20Copy%20it%20from%20the%20postman%2C%20below%20is%20for%20quick%20reference.%3C%2FP%3E%5B%7B%20%22Amount%22%3A%20100.00%2C%20%22DetailType%22%3A%20%22SalesItemLineDetail%22%2C%20%22SalesItemLineDetail%22%3A%20%7B%20%22ItemRef%22%3A%20%7B%20%22value%22%3A%20%221%22%2C%20%22name%22%3A%20%22From%20MS%20Flow%20demo%22%20%7D%2C%20%22TaxCodeRef%22%3A%20%7B%20%22value%22%3A%20%222%22%20%7D%20%7D%20%7D%5D%20%26nbsp%3B%3CP%3EValue%20is%20customer%20Id%20on%20whose%20account%20we%20need%20to%20generate%20Invoice%2C%20so%20adding%201%20here%2C%20make%20sure%20you%20have%20customer%20created%20with%20that%20Id.%3C%2FP%3E%3CP%3EWe%20are%20done%20with%20setting%20up%20our%20actions%2C%20let%20us%20run%20it.%20Save%20flow%2C%3C%2FP%3E%3CP%3EClick%20on%20Test%2C%3C%2FP%3E%3CP%3ESelect%20I%E2%80%99ll%20perform%20the%20trigger%20action.%20Click%20on%20Save%20and%20test.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EClick%20continue%20-%26gt%3B%20Run%20Flow.%26nbsp%3BWait%20for%20some%20time.%20If%20everything%20goes%20well%2C%20you%20see%20the%20below%20message.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20expand%20actions%20and%20check%20responses%20returned%20in%20both%20actions.%3C%2FP%3E%3CP%3ELogin%20to%20Quick%20book%2C%20From%20left%20navigation%20Go%20to%20Sales-%26gt%3BInvoices%20and%20you%20will%20see%20a%20new%20invoice%20generated.%20In%20my%20case%2C%20below%20are%20some%20generated%20invoices%20that%20I%20created%20from%20flow(except%20the%20first%20one)%20while%20testing%20flow.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20that%E2%80%99s%20come%20to%20end%20to%20the%20long%20article.%20To%20conclude%2C%20Please%20note%20we%20can%20create%20any%20operations%20available%20in%20quick%20books%20API%20from%20flow%2C%20we%20have%20to%20use%20first%20use%20postman%20to%20add%20the%20required%20API%20endpoint%20and%20then%20configure%20while%20creating%20custom%20connectors.%20Hope%20this%20helps%20and%20gives%20you%20a%20basic%20idea%20on%20getting%20started.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2613452%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20article%2C%20we%20will%20learn%20how%20to%20do%20QuickBooks%20API%20integration%20with%20Power%20Automate%20using%20Custom%20connectors.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2613452%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EGetting%20started%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHow%20to%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Aug 04 2021 11:02 PM
Updated by: