HubSpot

Overview

The HubSpot connector enables your Leena AI Agents to integrate with your organization's HubSpot CRM platform, facilitating automated CRM management, entity lifecycle operations, and sales pipeline workflows.

HubSpot is a leading CRM platform that helps businesses manage contacts, companies, deals, tickets, and other objects throughout the customer lifecycle. The HubSpot connector allows Leena AI to automate CRM workflows, manage records, search entities, and interact with pipelines seamlessly.

API Details

Leena AI integrates with HubSpot via REST APIs.

Documentation link: https://developers.hubspot.com/docs/api/crm

Setup

The HubSpot connector uses Bearer Token authentication with a Private App Access Token.


Prerequisites

Before setting up the HubSpot connector, ensure you have:

  • Super admin access to your HubSpot account
  • Access to HubSpot Settings > Integrations > Private Apps
  • Ability to create Private Apps in HubSpot
  • Access to your Leena AI workspace with connector management permissions

Get credentials

Here is how to create a Private App and obtain an Access Token in HubSpot:

  1. Log in to your HubSpot account (Ensure you're signed in as a super admin).
  2. Navigate to Private Apps:
    1. Click on the Settings icon in the main navigation bar
    2. In the left sidebar, go to Integrations > Private Apps
  3. Create a new Private App:
    1. Click Create a private app
    2. On the Basic Info tab, enter a Name for your app (e.g., "Leena AI Integration")
    3. Optionally add a Description and upload a Logo
  4. Configure Scopes:
    1. Click the Scopes tab
    2. Under CRM, select the required scopes based on the entities you want to manage:
      • crm.objects.contacts.read and crm.objects.contacts.write - For Contacts
      • crm.objects.companies.read and crm.objects.companies.write - For Companies
      • crm.objects.deals.read and crm.objects.deals.write - For Deals
      • crm.objects.tickets.read and crm.objects.tickets.write - For Tickets
      • crm.objects.quotes.read and crm.objects.quotes.write - For Quotes
      • crm.objects.line_items.read and crm.objects.line_items.write - For Line Items
      • crm.schemas.read - For reading object properties
  5. Create the App:
    1. Click Create app in the top right corner
    2. In the confirmation dialog, click Continue creating
  6. Copy Access Token:
    1. On the app details page, locate the Access token card
    2. Click Show token to reveal your access token
    3. Click Copy to copy the token (Store this securely - it's displayed only once)

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "HubSpot" and select it from the list to add its new connector
  4. Start configuring the connector:
    1. Auth Type: Select "Access token"
    2. Access Token: Paste the Private App access token copied from HubSpot
  5. Save the connection configuration
  6. Test the connection to verify it's working correctly

Actions

The following actions are supported for the HubSpot connector:

Create

Creates a new record in HubSpot for any supported entity type. The Agent can leverage the skill (workflow), which has been designed to create new CRM records in HubSpot, once the user raises a query to do so.


Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
entityThe type of HubSpot object to create. Options: companies, contacts, deals, lineItems, products, tickets, quotes, calls, emails, meetings, notes, postalMails, tasks
propertiesA JSON object containing the property values for the new record

Optional

Name

Description

associations

Array of associations to link the new record with existing records, each containing:

  • to.id: The ID of the record to associate with
  • types: Array of association type objects with:
    • associationCategory: Category of association (HUBSPOT_DEFINED, USER_DEFINED, INTEGRATOR_DEFINED)
    • associationTypeId: Numeric ID of the association type

Here is a sample JSON input:

//Create a Contact

{
  "entity": "contacts",
  "properties": {
    "email": "[email protected]",
    "firstname": "John",
    "lastname": "Doe",
    "phone": "+1-555-123-4567",
    "company": "Acme Corp",
    "jobtitle": "Software Engineer"
  }
}

//Create a Deal

{
  "entity": "deals",
  "properties": {
    "dealname": "Enterprise License - Q1 2025",
    "dealstage": "appointmentscheduled",
    "pipeline": "default",
    "amount": "50000",
    "closedate": "2025-03-31"
  }
}

//Create a Company

{
  "entity": "companies",
  "properties": {
    "name": "Acme Corporation",
    "domain": "acme.com",
    "industry": "Technology",
    "phone": "+1-555-000-0000",
    "city": "San Francisco",
    "state": "California"
  }
}

//Create a Contact with Association to Company

{
  "entity": "contacts",
  "properties": {
    "email": "[email protected]",
    "firstname": "Jane",
    "lastname": "Smith"
  },
  "associations": [
    {
      "to": {
        "id": "12345678"
      },
      "types": [
        {
          "associationCategory": "HUBSPOT_DEFINED",
          "associationTypeId": 1
        }
      ]
    }
  ]
}

Response

Upon successful creation, the action returns the created record details including:

  • Record ID
  • Created timestamp
  • All property values
  • Association details (if specified)

Read

Retrieves a single record from HubSpot by its ID. This action can be leveraged by Leena AI Orchestrator/Agent to fetch detailed information about a specific CRM record. Here are some common use cases:

  • Contact Lookup: Get full details of a contact by ID
  • Deal Review: Retrieve deal information including stage and amount
  • Company Details: Fetch company information for account management
  • Record Verification: Verify record existence and current property values

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
entityThe type of HubSpot object to retrieve
entityIdThe unique identifier (ID) of the record to retrieve

Optional

NameDescription
propertiesArray of property names to include in the response
propertiesWithHistoryArray of property names for which to include historical values
associationsArray of object types to include associated records for
archivedWhether to retrieve archived records (true/false)
idPropertyThe property to use as the unique identifier (if not using default ID)

Here is a sample JSON input:

//Basic Read

{
  "entity": "contacts",
  "entityId": "12345678"
}

//Read with Specific Properties

{
  "entity": "contacts",
  "entityId": "12345678",
  "properties": ["email", "firstname", "lastname", "phone", "company"]
}

//Read with Associations

{
  "entity": "deals",
  "entityId": "98765432",
  "properties": ["dealname", "amount", "dealstage"],
  "associations": ["contacts", "companies"]
}

//Read with Property History

{
  "entity": "deals",
  "entityId": "98765432",
  "properties": ["dealname", "amount"],
  "propertiesWithHistory": ["dealstage"]
}

//Read Archived Record

{
  "entity": "contacts",
  "entityId": "12345678",
  "archived": true
}

Response

The action returns the record details including:

  • Record ID
  • Requested property values
  • Property history (if requested)
  • Associated records (if requested)
  • Created and updated timestamps

Update

Updates an existing record in HubSpot. The Agent can leverage the skill (workflow), which has been designed to modify existing CRM records in HubSpot, once the user provides the record details to be updated. Here are some common use cases:

  • Update Contact Info: Modify contact details like phone or email
  • Progress Deals: Update deal stages and amounts
  • Modify Company Data: Update company information
  • Data Enrichment: Add or update property values on records

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
EntityThe type of HubSpot object to update
Entity IDThe unique identifier of the record to update
Properties (JSON)A JSON object containing the property values to update

Optional

NameDescription
ID Property (Optional)The property to use as the unique identifier (if not using default ID)

Here is a sample JSON input:

//Update Contact Information

{
  "entity": "contacts",
  "entityId": "12345678",
  "properties": {
    "phone": "+1-555-987-6543",
    "jobtitle": "Senior Software Engineer"
  }
}

//Update Deal Stage

{
  "entity": "deals",
  "entityId": "98765432",
  "properties": {
    "dealstage": "closedwon",
    "amount": "55000",
    "closedate": "2025-02-15"
  }
}

//Update Company Information

{
  "entity": "companies",
  "entityId": "11223344",
  "properties": {
    "numberofemployees": "500",
    "annualrevenue": "10000000",
    "industry": "Software"
  }
}

//Update with Custom ID Property

{
  "entity": "contacts",
  "entityId": "[email protected]",
  "idProperty": "email",
  "properties": {
    "lifecyclestage": "customer"
  }
}

Response

Upon successful update, the action returns:

  • Updated record details
  • All current property values
  • Update timestamp
  • HTTP status code

Archive

Archives (soft deletes) an existing record in HubSpot. The Agent can leverage the skill (workflow), which has been designed to archive CRM records in HubSpot, once the user specifies the record to be archived. Here are some common use cases:

  • Remove Duplicates: Archive duplicate contact records
  • Clean Up Data: Archive outdated or irrelevant records
  • Deal Management: Archive lost or cancelled deals
  • Data Maintenance: Maintain clean CRM data

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
entityThe type of HubSpot object to archive
entityIdThe unique identifier of the record to archive

Here is a sample JSON input:

//Archive a Contact

{
  "entity": "contacts",
  "entityId": "12345678"
}

//Archive a Deal

{
  "entity": "deals",
  "entityId": "98765432"
}

//Archive a Company

{
  "entity": "companies",
  "entityId": "11223344"
}

Response

Upon successful archival, the action returns:

  • Confirmation of successful archive operation
  • The archived record's ID

Search

Searches for records in HubSpot based on filter criteria. This action can be leveraged by Leena AI Orchestrator/Agent to find specific records or segments of records. Here are some common use cases:

  • Find Contacts: Search contacts by email, name, or other properties
  • Filter Deals: Find deals in specific stages or pipelines
  • Segment Data: Create dynamic segments based on property values
  • Lead Qualification: Find records matching specific criteria

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
EntityThe type of HubSpot object to search
Search Object (JSON)A JSON object containing the search criteria

The Search Object (JSON) structure includes:

Name

Description

filterGroups

Array of filter groups, each containing an array of filters with:

  • propertyName: The property to filter on
  • operator: The comparison operator (EQ, NEQ, LT, LTE, GT, GTE, BETWEEN, IN, NOT_IN, HAS_PROPERTY, NOT_HAS_PROPERTY, CONTAINS_TOKEN, NOT_CONTAINS_TOKEN)
  • value: The value to compare against (for single value operators)
  • values: Array of values (for IN, NOT_IN operators)
  • highValue: Upper bound value (for BETWEEN operator)

properties

Array of property names to include in the results

sorts

Array of sort criteria strings

query

Free text search query (optional)

limit

Maximum number of results to return

after

Pagination cursor for retrieving next page of results

Here is a sample JSON input:

//Search Contacts by Email

{
  "entity": "contacts",
  "searchObj": {
    "filterGroups": [
      {
        "filters": [
          {
            "propertyName": "email",
            "operator": "EQ",
            "value": "[email protected]"
          }
        ]
      }
    ],
    "properties": ["email", "firstname", "lastname", "phone"],
    "sorts": ["createdate"],
    "limit": 10,
    "after": 0
  }
}

//Search Deals by Stage

{
  "entity": "deals",
  "searchObj": {
    "filterGroups": [
      {
        "filters": [
          {
            "propertyName": "dealstage",
            "operator": "IN",
            "values": ["appointmentscheduled", "qualifiedtobuy"]
          }
        ]
      }
    ],
    "properties": ["dealname", "amount", "dealstage", "closedate"],
    "sorts": ["amount"],
    "limit": 50,
    "after": 0
  }
}

//Search with Multiple Filters

{
  "entity": "contacts",
  "searchObj": {
    "filterGroups": [
      {
        "filters": [
          {
            "propertyName": "lifecyclestage",
            "operator": "EQ",
            "value": "lead"
          },
          {
            "propertyName": "state",
            "operator": "EQ",
            "value": "California"
          }
        ]
      }
    ],
    "properties": ["email", "firstname", "lastname", "company", "lifecyclestage"],
    "sorts": ["createdate"],
    "limit": 100,
    "after": 0
  }
}

//Search Deals by Amount Range

{
  "entity": "deals",
  "searchObj": {
    "filterGroups": [
      {
        "filters": [
          {
            "propertyName": "amount",
            "operator": "BETWEEN",
            "value": "10000",
            "highValue": "100000"
          }
        ]
      }
    ],
    "properties": ["dealname", "amount", "dealstage"],
    "sorts": ["amount"],
    "limit": 25,
    "after": 0
  }
}

Response

The action returns:

  • Array of matching records with requested properties
  • Total count of matching records
  • Pagination information
  • HTTP status code

Retrieve All Pipelines

Retrieves all pipelines for a specific object type in HubSpot. This action can be leveraged by Leena AI Orchestrator/Agent to get a list of available pipelines for deals, tickets, or other pipelined objects. Here are some common use cases:

  • Pipeline Discovery: Get all available pipelines for configuration
  • Workflow Setup: Retrieve pipeline options for workflow design
  • Reporting: Get pipeline information for reporting purposes

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
entityThe type of HubSpot object to retrieve pipelines for (e.g., deals, tickets)

Here is a sample JSON input:

//Get Deal Pipelines

{
  "entity": "deals"
}

//Get Ticket Pipelines

{
  "entity": "tickets"
}

Response

The action returns a list of pipelines, each containing:

  • Pipeline ID
  • Pipeline label/name
  • Display order
  • Stages within the pipeline
  • Created and updated timestamps

Get Pipeline Stage by ID

Retrieves details of a specific pipeline stage by its ID. This action can be leveraged by Leena AI Orchestrator/Agent to get detailed information about a specific stage within a pipeline. Here are some common use cases:

  • Stage Details: Get specific stage configuration and metadata
  • Workflow Logic: Retrieve stage information for conditional workflows
  • Validation: Verify stage existence and properties

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
entityThe type of HubSpot object (e.g., deals, tickets)
pipelineIdThe unique identifier of the pipeline
stageIdThe unique identifier of the stage within the pipeline

Here is a sample JSON input:

//Get Deal Pipeline Stage

{
  "entity": "deals",
  "pipelineId": "default",
  "stageId": "appointmentscheduled"
}

//Get Ticket Pipeline Stage

{
  "entity": "tickets",
  "pipelineId": "support-pipeline",
  "stageId": "in-progress"
}

Response

The action returns the stage details including:

  • Stage ID
  • Stage label/name
  • Display order
  • Stage metadata
  • Pipeline association

Get properties

Retrieves all available properties for a specific HubSpot object type. This action can be leveraged by Leena AI Orchestrator/Agent to discover available fields and properties for an object type. Here are some common use cases:

  • Schema Discovery: Get all available properties for an object
  • Form Building: Retrieve property list for dynamic form generation
  • Integration Setup: Understand available fields for data mapping
  • Validation: Get property metadata for input validation

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
objectTypeThe type of HubSpot object to get properties for (e.g., contacts, deals, companies)

Optional

NameDescription
archivedWhether to include archived properties (true/false)

Here is a sample JSON input:

//Get Contact Properties

{
  "objectType": "contacts"
}

//Get Deal Properties

{
  "objectType": "deals"
}

//Get Company Properties Including Archived

{
  "objectType": "companies",
  "archived": true
}

//Get Ticket Properties

{
  "objectType": "tickets"
}

Response

The action returns a list of properties, each containing:

  • Property name (internal name)
  • Property label (display name)
  • Property type (string, number, date, enumeration, etc.)
  • Field type (text, textarea, select, checkbox, etc.)
  • Property description
  • Options (for enumeration properties)
  • Read-only status
  • Created and updated timestamps