AutomationFlowsAI & RAG › Hubspot Workflow

Hubspot Workflow

Hubspot Workflow. Uses hubspotTrigger, hubspot, httpRequest, openai. Event-driven trigger; 22 nodes.

Event trigger★★★★☆ complexityAI-powered22 nodesHubSpot TriggerHubSpotHTTP RequestOpenAIGmail
AI & RAG Trigger: Event Nodes: 22 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Gmail → HTTP Request 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
{
  "nodes": [
    {
      "parameters": {
        "triggerEvents": [
          "contact.creation"
        ]
      },
      "name": "HubSpot Trigger",
      "type": "n8n-nodes-base.hubspotTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "credentials": {
        "hubspotApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "resource": "contact",
        "operation": "get",
        "contactId": "={{$json[\"objectId\"]}}"
      },
      "name": "Get Contact",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {
        "hubspotApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "url": "https://api.hubapi.com/owners/v2/owners/{{ $node[\"Get Contact\"].json[\"properties\"][\"owner_id\"] }}?hapikey={{your_hubspot_api_key}}",
        "method": "GET",
        "options": {},
        "headers": []
      },
      "name": "Get Contact Owner",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "followUpCount",
              "value": "0"
            }
          ]
        },
        "options": {}
      },
      "name": "Initialize Counter",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        650,
        450
      ]
    },
    {
      "parameters": {
        "model": "gpt-3.5-turbo",
        "temperature": 0.7,
        "messages": [
          {
            "role": "system",
            "content": "You are an expert marketer writing partnership outreach emails for incenti.me."
          },
          {
            "role": "user",
            "content": "Generate an initial outreach email exploring a partnership with incenti.me. Use the contact\u2019s first and last name in the greeting ({{$node[\"Get Contact\"].json[\"properties\"][\"firstname\"]}} {{$node[\"Get Contact\"].json[\"properties\"][\"lastname\"]}}), include a subject, an email stamp at the top, and append the signature:\n--\nBest regards,\nYour Name\nincenti.me\n\nOutput JSON with keys: subject, body."
          }
        ]
      },
      "name": "Generate Initial Email",
      "type": "n8n-nodes-base.openai",
      "typeVersion": 2,
      "position": [
        850,
        300
      ],
      "credentials": {
        "openAIApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "functionCode": "const email = JSON.parse(items[0].json.choices[0].message.content);\nreturn [{ json: email }];"
      },
      "name": "Parse Initial Email",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ]
    },
    {
      "parameters": {
        "fromEmail": "={{$node[\"Get Contact Owner\"].json[\"email\"]}}",
        "toEmail": "={{$node[\"Get Contact\"].json[\"properties\"][\"email\"]}}",
        "subject": "={{$json[\"subject\"]}}",
        "text": "={{$json[\"body\"]}}"
      },
      "name": "Send Initial Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ],
      "credentials": {
        "gmailOAuth2Api": "<your credential>"
      }
    },
    {
      "parameters": {
        "mode": "delay",
        "delay": 3,
        "unit": "days"
      },
      "name": "Wait 3 Days",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        1450,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "followUpCount",
              "value": "1"
            }
          ]
        },
        "options": {
          "keepOnlySet": false
        }
      },
      "name": "Set FollowUp 1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1650,
        200
      ]
    },
    {
      "parameters": {
        "model": "gpt-3.5-turbo",
        "temperature": 0.7,
        "messages": [
          {
            "role": "system",
            "content": "You are an expert marketer writing follow-up emails for incenti.me."
          },
          {
            "role": "user",
            "content": "Follow-up #{{$json[\"followUpCount\"]}}: Write a polite follow-up email referencing the previous outreach. Explore a partnership with incenti.me, address {{$node[\"Get Contact\"].json[\"properties\"][\"firstname\"]}} by name, and output JSON with subject and body."
          }
        ]
      },
      "name": "Generate FollowUp Email 1",
      "type": "n8n-nodes-base.openai",
      "typeVersion": 2,
      "position": [
        1850,
        200
      ],
      "credentials": {
        "openAIApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "functionCode": "const email = JSON.parse(items[0].json.choices[0].message.content);\nreturn [{ json: email }];"
      },
      "name": "Parse FollowUp Email 1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        2050,
        200
      ]
    },
    {
      "parameters": {
        "fromEmail": "={{$node[\"Get Contact Owner\"].json[\"email\"]}}",
        "toEmail": "={{$node[\"Get Contact\"].json[\"properties\"][\"email\"]}}",
        "subject": "={{$json[\"subject\"]}}",
        "text": "={{$json[\"body\"]}}"
      },
      "name": "Send FollowUp 1",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [
        2250,
        200
      ],
      "credentials": {
        "gmailOAuth2Api": "<your credential>"
      }
    },
    {
      "parameters": {
        "mode": "delay",
        "delay": 3,
        "unit": "days"
      },
      "name": "Wait 3 Days 2",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        2450,
        200
      ]
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "followUpCount",
              "value": "2"
            }
          ]
        },
        "options": {
          "keepOnlySet": false
        }
      },
      "name": "Set FollowUp 2",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        2650,
        200
      ]
    },
    {
      "parameters": {
        "model": "gpt-3.5-turbo",
        "temperature": 0.7,
        "messages": [
          {
            "role": "system",
            "content": "You are an expert marketer writing follow-up emails for incenti.me."
          },
          {
            "role": "user",
            "content": "Follow-up #{{$json[\"followUpCount\"]}}: Write a polite follow-up email referencing our previous messages. Address {{$node[\"Get Contact\"].json[\"properties\"][\"firstname\"]}} by name, and output JSON with subject and body."
          }
        ]
      },
      "name": "Generate FollowUp Email 2",
      "type": "n8n-nodes-base.openai",
      "typeVersion": 2,
      "position": [
        2850,
        200
      ],
      "credentials": {
        "openAIApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "functionCode": "const email = JSON.parse(items[0].json.choices[0].message.content);\nreturn [{ json: email }];"
      },
      "name": "Parse FollowUp Email 2",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        3050,
        200
      ]
    },
    {
      "parameters": {
        "fromEmail": "={{$node[\"Get Contact Owner\"].json[\"email\"]}}",
        "toEmail": "={{$node[\"Get Contact\"].json[\"properties\"][\"email\"]}}",
        "subject": "={{$json[\"subject\"]}}",
        "text": "={{$json[\"body\"]}}"
      },
      "name": "Send FollowUp 2",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [
        3250,
        200
      ],
      "credentials": {
        "gmailOAuth2Api": "<your credential>"
      }
    },
    {
      "parameters": {
        "mode": "delay",
        "delay": 3,
        "unit": "days"
      },
      "name": "Wait 3 Days 3",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        3450,
        200
      ]
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "followUpCount",
              "value": "3"
            }
          ]
        },
        "options": {
          "keepOnlySet": false
        }
      },
      "name": "Set FollowUp 3",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        3650,
        200
      ]
    },
    {
      "parameters": {
        "model": "gpt-3.5-turbo",
        "temperature": 0.7,
        "messages": [
          {
            "role": "system",
            "content": "You are an expert marketer writing follow-up emails for incenti.me."
          },
          {
            "role": "user",
            "content": "Follow-up #{{$json[\"followUpCount\"]}}: Write a final polite follow-up email referencing our prior correspondence. Address {{$node[\"Get Contact\"].json[\"properties\"][\"firstname\"]}} by name, and output JSON with subject and body."
          }
        ]
      },
      "name": "Generate FollowUp Email 3",
      "type": "n8n-nodes-base.openai",
      "typeVersion": 2,
      "position": [
        3850,
        200
      ],
      "credentials": {
        "openAIApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "functionCode": "const email = JSON.parse(items[0].json.choices[0].message.content);\nreturn [{ json: email }];"
      },
      "name": "Parse FollowUp Email 3",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        4050,
        200
      ]
    },
    {
      "parameters": {
        "fromEmail": "={{$node[\"Get Contact Owner\"].json[\"email\"]}}",
        "toEmail": "={{$node[\"Get Contact\"].json[\"properties\"][\"email\"]}}",
        "subject": "={{$json[\"subject\"]}}",
        "text": "={{$json[\"body\"]}}"
      },
      "name": "Send FollowUp 3",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [
        4250,
        200
      ],
      "credentials": {
        "gmailOAuth2Api": "<your credential>"
      }
    }
  ],
  "connections": {
    "HubSpot Trigger": {
      "main": [
        [
          {
            "node": "Get Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Contact": {
      "main": [
        [
          {
            "node": "Get Contact Owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Contact Owner": {
      "main": [
        [
          {
            "node": "Initialize Counter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Counter": {
      "main": [
        [
          {
            "node": "Generate Initial Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Initial Email": {
      "main": [
        [
          {
            "node": "Parse Initial Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Initial Email": {
      "main": [
        [
          {
            "node": "Send Initial Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Initial Email": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 Days": {
      "main": [
        [
          {
            "node": "Set FollowUp 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set FollowUp 1": {
      "main": [
        [
          {
            "node": "Generate FollowUp Email 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate FollowUp Email 1": {
      "main": [
        [
          {
            "node": "Parse FollowUp Email 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse FollowUp Email 1": {
      "main": [
        [
          {
            "node": "Send FollowUp 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send FollowUp 1": {
      "main": [
        [
          {
            "node": "Wait 3 Days 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 Days 2": {
      "main": [
        [
          {
            "node": "Set FollowUp 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set FollowUp 2": {
      "main": [
        [
          {
            "node": "Generate FollowUp Email 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate FollowUp Email 2": {
      "main": [
        [
          {
            "node": "Parse FollowUp Email 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse FollowUp Email 2": {
      "main": [
        [
          {
            "node": "Send FollowUp 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send FollowUp 2": {
      "main": [
        [
          {
            "node": "Wait 3 Days 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 Days 3": {
      "main": [
        [
          {
            "node": "Set FollowUp 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set FollowUp 3": {
      "main": [
        [
          {
            "node": "Generate FollowUp Email 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate FollowUp Email 3": {
      "main": [
        [
          {
            "node": "Parse FollowUp Email 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse FollowUp Email 3": {
      "main": [
        [
          {
            "node": "Send FollowUp 3",
            "type": "main",
            "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

Hubspot Workflow. Uses hubspotTrigger, hubspot, httpRequest, openai. Event-driven trigger; 22 nodes.

Source: https://gist.github.com/yousifmn/88759ecb1a4017099d1c57e3a1d8ece4 — 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

This intelligent email automation workflow helps you maximize engagement through domain-based outreach. It utilizes AI-powered personalization and strategic follow-ups to increase response rates. The

Gmail, HTTP Request, Google Sheets +1
AI & RAG

This workflow showcases various useful Gmail search, filter, and AI categorization operations and generates a knowledge graph for your mail using the InfraNodus GraphRAG API, which you can use to reve

HTTP Request, Google Gemini Chat, Gmail +3
AI & RAG

Send a target niche and location via Telegram message Workflow discovers businesses via Google Maps API AI enriches contacts with email and LinkedIn data via Serper GPT-4o scores and qualifies each le

Telegram Trigger, OpenAI, Google Sheets +3
AI & RAG

What it is An automated LinkedIn content system that takes a simple form (idea + optional file), generates LinkedIn posts with OpenAI, stores them in Notion, builds Google Slides carousels, and auto-p

Form Trigger, OpenAI, Notion +6
AI & RAG

This workflow is designed for SEO professionals, digital agencies, content creators, and WordPress site owners who want to improve their search engine rankings automatically. It’s also perfect for cur

OpenAI, Google Sheets, XML +3