HubSpot

Integration guide for leveraging your HubSpot customer data.

Objective

Deploy a 'Before registration' hook in Strivacity which can retrieve contact information from HubSpot and perform data comparisons before allowing users to register.

Overview

In our example integration, we will be doing comparisons based on the email domains which users have registered in HubSpot. Only existing domain values will be allowed to register.

Prerequisites

General

  • Basic familiarity with nodejs, javascript, or similar languages
  • Basic understanding of HTTP request/response flows

OR

  • Web application development experience

HubSpot side

📘

If your admin account is unable to retrieve an API key, you may need to first provision a HubSpot "test account", and use the test account's API key.

  • Sample contacts in your developer tenant.

🚧

At least one sample contact with an email value is required.

📘

Two sample contacts are added automatically for you when registering a HubSpot developer tenant. Please review these contact details or create your own test contacts before proceeding.

Strivacity

  • A Strivacity tenant for testing
  • Identity Store supporting 'EMAIL' identifiers
  • An application in your Strivacity tenant to apply and test the Lifecycle Event Hook

Configuration steps

Set up your HubSpot tenant

  1. Select 'Custom integration' on the HubSpot developers' page.
  2. Before you continue, you will be directed to HubSpot’s guide about how to obtain the API key of your tenant.

📘

Capture the API key for future use.

  1. Follow HubSpot's onboarding process.
  2. Check 'Contacts' for your example customers.

📘

Optional You may add additional contacts to test use cases not covered in this example.

Create a 'Before registration' hook from the HubSpot plugin

Our plugin library contains an off-the-shelf HubSpot event hook template that jumpstarts your integration process and allows you to customize it to your needs.

  1. In the Admin Console, go to Lifecycle Event Hooks.
  2. Click ' Add plugin'. You will be redirected to the plugin library.
  3. Click on the HubSpot logo. You can find it in the CRM section.
  4. There will be a pre-select for the event hook, so you only need to click 'Add'.
  5. Wait for the HubSpot hook template to be added.

🚧

If the Admin Console doesn't want to add the hook, it's most likely that the name of the hook is already taken. Click 'Edit' and you can modify the name of the event hook. Then continue with 'Try again'.

  1. If the hook has been successfully added, you can return to the list view with 'Back to plugin library', then 'Back to event hooks'.

Add dependencies

  1. Select the HubSpot event hook you've just added.
  2. In editor view, click on the cube icon on the top left corner of the IDE panel.
  3. Click 'Add dependency'.
Add dependencies option

Add dependencies option

  1. Search for and add the following packages:
  • @hubspot/api-client

This should appear in the dependencies list on the left.

📘

Beta packages may not be stable. For best results use the latest stable package versions.

  1. At HUBSPOT_APIKEY, replace '_api__key' with the API key you have obtained from your HubSpot tenant.
  2. Click 'Save'. You can return to the event hooks with the 'Back to event hooks' button.

📘

Your hook's status will stay Non-Deployed until you add it to an application.

Create a Strivacity application

  1. Go to Applications and click 'Create Application'.
  2. Add a name, description, and define the mandatory properties of the application.
  3. Ensure the Identity Store supports the 'EMAIL' identifier.
  4. Scroll down to Lifecycle Event Hooks and assign your 'Before registration' hook to your Strivacity test application to integrate with HubSpot.
  5. Save your changes.

Copy the test application's self-service URL.

Test your integration

  1. Go to an incognito browser.

📘

Make sure only one incognito window is open as multiple windows share session information.

  1. Go to the self-service portal of the Strivacity application.
  2. Try to sign up as a customer who has the same email address domain as one of your Hubspot contacts.

📘

According to our example hook, this customer will be allowed registration.

  1. Try to sign up as a customer whose email address isn't among your Hubspot contacts.

📘

According to our example hook, this customer will be denied registration.

Implement additional logic for customers denied registration.