Why you should integrate HubSpot and ChatGPT One

Listen to this content


Share this article


One of the most recents buzzwords around the internet has been ChatGPT. Surrounded by bright ideas and many controversies, ChatGPT has quickly become a powerful tool to ask questions, create content, and even generate code that can produce anything from a simple landing page to complex algorithms.

But what exactly is ChatGPT?

ChatGPT is a chatbot created by OpenAPI using GPT-3 technology. GPT stands for Generative Pre-trained Transformer. Developed by OpenAI, GPT-3 is a language generation model in its third generation.

This technology is based on the transformer architecture, a type of deep learning model that does a great job when processing sequential data, such as text prompts.

OpenAI’s ChatGPT can be used in a wide range of applications, such as chatbots, content creation, and even language translation. It is able to generate text in multiple languages and can be trained using formal and informal language. Overall, it is a versatile and flexible tool that allows for natural language processing.

Here are some of the most important keywords to note when using ChatGPT:

  • Prompt: This is the input you send to ChatGPT. It can be a question, a request, or even a sentence to start a conversation.
  • Completion: This is the output ChatGPT produces. It will try to answer your prompt appropriately.
  • Token: A token is described as approximately 4 characters, and is used for both processing a request (which includes the tokens from the prompt and the completion) and for calculating the pricing of usage for ChatGPT.

How can ChatGPT be used to enhance my HubSpot efforts?

The most evident usage for ChatGPT within HubSpot is generating chatbots and conversational content for your landing page or website. ChatGPT provides humanlike answers to common questions and is able to guide potential customers through the buying process.

Another common usage is to handle customer service inquiries, making it possible to provide a more efficient and seamless customer experience while reducing the amount of time your team needs to spend answering less complex questions.

But those are not the only options. GPT-3 is a type of deep learning model, which means it’s capable of other functionalities through training, such as generating personalized email content based on the recipient’s behavior and interests and analyzing data from your lead pool.

Using GPT-3 can increase engagement and conversions, provide predictions of which leads are more likely to be converted, and enable you to prioritize your efforts and improve conversion rates.

By incorporating ChatGPT into your HubSpot efforts, you can automatize and personalize marketing campaigns, sales, and customer services. Doing this can generate a significant impact on the efficiency of your business, resulting in better performance and the achievement of your main objectives and key results.

How can I integrate ChatGPT with HubSpot?

With the help of ChatGPT, you can predict the likelihood of lead conversions in HubSpot by “fine-tuning” the model training (i.e., adapting OpenAI’s technology for lead analysis). OpenAI outlines the following four advantages of using this feature:

  • Higher quality and more personalized results
  • The ability to train the learning model using more examples that can fit into a prompt
  • The ability to save tokens
  • Lower latency requests

Because ChatGPT has been pre-trained using vast amounts of text from the open internet, a prompt will need to use the context provided by users to intuit what task they are trying to perform and generate a completion based on its knowledge.

When you fine-tune GPT-3, the trained model generates completions specific to the context it was fine-tuned with by default, which helps save costs through prompts with fewer words and allows completions to be generated with lower latency.

There are three steps to fine-tuning a model, outlined below:

  1. Prepare and upload the training data, making sure you have treated missing data and outliers.
  2. Train a new fine-tuned model with the data previously prepared.
  3. Use the fine-tuned model to generate outputs from your prompts.

It’s important to note that not all base learning models that OpenAI has are available for fine-tuning. As of this article’s writing, they only have davinci, curie, babbage, and ada available to be used as base models for training a fine-tuned model.

Setting up

The easiest way to train a fine-tuned model is by using OpenAI’s command-line interface. To install it, you can run the following command (it requires pip installed on version 0.9.4 and up):

pip install –upgrade openai

And then you need to set your OPENAI_API_KEY environment variable by adding the following line into your shell initialization script or by running it before the fine-tuning command:


After setting up OpenAI’s CLI tool, you can use it to prepare the data that will be used during the training phase of your learning model.

Preparing the training data

If you want ChatGPT to give you answers related to a specific context without having to provide it every time you create a prompt, you need to train GPT-3 with data that is related to your context. To do that, you must prepare a JSONL document (you can learn more about it here) where each line is a prompt-completion pair. The number of examples provided will influence the quality of your completions, so more data is always better.

To prepare a JSONL file using OpenAI’s CLI tool, you only need to run the following command:

openai tools fine_tunes.prepare_data -f <LOCAL_FILE>

This tool will validate the data, give suggestions, and even reformat it. The input needs to contain a prompt and a completion column/key and can be formatted as a csv, tsv, xlsx, json, or jsonl file.

The output will always be a jsonl file that is ready for fine-tuning.

Creating a fine-tuned model

Once you have your training data ready, you can start your fine-tuning job by running the following command:

openai api fine_tunes.create -t <TRAIN_FILE_ID_OR_PATH> -m <BASE_MODEL>

The base models available for use in the variable BASE_MODEL are davinci, curie, babbage, and ada, in which ada is the fastest and davinci is the most powerful. Running this command will execute the following actions:

  1. Upload the file using the files API.
  2. Create a fine-tune job within OpenAI’s queue.
  3. Stream events until that job is completed, which can take minutes or even hours if the dataset is large.

Using the fine-tuned model

After your fine-tuned model has been created, you can start using it right away! Described below is how to create a prompt for your fine-tuned model using Node.js:

const response = await openai.createCompletion({ model: FINE_TUNED_MODEL prompt: YOUR_PROMPT, });

You can even tweak your request by configuring some specific parameters, such as the maximum number of tokens generated and the level of randomness in a completion.

You can check out a complete list of adjustable parameters on OpenAI’s API reference documentation.

How to apply a GPT-3 fine-tuned model to HubSpot

Now that you have your fine-tuned model trained to generate completions within a specific context and you have your server that makes requests to your fine-tuned model running, the possibilities are endless!

In the example below, we will analyze a lead pool and find out which leads are most likely to be converted. You can create a custom property within your HubSpot Contacts such as is_likely_to_convert, which represents, you guessed it, the likelihood of a lead being converted.

After creating a custom property, you can set up a Workflow, enroll your leads, and generate prompts from your Contacts’ information. The Workflow will then send those prompts to your fine-tuned model, which will provide a completion classifying if a lead is likely to be converted or not.

This Workflow can be used to assign this information to your custom property, making it readily available to you. It’s also possible to set up a Workflow that will trigger when a new lead is registered on HubSpot.

This way the process of classification for your leads will happen automatically every time a new lead is added to your database. Learn more about OpenAI’s API by visiting their documentation.

Do you want to learn how Trio can help you integrate ChatGPT into HubSpot and help your business reach the next level? Contact us today!

Hire Exceptional Developers Quickly

Build dev teams you can trust
Companies are growing their business faster with Trio.

Share this article
With over 10 years of experience in software outsourcing, Alex has assisted in building high-performance teams before co-founding Trio with his partner Daniel. Today he enjoys helping people hire the best software developers from Latin America and writing great content on how to do that!
A collage featuring a man using binoculars, a map pin with a man's portrait in the center, and the Brazilian flag fluttering in the wind against a blue background with coding script overlaid.

Brazil's Best in US Tech: Elevate Projects with Elite Developers

Harness the Vibrant Talent of Brazilian Developers: Elevate Your Projects with Trio’s Elite Tech Teams, Pioneering Innovation and Trusted for Global Success