HubSpot
Integration guide for leveraging your HubSpot customer data.
Objective
Deploy a pre-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
- HubSpot custom integration developer tenant
- Familiarize yourself with HubSpot's API-client package
- HubSpot API key. Find more information about the API key in HubSpotโs knowledge base.
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 Fusion tenant for testing
- Identity Store supporting 'EMAIL' identifiers
- An application in your Strivacity Fusion 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.
3) Follow HubSpot's onboarding process.
4) Check 'Contacts' for your example customers.
Optional You may add additional contacts to test use cases not covered in this example.
Create a Pre-Registration hook in Strivacity Fusion
1) In the Admin Console, got to Lifecycle Event Hooks.
2) Click 'Create Lifecycle Event Hook'
3) Fill in the basic information:
- Name your new hook
- Add a description
- Select 'Pre-Registration' for the hook type
4) Save to continue.
Add dependencies
5) Click the gears icon on the top left corner of the IDE panel.
6) Select Add Dependency.
7) Search for and add the following packages:
- hubspot/api-client
Note: Beta packages may not be stable. For best results use the latest stable package versions.
Your screen should now look like this:
You may collapse the Dependencies menu at this time.
Add the example hook
8) Go to our repository to fetch the Pre-Registration hook we provide as a jumping-off point for HubSpot integration.
9) Replace the default Pre-Registration code block with the hook code from the repository.
10) At HUBSPOT_APIKEY, replace '_api__key' with the API key you have obtained from your HubSpot tenant.
11) Save your hook.
Your hook's status will stay Non-Deployed until you add it to an application.
Create a Strivacity Fusion 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 Pre-Registration hook to your Strivacity Fusion 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.
2) Go to the self-service portal of the Strivacity Fusion application.
3) 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.
4) 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.
Updated 5 months ago