AutomationFlowsAI & RAG › Chat with Your Hubspot Data

Chat with Your Hubspot Data

ByMiha @miha on n8n.io

This n8n template gives you a chat-style assistant that can search your HubSpot CRM on demand. Ask natural-language questions like “show me leads in Germany” or “what deals close next month,” and the agent translates your request into precise HubSpot searches—then answers in…

Chat trigger trigger★★☆☆☆ complexityAI-powered7 nodesChat TriggerAgentHubspot ToolMemory Buffer WindowOpenAI Chat
AI & RAG Trigger: Chat trigger Nodes: 7 Complexity: ★★☆☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #8971 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "3be8d3e0-a672-4c85-95fb-9e21a1efe1b0",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        16,
        -32
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "f81e185d-07b4-4cd5-8442-9bea79577e70",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        224,
        -32
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "308d44ba-3d87-4405-900e-f5c6fb41c919",
      "name": "Search contacts in HubSpot",
      "type": "n8n-nodes-base.hubspotTool",
      "position": [
        448,
        176
      ],
      "parameters": {
        "operation": "search",
        "authentication": "oAuth2",
        "filterGroupsUi": {
          "filterGroupsValues": [
            {
              "filtersUi": {
                "filterValues": [
                  {
                    "value": "={{ $fromAI('filterGroupsValues0_filterValues0_Value', ``, 'string') }}",
                    "operator": "={{ $fromAI('operator_0', `Choose a valid HubSpot CRM Search operator \u2014 EQ (equal; exact match), NEQ (not equal), GT (greater than; numbers/timestamps in ms), GTE (>=), LT (<), LTE (<=), IN (equals any; supply values: [\"A\",\"B\",...]), NOT_IN (not in list). Note: date/time filters use epoch ms (UTC)`, 'string') }}",
                    "propertyName": "={{ $fromAI('property_name', `Choose an appropirate hubspot contact property name - email,firstname,lastname,createdate,lifecyclestage,hs_lead_status,country,state,hs_email_last_open_date,hs_email_last_reply_date,hs_sequences_is_enrolled,hs_sequences_enrolled_count,jobtitle,hubspot_owner_id,hs_sa_first_engagement_date,hs_last_sales_activity_timestamp`, 'string') }}"
                  },
                  {
                    "value": "={{ $fromAI('filterGroupsValues1_filterValues1_Value', ``, 'string') }}",
                    "operator": "={{ $fromAI('operator_1', `Choose a valid HubSpot CRM Search operator \u2014 EQ (equal; exact match), NEQ (not equal), GT (greater than; numbers/timestamps in ms), GTE (>=), LT (<), LTE (<=), IN (equals any; supply values: [\"A\",\"B\",...]), NOT_IN (not in list). Note: date/time filters use epoch ms (UTC)`, 'string') }}",
                    "propertyName": "={{ $fromAI('property_name_1', `Optionally, choose another appropirate hubspot contact property name to filter by (useful for from - to date filtering in ms) - email,firstname,lastname,createdate,lifecyclestage,hs_lead_status,country,state,hs_email_last_open_date,hs_email_last_reply_date,hs_sequences_is_enrolled,hs_sequences_enrolled_count,jobtitle,hubspot_owner_id,hs_sa_first_engagement_date,hs_last_sales_activity_timestamp`, 'string') }}"
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "properties": "={{ [\"email\",\"firstname\",\"lastname\",\"createdate\",\"lifecyclestage\",\"hs_lead_status\",\"country\",\"state\",\"hs_email_last_open_date\",\"hs_email_last_reply_date\",\"hs_sequences_is_enrolled\",\"hs_sequences_enrolled_count\",\"jobtitle\",\"hubspot_owner_id\",\"hs_sa_first_engagement_date\",\"hs_last_sales_activity_timestamp\"] }}"
        }
      },
      "credentials": {
        "hubspotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f7fa3e15-296a-41d9-9e0c-4bf92d7cec1e",
      "name": "Search for deals in HubSpot",
      "type": "n8n-nodes-base.hubspotTool",
      "position": [
        624,
        176
      ],
      "parameters": {
        "resource": "deal",
        "operation": "search",
        "authentication": "oAuth2",
        "filterGroupsUi": {
          "filterGroupsValues": [
            {
              "filtersUi": {
                "filterValues": [
                  {
                    "value": "={{ $fromAI('filterGroupsValues0_filterValues0_Value', ``, 'string') }}",
                    "operator": "={{ $fromAI('operator_0', `Choose a valid HubSpot CRM Search operator \u2014 EQ (equal; exact match), NEQ (not equal), GT (greater than; numbers/timestamps in ms), GTE (>=), LT (<), LTE (<=), IN (equals any; supply values: [\"A\",\"B\",...]), NOT_IN (not in list). Note: date/time filters use epoch ms (UTC)`, 'string') }}",
                    "propertyName": "={{ $fromAI('property_name_0', `Choose an appropriate hubspot deal property name - dealname,amount,dealstage,pipeline,dealtype,closedate,createdate,hs_lastmodifieddate,hubspot_owner_id,deal_currency_code,hs_deal_stage_probability,hs_last_activity_date,hs_next_activity_date,hs_is_closed_won,num_associated_contacts,hs_object_id`, 'string') }}"
                  },
                  {
                    "value": "={{ $fromAI('filterGroupsValues1_filterValues1_Value', ``, 'string') }}",
                    "operator": "={{ $fromAI('operator_1', `Choose a valid HubSpot CRM Search operator \u2014 EQ (equal; exact match), NEQ (not equal), GT (greater than; numbers/timestamps in ms), GTE (>=), LT (<), LTE (<=), IN (equals any; supply values: [\"A\",\"B\",...]), NOT_IN (not in list). Note: date/time filters use epoch ms (UTC)`, 'string') }}",
                    "propertyName": "={{ $fromAI('property_name_1', `Optionally, choose another appropirate hubspot deal property name to filter by (useful for from - to date filtering in ms) - dealname,amount,dealstage,pipeline,dealtype,closedate,createdate,hs_lastmodifieddate,hubspot_owner_id,deal_currency_code,hs_deal_stage_probability,hs_last_activity_date,hs_next_activity_date,hs_is_closed_won,num_associated_contacts,hs_object_id`, 'string') }}"
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "properties": [
            "dealname",
            "amount",
            "dealstage",
            "pipeline",
            "dealtype",
            "closedate",
            "createdate",
            "hs_lastmodifieddate",
            "hubspot_owner_id",
            "num_associated_contacts",
            "hs_deal_stage_probability"
          ]
        }
      },
      "credentials": {
        "hubspotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7ce28fb1-809f-4d6b-be7d-2707dece9fed",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        272,
        176
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "5ffea926-84dc-48ad-a0d3-1b9c9967c7cd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -128
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 464,
        "content": "## Chat with HubSpot (Contacts + Deals)\n\n### How it works\n1. Start a chat (Chat Trigger).\n2. **AI Agent** (OpenAI) interprets your question.\n3. Runs live HubSpot **Contacts** and **Deals** searches via tool nodes (dynamic filters with `$fromAI`).\n4. Returns compact results; memory keeps follow-up context.\n\n### Setup\n* [ ] Connect **HubSpot** on both AI tool nodes\n* [ ] Add your **OpenAI** API key to the Chat Model\n* [ ] (Optional) Predefine common filters (stage, owner, date ranges)\n\n### Customize\n* **Guardrails:** allowlisted properties/operators, max results, safe defaults\n* **Output:** request a table (name, email, stage, owner) or export to CSV/Slack"
      },
      "typeVersion": 1
    },
    {
      "id": "1ab36139-3a8b-4cc3-9dd5-0af717b4b969",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        96,
        176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "gpt-5"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Search contacts in HubSpot": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search for deals in HubSpot": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n template gives you a chat-style assistant that can search your HubSpot CRM on demand. Ask natural-language questions like “show me leads in Germany” or “what deals close next month,” and the agent translates your request into precise HubSpot searches—then answers in…

Source: https://n8n.io/workflows/8971/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

[](https://youtu.be/GBKXYh2j74o)

Chat Trigger, Agent, OpenAI Chat +2
AI & RAG

AI Agent : Google calendar assistant using OpenAI. Uses chatTrigger, lmChatOpenAi, memoryBufferWindow, googleCalendarTool. Chat trigger; 13 nodes.

Chat Trigger, OpenAI Chat, Memory Buffer Window +2
AI & RAG

OpenSea AI-Powered Insights via Telegram. Uses chatTrigger, telegramTrigger, lmChatOpenAi, memoryBufferWindow. Chat trigger; 13 nodes.

Chat Trigger, Telegram Trigger, OpenAI Chat +4
AI & RAG

Build an MCP server with Airtable. Uses chatTrigger, agent, memoryBufferWindow, mcpClientTool. Chat trigger; 13 nodes.

Chat Trigger, Agent, Memory Buffer Window +4
AI & RAG

Build an MCP server with Airtable. Uses chatTrigger, agent, memoryBufferWindow, mcpClientTool. Chat trigger; 13 nodes.

Chat Trigger, Agent, Memory Buffer Window +4