Skip to main content
This recipe runs a Know Your Business (KYB) journey end to end with the GBG Go Core SDK for TypeScript or Java. You start a journey, submit a business name and registered address, and read back the Business Insights result. Each step also shows the API request, if you call the API directly with cURL. The recipe uses the Global Business Entity Verification variant of the Business Insights module. The code and responses on this page come from a live journey, trimmed for length.
Always send a participants array when you submit business details, whether you use a Core SDK or the API. Without it, the submit call still returns "status": "success", but the journey doesn’t store the data and stays on the same interaction. For details, see Troubleshooting.

Before you begin

You need a GBG Go access token. For details, see Authenticate.

Set up a Core SDK

Skip this section if you call the API directly. Install the Core SDK for your language. KYB needs TypeScript Core SDK 0.2.0-alpha.0 or later, or Java Core SDK 0.2.0-alpha01 or later. Earlier TypeScript versions, including 0.1.3, drop the entities field that holds the business details.
Create a client with your access token. The steps that follow use this go client and the accessToken variable:
In these SDK versions, set serverURL to the host only, without /v2/captain. The SDK adds the path itself. Use the us or au host if your account is in another region.

Step 1: Build the journey

The journey for this recipe has one interaction that collects the business details, followed by the Business Insights module.
  1. Create a new journey or open an existing one in the Journey builder.
  2. In the Browse and add modules panel, click Search all modules and enter Business Insights.
  3. Select the Business Insights module.
  4. Choose the Global Business Entity Verification variant.
  5. Click Add to journey.
  6. Click the Business Insights module, and then click Settings.
The settings window for the Global Business Entity Verification variant has three settings:
Business Insights settings window for the Global Business Entity Verification variant
Each Business Insights variant has its own settings. If you choose the US Taxpayer Verification variant, then its settings window shows a different set. For more on module settings, see How to configure module settings in Go.
  1. Click Save all settings, and then click Close.
  2. Click Publish to Preview.
  3. Go to the GBG Go Dashboard and copy the journey’s Resource ID and Version.
The module’s default outcomes are Business Match, Business Partial Match, Business Mismatch and Error. To route on them, see Configure outcome decisions.

Step 2: Start the journey

Start a journey with your Resource ID and Version. With the API, send a POST request to /journey/start:
Replace the resourceId value with your own Resource ID and Version. In the cURL request, also replace your_access_token with your access token. Response:
JSON
Keep the instanceId. Every following call uses it.

Step 3: Fetch the interaction

Fetch the interaction to find out what the journey needs. With the API, send a POST request to /journey/interaction/fetch:
In both SDKs, the fetch call takes the access token again as interactionAccess. In Java, the null argument asks for the full response. The SDK returns the response as one of two shapes, so the code reads interactionId from whichever one arrives. Response:
JSON
The response tells you three things:
  • interactionId: Pass this back unchanged when you submit. The submit endpoint rejects the short form segment1.
  • PrimaryEntity/name: The only required field. It’s the business’s registered name.
  • outstandingGroups: The EntityAddress group has at-least-one cardinality, so supply at least one address component. Send every component you have, because the module matches each one separately.
The live response lists more optional fields than shown here, such as PrimaryEntity/registrations, PrimaryEntity/phones and EntityAddress/location. To get the full JSON schema for every field, call /journey/schema/fetch with your resourceId.

Step 4: Submit the business details

The journey refers to the business as the PrimaryEntity and EntityAddress domain elements. In the request body, they map to an entry in context.subject.entities: Submit the business details, and name both domain elements in participants. With the API, send a POST request to /journey/interaction/submit:
Response:
JSON
The Business Insights module then runs in the background. In testing, the journey completed about four seconds after the submit.

Step 5: Poll for the result

Fetch the journey state every second or two while status is InProgress. With the API, send a POST request to /journey/state/fetch:
In the Java Core SDK, context() on the state is a map, so the outcome helper reads the result by key.
Poll the journey state, not the interaction. Straight after a submit, /journey/interaction/fetch can still return the business details interaction while the module runs.
Response:
JSON
When status is Completed, read the Business Insights entry in context.process.steps:
  • result.outcome: The module’s outcome. Route on this value in the Journey builder or in your own code.
  • result.advice: The individual checks behind the outcome. For what each value means, see Business Insights.
  • result.note.customAttributes.businessNameMatches: The registry records that matched the business name, including the source registry and company number.

Read the outcome

The outcome depends on businessMatch and addressMatch in the advice. These three submissions ran against the same journey: A name match alone gives Business Partial Match. To return Business Match, the address must also match fully or partly.

Optional: Send the business details at start

If you already hold the business details, then put them in context.subject when you start the journey. The journey skips the business details interaction and runs the module straight away.
The start response is the same as in Step 2. Skip Steps 3 and 4, and poll for the result as in Step 5. To get the result in the start response instead, see Run a journey synchronously.

Troubleshooting

These are the problems seen most often when submitting business details.
The submit request doesn’t include a participants array. GBG Go returns "status": "success", but the next fetch still lists PrimaryEntity/name as outstanding. The state endpoint shows an empty subject.Add participants with PrimaryEntity and EntityAddress, as in Step 4, and submit again.
GBG Go validates the submitted business details against the journey schema and returns 400 with a 4002 error code. The problem field names the field at fault.The Core SDKs throw an ErrorResponse with this body. Read it from body in TypeScript, or with bodyAsString() in Java.A failed submit leaves every field outstanding, so you can correct the request and submit it again.