What if you want to trigger a Pipedream workflow every time a certain event happens in QuickBooks? For instance, maybe you have something you want Pipedream to do every time a new purchase order is created or every time an invoice is sent to a customer.
A webhook is perfect for this scenario, especially if you want to run your workflow as soon as possible after the event happens. Without webhooks, you’d have to create a polling source that runs on a timer and checks QuickBooks for changes periodically. But the more often you check for a change, the faster you’ll burn through your Pipedream invocations. With webhooks set up, Pipedream doesn’t have to do anything until a notification comes in from QuickBooks. Swap out your polling sources for webhook sources and your Pipedream usage will drop dramatically:
So how do you set up QuickBooks to send webhooks to your Pipedream source? The process is not hard if you know what you’re doing, but there are a lot of steps. Unfortunately, there’s no way to automate this process — it has to be done manually for each endpoint you want to set up. My goal in this tutorial is to make the setup process as quick and easy as possible.
Step One: Set Up an App with Intuit Developer
If you don’t have an Intuit Developer account, you’ll need to sign up. Don’t worry, it’s easy and free.
Once you’re signed in to Intuit Developer, go to the Apps Dashboard and click the Create an App button. Each app you create will be able to send webhooks to one source in Pipedream.
Choose QuickBooks Online and Payments on the next screen. After that, give your app a name and choose a scope. If you’re just setting up webhooks you only need the Accounting scope.
After you create the app, you might have to wait a minute or two before it’s available. Click on its name in the list on your dashboard to configure everything.
Step Two: Complete Production Settings
Before you can authenticate with your QuickBooks company, you have to configure a few settings in your new app. First, make sure your email address is verified. Then click Production to add Terms of Service Links. Even if you’re creating an app for internal use only, you still have to put something. I just created a couple of simple Google Docs files that say my app is intended for internal use only and no information will be shared with third party vendors.
You’ll also have to make a selection for Target Industries.
Once you’ve filled in this information, you’ll have access to your production keys.
Step Three: Authenticate with OAuth 2.0 to Create a Connection
QuickBooks requires a successful OAuth 2.0 connection before it will send any webhooks. You might think that if you’ve connected your QuickBooks account in Pipedream that it would be enough, but this creates a connection between your QuickBooks company and Pipedream’s app. In order to receive webhooks, you need to get your newly created app connected as well.
I did my OAuth flow in Postman since that’s what I’m familiar with. To follow along with the next part of the walkthrough, click here to fork my Postman Collection:
The first step is to fill in a few collection variables.
Go to the Production Keys & OAuth section of your Intuit Dashboard. Scroll down to the Redirect URI section, click the Add URI button and fill in
https://oauth.pstmn.io/v1/browser-callback as the link. (If you are not authenticating in the browser, use
https://oauth.pstmn.io/v1/callback as the link instead. You need to have a Redirect URI that matches what is shown in the Callback URL field when you go to configure a new token in Postman.)
Click Save at the bottom and then go back up to the Keys section. Copy the Client ID and Client Secret values and paste them into the corresponding collection variables in Postman. (Click the QuickBooks collection and go to the Variables tab to view and edit collection variables.)
Save the collection and click the dropdown to open the Get Auth and Token URLs request. Hit the Send button. This will automatically fill in the
access_token_url collection variables.
Go back to the QuickBooks collection and this time choose the Authorization tab. Scroll down to the bottom and hit the Get New Access Token button.
Follow the prompts to sign in to QuickBooks, select your company, and approve the connection.
Step Four: Create your Pipedream Source
I’m working on a QuickBooks-specific source for Pipedream but it’s not published yet. In the meantime you can just create a regular HTTP source to use as your endpoint URL in the next step. Your source will look a little different from the screenshots and you can ignore the part below about adding the verifier token to your source configuration.
Step Five: Configure your Webhook
Go back to the Intuit Dashboard and choose the Webhooks section under Production. Here is where you will fill in your Endpoint URL, copy the resulting Verify Token, and select which events you want to send as webhooks.
Copy the endpoint of your Pipedream source and paste it into the Endpoint URL field. If you want to limit the webhooks you send, click the Show Webhooks dropdown and choose which entities and actions you want to receive as webhook events. (They’re all selected by default but you can uncheck Entity to clear everything.)
Finally, find your Verifier Token right below where you entered the endpoint URL and paste it into the configuration tab of your Pipedream source.
Test your setup by going to your QuickBooks Online company and making a change that matches one of the webhook events you selected. If you see this event appear in your event queue, you are done. Whew!
If nothing shows up in the event queue, you might have a problem with your setup.
First, check the Logs tab to see if there are any error messages.
- If the webhook did not pass verification, try adding your verifier token again. (Since it’s a secret prop, you won’t be able to view the current value once it’s entered. You’ll just have to grab it again from the Intuit Developer dashboard.)
- If the operation was not found in the list of selected operations, make sure you’ve selected all the operations you want to emit and that you’re testing with a change that’s included in that list.
If you don’t see anything under logs, it means your Pipedream source is not receiving any webhooks at all. You can double-check the following:
- Have you activated your Pipedream source? (Make sure the little toggle switch at the top right is green.)
- Have you entered the correct endpoint URL on the Intuit dashboard?
- Is the relevant event trigger selected on the dashboard?
- Have you successfully connected your app to your company via OAuth 2.0? (Check out the connection count on the main dashboard page — if the app has zero connections, it will not send any webhooks.)
Finally, are you making a change in the correct QuickBooks company? To see which companies are connected, click the app name, click Connections under Production and click the name of the current month. This will list the company/realm ids of each company that has been connected via OAuth 2.0.
Make sure this page shows a realm id that’s the same as the company id of the QuickBooks company you are working with.
The final possibility is that the webhook is just delayed. I’ve noticed that sometimes with a brand new webhook, the very first event can take a while to come through. This can also happen after changing the endpoint URL of an existing webhook — in the evening the webhooks were still going to the old source but when I checked in the next day, the new source had received a batch of those same webhooks in the middle of the night. After that they all went to the new source right away. So if you’ve tried everything and it’s still not working, it might just need some time.
If you run into a issue that I haven’t covered, please leave a comment below so I can update the guide!