How to never forget to pay an invoice in NetSuite, using Merge - Part 2
Let's connect Merge to our NetSuite instance
Series
This is part 2 of a three part series where we:
Set up Merge to talk to our NetSuite instance, and pull invoices [you are here]
Write a Python script that checks for past due invoices, and send an email about it
Allow NetSuite to talk to Merge
Now that we know what Merge is, let’s use it! We’ll need to do some one time setup to get going. What follows is a remix of Merge’s official NetSuite guide:
Merge uses NetSuite’s APIs under the hood. They are closed down by default. Let’s open access to them.
Go to Enable Features (Company→Setup→Enable Features). Click on the “SuiteCloud” tab. Check the boxes for “SOAP Web Services”, “REST Web Services”, and “Token-based Authentication”.
Bundles are a way to package things like scripts, workflows, and users into one, well, package.
Merge has made a bundle that has a read-only role in it. Install it here.
Now that we have a role, let’s assign a user to it. Go to Manage Users (Setup→Users→Manage Users) and select a user (I picked myself). Go to the “Access” tab and select the “Merge Full Permissions” role.1
When we use an API like Stripe, we register an account with them and get an API key back, which associates us with Stripe.
Similarly, we register external services with our NetSuite instance by creating an Integration. We’ll use this to register Merge with us, and get credentials that we’ll pass to Merge down the line that it will use to make authenticated requests to our NetSuite instance.
Create an Integration (Setup→Integration→Manage Integrations→New). Specify the following:CALLBACK URL: https://app.merge.dev/oauth/callback
REDIRECT URI: https://app.merge.dev/oauth/callback
Check the following boxes
REST WEB SERVICES
TOKEN-BASED AUTHENTICATION
TBA AUTHORIZATION FLOW
Once you do that, you’ll get a Client ID and Client Secret. Write these down - we’ll need them later.
Notice that we didn’t associate the Integration with a specific NetSuite user. That’s because it’s the parent object in this situation, setting the stage to create user specific connections underneath it.
The way to form those user specific connections is by creating an Access Token:
And when you save that, you’ll get a Token ID and Token Secret. Write these down.
Configure Merge
We now have credentials that external services (like Merge) can use to connect to our NetSuite instance.
Let’s tell Merge what kind of data we want to sync from NetSuite. Go here and enable read-only access to CompanyInfo, Contact, and Invoice:
Merge calls any connections between itself and third party applications (like NetSuite) a Linked Account. Go here and click on “Create production Linked Account”
You’ll be prompted to input some details. Make sure to select “Accounting” for the Category.
One you click “Generate URL” and go to the link, you’ll enter a Plaid like experience. Select the integration (NetSuite), confirm you’re an admin, confirm you’ll get access to invoices, company information, and contacts. Put in the ID of your NetSuite instance.
And for the most important step, you’ll get make use of the hard work you did earlier. Take the output of step (5) above and put in the top two fields. Do the same with the output of step (7) for the bottom two fields.
Merge now has the ability to read your NetSuite instance.The above step automatically kicks off a sync. In my experience, it takes ~10-15 minutes for one to complete.
One wrinkle worth addressing: it’s not clear to me how far Merge goes back when syncing data. When I ran it, it went back a couple days for some data objects, but not others. Something worth digging deeper into.
If you click on your integration under the “Linked Accounts” section, it’ll show you when the last sync was done. There’s a button to “Resync all” which I’ve used when I extend the scope.
Next
You’ve now connected Merge to your NetSuite instance! Let’s go to part 3, where we write a Python script that pulls data from Merge and emails us about past due invoices.
If you’re interested in my NetSuite services (technical or functional), I currently have availability for 2025. Please message me on LinkedIn.
Not sure why a ‘Merge Full Permissions’ role is still added when we installed the read-only bundle. Anyways, that’s what the official guide suggests using so I’m rolling with it.