Establish connections in HubSpot using Webflow Logic

Use Logic’s Make HTTP request block to create new contacts in HubSpot from Webflow form submissions.

HubSpot is a widely-used Customer Relationship Management (CRM) system where you can monitor customer data and optimize sales and marketing strategies. By utilizing Logic, you can efficiently transfer contacts from a form submission to Hubspot and integrate your Webflow portal with your CRM.

To begin: If you have not done so already, set up an account on HubSpot. Additionally, ensure you have included a form on your Webflow site with fields that align with the required fields in HubSpot.

Within this tutorial, we will discuss:

  1. The process for generating your HubSpot API key
  2. Setting up the authentication for your Logic workflow
  3. Locating the HubSpot API documentation
  4. Configuring the HTTP request settings
  5. Testing and deploying your workflow
  6. Troubleshooting potential issues with your workflow

Generating your HubSpot API key

Keep in mind: HubSpot offers a choice between 2 authentication methods (OAuth and private app access tokens). This guide focuses on the private app access tokens method.
  1. Access your HubSpot account and proceed to create a private app, if not done already
  2. Select the Scopes tab and indicate the actions you intend to perform using this API key under the CRM dropdown (ensure to pick at least crm.objects.contacts.write to send contacts to Hubspot)
  3. Click Show token and copy your API key

Configuring the authentication for your Logic workflow

  1. Open your Webflow site in the Webflow Designer by launching a new tab
  2. Choose your form on the Designer canvas and access Form settings
  3. Select the Source dropdown and opt for Logic
  4. Click Add new flow
  5. Name your new flow (e.g., “Establish connections in HubSpot”) in the Name field and optionally add a description in the Description field
  6. Drag a Make HTTP request block to the flow editor canvas and assign a name (e.g., “Initiate new contact in HubSpot”) 
  7. From the Authentication dropdown menu, select API token
  8. Choose Header from the Add to options
  9. Input “Authorization” in the Header field
  10. Click Select a credential > Add new credential
  11. Name your API token (e.g., “HubSpot API token”) in the Name field and provide a description in the Description field if needed
  12. Enter “Bearer {API key}” in the Token field, replacing {API key} with the copied API key from HubSpot
  13. Save your new credential by clicking Create and ensure to keep this tab open! 
Pro tip: Alongside, you can link your form to a new Logic workflow from the Logic panel > Flows tab. Further insights about form submission triggers can be found in Logic.
Options to Add a new flow or Browse flows appear in Form settings when Logic is selected as the source.
The connection between a form and Logic can be established via Form settings, Form block settings, or from the Logic panel > Flows tab.
“Header” is chosen in the Add to dropdown and “Authorization” is entered in the Header input field.
The “New credential” modal window displays fields for the name, description, type, and value of an API credential.
For APIs employing bearer authentication (e.g., HubSpot), remember to insert “Bearer” before your API key in the Token field.

Locating the HubSpot API documentation

  1. Visit the HubSpot API reference documentation
  2. Scroll down to CRM located in the left panel
  3. Navigate to Objects > Contacts > Create contacts and retain this tab open for guidance!

Configuring the HTTP request settings

After setting up your Logic flow and HubSpot authentication credentials, return to Webflow to define an HTTP request in your flow. The HTTP request configuration at this stage will establish a new contact in Hubspot upon each form submission by a visitor.

Note: In case you closed the tab where your Webflow site was open, navigate to Logic panel > Flows tab and select the flow created in the previous steps. Click on the Make HTTP request block on the flow editor canvas to open block settings and proceed with the following steps.
  1. Choose POST from the Request method dropdown
  2. Paste “https://api.hubapi.com/crm/v3/objects/contacts” in the URL field
  3. Click on the “plus” icon adjacent to Headers to add a new header
  4. Input “content-type” in the Name field and “application/json” in the Value field 
  5. In the Body field, paste the code snippet for creating contacts provided in HubSpot’s API documentation — it will resemble this (yet contain properties

    {
        "organization": "Biglytics",
        "contact-email": "[email protected]",
        "givenname": "Bryan",
        "surname": "Cooper",
        "telephone": "(877) 929-0687",
        "webpage": "biglytics.net"
      }
    

To proceed, you will have to incorporate live information into your HTTP request for collecting data from the submissions you receive via your forms:

  1. Erase the existing content from your HubSpot contacts, and position your cursor within the empty quotation marks in the Content section
  2. Choose the violet “dot” symbol and pick the corresponding dynamic form element (for instance, name, email, etc.)
The Content section encompasses dynamic form components to fetch surname, given name, and contact email from form submissions.
The comprehensive HTTP request settings setup for transmitting data to Hubspot includes authentication process, request technique, URL, headers, and request body with variables for fetching data from the Webflow form.
An entire POST request to Hubspot from Logic’s Construct HTTP request block.

The procedure to test and release your sequence

  1. Press Execute test to finalize configuration
  2. Input test values into their appropriate fields
  3. Press Execute test
  4. Tap on Terminate or Accept data to leave the test mode
  5. Click on Make public
  6. Hit Prepare flow for publication
  7. Proceed with publishing your website
Tip: If you encounter an error notification during the test process, address the issues by following our problem-solving measures, and then repeat the aforementioned steps. Discover additional details about examining HTTP requests.

Procedures for addressing concerns within your sequence

If you come across an error while testing your sequence, attempt the following measures:

  • Verify that you have included “Bearer” (along with a space) before your API key while configuring your credentials (e.g., Bearer 123456789)
  • Inspect for any errors in your request body utilizing a cost-free tool like JSONLint
Ewan Mak
Latest posts by Ewan Mak (see all)