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 in order 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 it's various use cases HubSpot platform allows sales teams to organize a pool of leads or potential leads as a list of contacts which are basically clients.
Properties like phone number, email, company name, status or owner are associated with a contact which help 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, 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 some observations from previous meetings stored in a digital format not only in a notebook.
Let's say a Hubspot user, typically a sales person, 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 about a client's company which might come in handy when approaching the contact.
Nowadays news run 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 topics might seem necessary.
Say you want to skip an article on Tesla (one of your contacts is working at this company) that talks about bussiness because you are already knowledgeable about this particular combination (Tesla & bussiness). 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 in order to be relevant and up to date.
Before going further we should identify who are the actors in this automation play.
HubSpot
NewsAPI
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 - query based search that returns news about a given contact
- analytics - a gateway to a subprocess that runs a sequence of endpoints which 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
getContacts
First we want to bring all contacts into the process. I used the Call API v2 action and configured it according to the HubSpot API documentation namely the contacts section.
HubSpot has a limit of 100 contacts per page. The scope of this article does not cover scenarios with over 100 contacts in the CRM. For that you might need to use a forEach loop to iterate through each set of contacts.
The configuration should include choosing a previously created REST API credential. You just need to create a new entry in the credential manager for HubSpot API where you set the root of the endpoints you will be using along with the authentication method (api key) and a test endpoint in order to see that it's working.
An important note here is that you don't need to mention the authentication method later when using this credential in any of your processes. This will be stored in the configuration from the credential manager and taken into account automatically on top of building your request.
This is how the request looks like. Just save the body ouput in a JSON variable and optionally the status output in an integer variable and start using it. You can also test it before in Postman or directly in the action with the Test Action feature.
๏ปฟ
There are two methods in which you can save the body output of a request:
- using a JSON variable
- using a DataModel object variable
In the second you will have to go the Data Models section -> Create from JSON (should be visible after expanding the arrow on the right of Create data model) -> give it a name and then choose Editor (JSON content) radio button that will bring an editor where you can paste the raw JSON of your expected body output response. A Data Model will be created with the keys and values from that JSON.
๏ปฟ
Each approach has it's advantages and disadvantages. For option 1 you'll need to use a JSON Mapper action and with JSON path language query your way to what object you need. Option 2 it is more intuitive since you have your JSON serialized into an object. Ultimately it is your choice.
Once the list of contacts is extracted by using the JSON Mapper action then it should be iterated upon using the ForEach action.
getNews
For a 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 McDonalds returning the 3 most relevant articles from a given day: https://newsapi.org/v2/everything?language=en&pageSize=3&apiKey=1141c8246ce145de935eb629648daac9&from=2022-05-24&q=mcdonalds
Within the ForEach 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 top 3 relevant articles about that company
- here we also pass the current day (i.e. today) as we want fresh news
- call the analytics subprocess and gather some insights on what are the topics from the content of the articles
- validate ouput from the subprocess 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 Substract operations and, of course, Decisional action all which combined give a standard programming for(;;;) like control over the list that is being processed.

analytics
There are two reasons why I decided to organize/hide this analytics part (i.e. from analyzing each article) as a subprocess 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 forEach in forEach situation or nested forEach.
At the moment this can only be achieved in PROCESIO by calling a subprocess from the main forEach that will implement another forEach inside.
As a recap the analytics subprocess receives a list of articles (as URLs) relevant for a contact and returns another list containing the original articles and some data regarding what the articles are addressing.
๏ปฟ
There are two API calls to the analytics enpoints of NewsAPI: categorize and extract article information. Let's showcase the latter.
Having the text provided by the extract article information call, the categorize enpoint will return a categorization by (news) topics.
Now all that's needed is a list of connected actions (ToString, String Replace, Multiply, JSON Mapper, Decisional, Join, Map Process Data) which will process and format the raw information.
๏ปฟ

postNote
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 sales person 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 multifold.
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 in order to simplify the life of the user and why not the whole department's activity.
Imagination is the only limit!
๏ปฟ
๏ปฟ
๏ปฟ
๏ปฟ
