7.8.2. How to integrate with Netsuite
Babelway supports two authentication methods to integrate with Netsuite:
Token based (issue token)
OAuth 2 Authorization code grant
At the moment, we still recommend the first integration method. The Authorization code grant requires refreshing the integration frequently (by logging into Babelway and re-authorizing the app in Netsuite). Thus, for machine to machine integration, we recommend to using the issue token authentication until further update.
Configuring Netsuite to support the Issue Token Integration
Netsuite account ID
This is the easiest information to get: Setup > Setup Manager > Integration > SOAP Web Services Preferences > ACCOUNT ID:
Setting up an integration
Your netsuite needs to allow SOAP service calls and token integration:
Go to Setup > Setup Manager > Enable features > Suitecloud:
In the suitecloud tab, enable SOAP services and token based authentication:
You then need to create an integration record for Babelway:
You will be using the issue token integration flow which is configured as you can see below:
Make sure that:
- You choose a name that identifies your connection to Babelway
- The state is “enabled”
- That you select Token-based authentication where:
- Token-based authentication is checked
- TBA: ISSUETOKEN ENDPOINT is checked
- TBA:AUTHORIZATION FLOW is UNCHECKED
When you click save, the client key and secret will be displayed one time only. Use this in your babelway gateway configuration.
Getting an access token
Create a role to be used for this integration with the following permissions:
-
Transactions: The role will need to be able to update invoices (to update the babelway specific field):
- Reports: SuiteAnalytics Workbook (allows the use of saved searches)
- Lists: Perform search
- Setup: Use access tokens
Attribute this new role to a user of your choice:
Create an access token for this user and this role:
Select your integration name, the user, the role you just attributed them.
The token information you receive after saving will only be displayed once and will be used in your gateway configuration.
Determine the list of documents to fetch
Babelway will require a custom date/time field which will be used to indicate the time at which the document was synchronized. Go to Customization > List, Records, & Fields > Transaction Body Fields
Add a field. Keep track of its ID for your babelway gateway. In the below example the field is “custbody11”:
Add your custom field to the invoice form that you plan on using:
Create a saved search that at the minimum includes the following criteria:
- Your new custom date time field is empty (avoids pulling duplicate invoices from Netsuite)
- The record type is Invoice
Add any other relevant criteria for your business integration requirements.
Keep track of your Saved Transaction Search ID for your babelway setup. In the above example, it is customsearch659.
Check out our "Netsuite gateway in" documentation to set up an integration pulling invoices from Netsuite
Configuring Netsuite to support OAuth2 Integration
You will need to configure your Netsuite setup to authorize OAuth2 authentication.
Enable the OAuth2 feature for your environment
Go to Setup > Company > Enable features > Suite cloud.
Make sure OAuth 2.0 is enabled
Make sure REST services are enabled
Configure an OAuth2 integration record
Netsuite documentation: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157771733782.html
You will need to complete the OAuth 2.0 integration record form found at Setup > Integration > Manage Integrations > New.
Complete the form as follows:
- Redirect URI: https://www.babelway.net/SelfService3/CreateGatewayOAuth2Redirect.html
- Authorization code grant: checked
- Rest Web Services & Restlets: checked
Upon saving the page you will receive client credentials which will only be displayed once. Save these values for your gateway configuration.
Configuring your HTTP client gateway authentication
Create a gateway HTTP client gateway IN or OUT depending on the business flow you would like to set up (pushing information into Netsuite - OUT or pulling information from Netsuite - IN). The authentication setup does not vary depending on the direction of the flow.
Note that this setup is an advanced setup so:
- The simple HTTP client will not suffice, opt for the advanced one.
- All fields required to configure this setup will not be available on the form during gateway creation. We recommend creating dummy gateway and going back to the full list of properties of the gateway to be able to adapt it with the values below.
Complete your authentication as follows:
- Authentication type: OAuth 2.0
- OAuth2 Provider: Netsuite
- Subdomain: The subdomain is your application name. It is the subdomain of your Netsuite instance URL: https://{netsuite subdomain}.app.netsuite.com/
- Application (client) ID: use the client ID you saved from the integration record creation step.
- Client secret: use the client secret you saved from the integration record creation step
- Custom scopes: add at the very least rest_webservices, make sure the list of scopes here matches the ones checked when creating your integration record in the list above. Otherwise Netsuite will throw a "conflicting scope" error.
And then click on the "Sign In with Netsuite" button. You will be asked to log into your Netsuite account in order to grant Babelway the right to use OAuth2 on your behalf. You should then see that grant flow succeeded:
Configuring API calls
You should find examples of Netsuite gateways configured to push or pull different document types in our Babelway catalog. This is accessed through the "reuse and save time" button on the gateway creation screen.
The REST API is available here: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_1558962745.html#Web-Services-Supported-Records
TIPs:
- When troubleshooting your API calls, begin with a NOT DEFINED > NO TRANSFORM > NOT DEFINED channel in order not to be blocked by the possibly varying message format you will receive.
- When troubleshooting your API calls, use as a create message action "Script" and "responseContent" in order to get the full response of your API Call. This will allow you to further narrow down what you wish to extract as actual message data.