All Templates
Marketing • Beginner

Automated Email Marketing Sequence

Automatically send personalized follow-up emails to new leads captured from your website forms.

0

Interactive Workflow

Powered by n8n.io

How it works

Overview

This workflow turns every new form submission into a personalized email sequence.

The flow

  1. Trigger — Webhook fires whenever a new lead submits a form on your site.
  2. Enrich — The lead is created (or updated) as a contact in HubSpot.
  3. Personalize — OpenAI drafts a tailored email based on the lead's company and message.
  4. Send — Gmail delivers the follow-up email.
  5. Track — HubSpot status is updated to Contacted.

At a glance: zero manual work, 100% personalization, all leads followed up within seconds.

How to use

Setup

  1. Create a HubSpot account and generate a private app token.
  2. Add your Gmail account to n8n (OAuth2).
  3. Add your OpenAI API key to n8n credentials.
  4. Import this workflow, connect credentials, and activate.

Triggering

Use the provided webhook URL as the form action target on your website. Any POST with name, email, and message fields will start the sequence.

Ready to use?

Import into n8n

Copy the workflow JSON below and paste it directly onto your n8n canvas.

Ctrl + V to paste in n8n
View raw JSON
{
  "name": "Email Marketing Automation",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "new-lead",
        "responseMode": "onReceived",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "operation": "upsert",
        "resource": "contact",
        "properties": [
          {
            "property": "email",
            "value": "={{ $json.body.email }}"
          },
          {
            "property": "firstname",
            "value": "={{ $json.body.name }}"
          }
        ]
      },
      "name": "HubSpot Create Contact",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "prompt": "Write a friendly follow-up email for a new lead named {{ $json.body.name }} from {{ $json.body.company }}. Mention their message: {{ $json.body.message }}. Keep it under 120 words.",
        "options": {
          "temperature": 0.7
        }
      },
      "name": "OpenAI Draft Email",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "send",
        "fromEmail": "[email protected]",
        "toEmail": "={{ $json.body.email }}",
        "subject": "Thanks for reaching out!",
        "emailType": "text",
        "message": "={{ $json.output }}"
      },
      "name": "Gmail Send",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "HubSpot Create Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot Create Contact": {
      "main": [
        [
          {
            "node": "OpenAI Draft Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Draft Email": {
      "main": [
        [
          {
            "node": "Gmail Send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}