HubSpot contacts analytics
This is a proof of concept on how the PROCESIO platform can be used to integrate with HubSpot, fetch a contact list, iterate through it, make web searches based on a certain property of the contact to extract useful information and close the loop by posting an engagement back in HubSpot as a note containing a list of links to relevant articles along with a weighted summary of what topics are addressed in each article.
HubSpot is a cloud-based CRM designed to help align sales and marketing teams, foster sales enablement, boost ROI, and optimize the inbound marketing strategy of a company in order to generate more qualified leads.
Among its various use cases, the HubSpot platform allows sales teams to organize a pool of leads or potential leads as a list of contacts.
Properties like phone number, email, company name, status, or owner are associated with a contact which helps model the relationship with the client throughout all phases from reaching them to closing the deal.
In addition, each contact has dedicated sections like notes, tasks, and meetings that represent different types of engagement with that contact.
For example, the owner wants to keep track of what tasks they have to do regarding a certain contact. By creating a task they will remember to follow up with a call or an email and maintain the relationship with the client alive.
Also, notes are useful if one wants to have observations from previous meetings stored in a digital format, not only in a notebook.
Let's say a HubSpot user, typically a salesperson, wants to be up to date with all that's going on in the news regarding his contacts. By being constantly informed one can have valuable insight into a client's company which might be useful when approaching the contact.
Nowadays news runs fast and it's sometimes hard to keep up with the huge amount of information that's available on the world wide web. Going through each contact in HubSpot and scrolling through the news websites to find out the latest things about them sounds like a time-consuming activity.
What if, instead, you could have the top 3 most relevant articles about each contact aggregated directly in HubSpot as notes? Maybe you're interested in a certain list of topics and want to read only the articles that are related to health or investments. Having a classification of each article by topic might seem necessary.
Say you want to skip an article on Tesla (one of your contacts is working at this company) that talks about business because you are already knowledgeable about this particular combination. Just check the next article about Tesla which happens to have been identified as approaching the environment subject.
The examples can go on and on, but the bottom line is how much amount of time can be saved by having well-structured insight data enclosed in the list of contacts that you go through day by day. Data that can be easily tailored at any time to be relevant and up to date.
Before going further we should identify who are the actors in this automated play.
- you will be needing an HS account - preferably a development account for testing purposes (if you already have an HS account, development or otherwise, skip the underlying steps or take a quick read here although you still need a test account if you don't want to mess with your production like environment first)
- follow this link https://developers.hubspot.com/get-started and choose Create App Developer Account
- once done with the previous step go to the Home page and choose to Create a test account (for more info check https://legacydocs.hubspot.com/docs/faq/how-do-i-create-a-test-account)
- for API usage you will need an API key in order to make authorized calls so from the top-right corner click on the avatar and select Profile & Preferences then on the left list of settings expand the Integrations drop-down and select API Key and then create one if no active API key available and save it for later
- NewsAPI is a web project that allows users to search the web for news via powerful APIs and client libraries for several programming languages
- the existence of a wide list of search parameters lets you create versatile queries
- a similar service called newsapi.ai has APIs oriented towards analytics and one can benefit from analyzing the sentiment of a given text or the extraction of topics from a given article
- both services are well-documented and work based on API keys
- the caveat is that there are some limitations when using the free plan
Finally, it's time to connect the dots and bring PROCESIO in. If HubSpot and NewsAPI are the actors then PROCESIO is the scene, the director, the machinist...you get the idea.
If you are slightly familiar with how PROCESIO works then you can continue reading, otherwise, it will be a bit fuzzy but you can of course go through the PROCESIO documentation starting with the basics, and easily reach a level where you can understand almost any process and then come back.
The solution evolves around orchestrating four main API calls:
- getContacts - used to read all contacts from HubSpot
- getNews - a query-based search that returns news about a given contact
- analytics - a gateway to a sub-process that runs a sequence of endpoints that will be used to analyze text from articles and summarize the main topics along with their weight in that article; this is mapped into an object which will be validated and formatted for posting in HS by the parent process
- postNote - the call that posts an engagement to HubSpot which adds the results in the notes section of a given contact
For complete usage of the endpoint used to fetch news about our contacts check this link.
Similar to the other API call (getContacts) there is a REST API credential that will drive the Call API action and will take care of the authentication which is API key based.
Below is an example of a body response for a news query about McDonald's returning the 3 most relevant articles from a given day:
Within the For Each block we will process each contact in a series of steps:
- read the company name of the contact and the ID of the contact (will be used later to post back in HS in his Notes)
- call the NewsAPI and fetch the top 3 most relevant articles about that company
- here we also pass the current day (i.e. today) as we want fresh news
- call the analytics sub-process and gather some insights on what are the topics from the content of the articles
- validate the output from the sub-process while preparing the received information (list of articles + topic analysis) to be posted back in HS as a note
No-code can be tricky when dealing with lists, but we can make use of constants (variables with default values - e.g. an integer with the value 0 acting as a counter), the array of List platform actions (Get X Element, Return List Element Count), Numerical actions like Subtract Operation and, of course, Decisional action all which combined give control over the list that is being processed.
There are two reasons why I decided to organize/hide this analytics part (i.e. from analyzing each article) as a sub-process namely because it is complex and no-code is in the end about abstraction AND because having more than one contact and more than one article per contact brings the no-code developer in a For Each in For Each situation or nested For Each.
At the moment this can only be achieved in PROCESIO by calling a sub-process from the main For Each that will implement another For Each inside.
As a recap, the analytics sub-process receives a list of articles (as URLs) relevant for contact and returns another list containing the original articles and some data regarding what the articles are addressing.
Having the text provided by the extract article information call, the categorize endpoint will return a categorization by (news) topics.
Now, all that's needed is a list of connected actions (To String, String Replace, Multiply, Json Mapper, Decisional, Join, Map Process Data) which will process and format the raw information.
We've reached the final API call. Once the processing is done a variable named "toBePosted" will contain the result in the desired format. This variable and the Id read in the previous steps from the contact object it's all we need to close the loop and post back to HubSpot.
It's now time to run the process!
And check the results!
A sales use case was implemented. Fresh and valuable news about each contact from the CRM is being aggregated as a note in the contact view. Once a day new content will be uploaded and displayed in HubSpot for the salesperson to browse.
The format of the aided information can vary and it's not limited to the news link - categorization combination. Instead of using the name of the company as input for the news query one can use the contact name. Possibilities are multi-fold.
One can make use of sentiment analysis APIs or translation APIs. This is just a proof of concept showing that with PROCESIO you can bridge two complementary tools to simplify the life of the user and why not the whole department's activity.
Going forward, imagination is the only limit!