In this first masterclass workshop, you'll learn how to write a custom-coded workflow action aimed at enriching your HubSpot CRM data with company information sourced from Clearbit. This is ideal for sales teams who want to adopt an account-based selling approach or for marketing teams interested in account-based marketing.
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
1. Custom Coded Workflow Actions - Workshop
Data Enrichment using Clearbit
Jack Coldrick, Principal Solutions Engineer @ HubSpot
2. Overview
Custom Coded Workflow Actions Workshop
● What will we be doing in this workshop?
● What is a custom coded workflow action?
● Practical:
○ Step 1: Setup a HubSpot Developer Account
○ Step 2: Setup a Clearbit Account
○ Step 3: Create Custom Properties
○ Step 4: Create the Workflow
○ Step 5: Test the Workflow
● Questions
● Useful Resources
60
minutes
3. What will we be doing in
this workshop?
Your CRM is only as good as the data that is in it. There are tons of
data enrichment tools available that can help sales and marketing
teams to work more efficiently. In this workshop we’ll be integrating
with Clearbit to pull in some information which can be used for
account based marketing/selling.
4. What is a custom coded
workflow action?
Custom coded workflow actions are a feature included with
HubSpot's Operations Hub Professional and allow you to write code
in Javascript within a Node JS Runtime environment to solve for
specific use cases and processes relevant to your business.
Learn More Use Cases Blog Post
5. Step 1:
Setup a Developer Account
This is an important step, setting up a developer account. You can
do this by clicking on the link below. Once you’ve set this up you will
have a special HubSpot portal where you can create up to 10 test
portals that will allow you to try and test functionality in a controlled
environment. If you already have a developer account feel free to
skip this section!
Create a developer account
6. An overview of the developer
account
Step 1: Setup a Developer Account
When you finish setting up your developer
account you will see something similar to the
screenshot on the left. There are a couple of
items in the navigation bar:
● Apps - Register applications and manage scopes
so that it can be installed in different portals.
● Testing - Create test portals to try/test HubSpot
functionality. Each lasts 90 days and can be
renewed manually for a further 90 days.
● App Marketplace - Manage your app listing
● Docs - Links to the developer documentation
● Forums - Links to the developer community, a
great place to ask questions and converse with
like minded individuals.
7. Create a test account
Step 1: Setup a Developer Account
Test accounts are a great way to try/test
functionality in an isolated environment. They
provide access to the enterprise suite of HubSpot.
You can create a maximum of 10 test portals, each
of which lasts for a total of 90 days. They can be
manually renewed for a further 90 if desired.
1. Click on “Testing” and in the window that
appears click “Create app test account”
2. In the pop up give your account a name and
click “Ok”
3. You should see the account in the list, click
into it to access your enterprise developer
environment. This is where we’ll build our
custom coded workflow actions.
#1
#2
#3
8. Step 2:
Create a Clearbit Account
In this section we’ll be setting up a free account with Clearbit so that
we can create an API key and begin to make calls to their open and
flexible API, specifically the Data Enrichment APIs.
Create Clearbit Account
9. Setup a Clearbit Account
Step 2: Setup a Clearbit Account
If you don’t already have one an important step
is to setup a Clearbit account. You can do this
by clicking on the link below:
https://clearbit.com/
Once you’ve done this you should have access
to your Clearbit Dashboard.
What is Clearbit?
Clearbit is the marketing data platform behind the fastest-growing B2B
companies. Apply real-time intelligence across your entire stack to
improve acquisition, conversion, and operations. Clearbit delivers
complete, always-fresh visitor, contact, and account profiles, so you’re
prepared to reach the right people, make great first impressions, and
nurture relationships throughout their lifecycle.
10. Step 3:
Create Custom Properties
Clearbit returns lots of useful information that we can pass into
HubSpot. Decide which data points are important to you and create
the appropriate custom properties in HubSpot to store this
information.
View Data Returned by Clearbit
11. Create Custom Properties
Step 3: Create Custom Properties
For the purposes of this workshop I will be
creating custom properties to store values
for “Domain Aliases”, “Sub Industry” and
“Tech”.
This is by no means an exhaustive list and
you are free to create whatever properties
you like to hold whatever information you
feel is necessary.
Information on creating custom properties
can be found here.
12. Step 4:
Create the Workflow
Now that we’ve created our Clearbit account and have an API key
we can create a workflow in HubSpot to execute some custom code
that queries the API when a company is created.
Get the Code
13. Create Workflow
Step 4: Create the Workflow
Within your test account hover over
“Automation” and select “Workflows”. You
are now within HubSpot's automation tool.
From here select “Create workflow”. You will
be prompted to select a template, instead
click on the “start from scratch” tab and
ensure “Company-based” is selected.
Once this is done click on “next” and you’ll
be taken into the workflow builder screen.
14. Define enrollment Criteria
Step 4: Create the Workflow
Now we must define our enrollment criteria, in
theory you could set this to anything you like
but for the purposes of this workshop we’re
simply going to use “Create date is known”. In
other words, any time a company is created
in the CRM this workflow will be triggered.
15. Choose an action
Step 4: Create the Workflow
There are many different types of actions you
can choose to execute within a workflow. For
the purposes of this workshop we’re going to
be using “Custom Coded Action” - exclusive
to Operations Hub Professional.
Worth noting Operations Hub also gives you
the “Trigger webhook” action and “Format
data” action. They’re not going to be
leveraged in this workshop.
16. Create custom coded action
Step 4: Create the Workflow
When you click on the “Custom code” action a sidebar
similar to the one shown on the left will appear. Couple of
things to point out…
● Secrets - define any sort of variables like
usernames, passwords that you’d like to reference in
your code but keep private.
● Property to include in code - define any properties
relating to the enrolled object that you’d like to
reference in your code.
● Code - Your javascript or python, we provide a
template by default.
● Data outputs - define any data you’d like the custom
code action to pass back to the workflow to
reference at a later step.
17. Add your secrets
Step 4: Create the Workflow
Secrets - define any sort of variables like usernames,
passwords that you’d like to reference in your code but
keep private.
We want to add our Clearbit API key, we may also wish
to add our HubSpot API key at this point if we want to
use the HubSpot APIs at a later stage.
You can access your Clearbit API key by navigating to
Clearbit Dashboard and clicking “API”. Then simply copy
the value into HubSpot as shown here.
You can access your Hubspot API key by following the
instructions here.
Secrets can be referenced using “process.env.SECRET_NAME”
18. Define your inputs
Step 4: Create the Workflow
Property to include in code - define any properties
relating to the enrolled object that you’d like to reference
in your code.
This is useful as it means we don’t need to make any
unnecessary requests to the HubSpot API which is rate
limited and we can also reference outputs from other
custom coded workflow actions.
You can reference these properties using:
event.inputFields[‘PROPERTY_NAME’]
19. Add your code (Option 1)
Step 4: Create the Workflow
This option uses the Node Request Library. A HTTP GET
request is made to Clearbit Enrichment API and the data
returned is then passed back to the workflow for later use.
View Code Snippet
20. Add your code (Option 2)
Step 4: Create the Workflow
This option uses the Node Axios Library. A HTTP GET
request is made to Clearbit Enrichment API and the data
returned is then passed back to the workflow for later use.
View Code Snippet
21. Add Data Outputs
Step 4: Create the Workflow
Data outputs - define any data you’d like the custom code
action to pass back to the workflow to reference at a later
step.
22. Add “Copy to Property” action
Step 4: Create the Workflow
We want to use the output from our custom coded actions
to pass information into company properties. This can be
done using the “Copy to Property” action. Simply add this
action as many times as needed to copy into the
appropriate properties.
You should have something similar to what is shown to the
right. Bear in mind that you may need to create custom
properties if you haven’t already done so!
23. Add your code (Option 3)
Step 4: Create the Workflow
This option uses Axios and updates the company records
using the HubSpot API Client. It operates in much the
same way as the previous examples but instead we don’t
use the “Copy to Property” action we simply update the
Company using the HubSpot CRM API.
View Code Snippet
24. The finished product(s)
Step 4: Create the Workflow
Depending on whether you went with example 1, 2 or
3 you should have a similar output to the screenshots
on the right. You are of course free to modify further.
For instance you could just to add additional code
actions or if/then logic to enroll the company in
industry specific or tech specific workflows for ABM
(Account Based Marketing).
25. Step 5:
Test the Workflow
Providing you’ve now setup the database and the workflow it is time
to test to ensure all is working as expected. Create a company
within the CRM, they should be enrolled into the workflow.
26. Test the Workflow
Step 5: Test the Workflow
All custom coded workflow actions can be tested prior to turning the
workflow on. Simply click on the “Test action” title in the sidebar.
Enter the name of the company to enroll and click “Test”. You should
see something similar to the screenshot on the slide.
Also, be mindful that whilst running a test will run the code snippet in
isolation from the rest of the workflow the code will actually run so it
might be wise to use a test record for safe measure.
If you are happy with the results you can turn your workflow on and
any time you add companies to the CRM a request will be made to
Clearbit and data will be copied to the appropriate properties.
PROTIP:
If you add any console.log() statements to your code they’ll also
render in the log when testing the action, this can be particularly
useful when trying to debug your code.
29. Connect with me
For more tips, tricks and tutorials feel free
to connect with me on LinkedIn
https://www.linkedin.com/in/jackcoldrick/
30. Resources
Custom Coded Workflow Actions
● Workshop 1 Code Snippets
● 3 Ways to Use Custom Coded Workflow Actions -
Developer blog post
● Clearbit API Documentation
● Clearbit HubSpot Integration
● Use Custom Coded Actions in Workflows - Knowledge
base article
● Custom Coded Workflow Actions - Developer
Documentation
● Programmable Automation Use Case Library
● Operations Hub Product Page
● Operations Hub Community
● Previous Community Workshops
○ Workshop #1
○ Workshop #2
○ Workshop #3
There are a ton of useful resources online
relating to operations hub and custom coded
workflow actions specifically. On the left are
some of the resources I would recommend
reviewing to learn more. I’d also highly
recommend checking out my blog post below
Editor's Notes
For more tips, tricks and tutorials feel free to connect with me on LinkedIn
https://www.linkedin.com/in/jackcoldrick/
For more tips, tricks and tutorials feel free to connect with me on LinkedIn
https://www.linkedin.com/in/jackcoldrick/