Skip to main content

Automated marketing campaign email system with GPT-4 and HubSpot customer tracking

Workflow preview

Workflow preview
100%
Automated marketing campaign email system with GPT-4 and HubSpot customer tracking preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow automates customer outreach for marketing campaigns, including customer prioritization, AI generated emails, automated sending, reply tracking, and meeting scheduling. How It Works 1....

Best for

  • Social Media automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.filter, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.datatable, n8n-nodes-base.code, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.lmchatopenai, n8n-nodes-base.gmail

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Satoshi.

Original n8n.io source

1.1 Workflow description

Title
Automated marketing campaign email system with GPT-4 and HubSpot customer tracking
Workflow name
Automated marketing campaign email system with GPT-4 and HubSpot customer tracking

Overview

  • This workflow automates customer outreach for marketing campaigns, including customer prioritization, AI-generated emails, automated sending, reply tracking, and meeting scheduling.

How It Works

  1. Data Synchronization

    • Customer and campaign data are periodically synchronized from Google Sheets and internal data tables.
    • New customers and campaigns are inserted into the system if they do not already exist.
  2. Customer Evaluation and Prioritization

    • Customers are evaluated based on revenue, industry, capital, and location.
    • Each customer is classified into High / Medium / Low priority using AI.
    • Only high-priority customers are selected for campaign outreach.
  3. Campaign Detection

    • The workflow checks for new, unsent marketing campaigns.
    • Campaigns marked as already sent are excluded.
  4. Personalized Email Generation

    • For each eligible customer, past email history is retrieved.

    • An AI agent generates a personalized campaign email:

      • Uses historical interaction data when available.
      • Uses customer interests and keywords for new customers.
      • Produces a professional, friendly email proposing a meeting.
  5. Automated Email Sending

    • Emails are sent automatically via Gmail.
    • Sent emails are logged into the message history database.
    • Campaign status is updated to “sent” after completion.
  6. Reply Handling

    • Incoming customer replies are detected via Gmail triggers.
    • Replies are matched with previous messages and stored in the database.
    • AI generates an appropriate follow-up reply when required.
  7. Reply Classification and Scheduling

    • Customer replies are classified as Positive / Pending / Negative.
    • If a reply includes scheduling information, meeting details are extracted.
    • Calendar events are automatically created in Google Calendar.

Setup Steps

  1. Prepare Data Sources

    • Set up Google Sheets for:

      • Customer master data Format includes the following columns: #/メール/ 氏名/ 会社名/ 所在地/ 売上(万円)/ 資本金(万円)/ 業界/関心/ Hubspot同期
      • Campaign data Format includes the following columns: No / campaign_name / description / sent
    • Prepare internal data tables for:

      • Campaign records
      • Email message histories
  2. Create Data table

    • Campaign table:

      • campaign_name: String
      • description: String
      • is_sent: boolean
    • Mail Histories table:

      • customer_email: String
      • email_subject: String
      • message: String
      • reply: String
      • reply_category: String
  3. Configure Credentials

    • Google Sheets API
    • Gmail OAuth
    • Google Calendar API
    • HubSpot App Token (for customer synchronization)
    • OpenAI API (for AI agents)

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Every hour

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.1

Block 2 - Don't email on weekends

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2

Block 3 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 4 - Get histories

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 5 - Code in JavaScript

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - AI Agent1

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Customer information

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Convert to JSON object

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - OpenAI Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 12 - OpenAI Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 13 - Daily

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 14 - Update Campaign

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 15 - Send a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 16 - Convert to JSON object1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Filter customer

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2

Block 18 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Get new campaign

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 24 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.3

Showing the first 24 of 53 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Automated marketing campaign email system with GPT-4 and HubSpot customer tracking
Complexity advanced
Nodes 53
Categories Social Media, AI Chatbot
Author Satoshi
Published 16 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11865/11865.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated marketing campaign email system with GPT-4 and HubSpot customer tracking do?

This workflow automates customer outreach for marketing campaigns, including customer prioritization, AI generated emails, automated sending, reply tracking, and meeting scheduling. How It Works 1....

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Social Media, AI Chatbot use case.