# Automated marketing campaign email system with HubSpot: n8n workflow

> Started by a clock, and works across Gmail, Google Calendar, Google Sheets, HubSpot and one other. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/automated-marketing-campaign-email-system-with-hubspot (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Scheduling](https://millionrounds.com/workflows?category=Scheduling#library)

# Automated marketing campaign email system with HubSpot

Started by a clock, and works across Gmail, Google Calendar, Google Sheets, HubSpot and one other. It hands the judgement calls to OpenAI. 39 steps: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomated-marketing-campaign-email-system-with-hubspot)

**39 steps** Large: read it before trusting it with anything live

**0** Branches: places the flow splits

**0** Loops or waits

**5** Services it connects to

## The flow

Starts it 3 Model 7 Logic 9 Service 20

The steps in the order they run, from what starts it.

- 1 **Every hour** Schedule trigger *Starts it*
- 2 **OpenAI Model1** Lm Chat Open Ai *Model*
- 3 **OpenAI Model** Lm Chat Open Ai *Model*
- 4 **Daily** Schedule trigger *Starts it*
- 5 **Gmail Trigger** Gmail trigger *Starts it*
- 6 **Get customers** Google Sheets *Service*
- 7 **Get campaign** Google Sheets *Service*
- 8 **AI Agent1** Agent *Model*
- 9 **AI Agent** Agent *Model*
- 10 **Don't email on weekends** Filter *Logic*
- 11 **Get message histories** Data Table *Service*
- 12 **Filter** Filter *Logic*
- 13 **If campaign does not exist1** Data Table *Service*
- 14 **Convert to JSON object** Code *Logic*
- 15 **Convert to JSON object1** Code *Logic*
- 16 **Get new campaign** Data Table *Service*
- 17 **Update customer's reply** Data Table *Service*
- 18 **Customer information** Code *Logic*
- 19 **Insert new campaign** Data Table *Service*
- 20 **Create new Customer** Hubspot *Service*
- 21 **Send a message** Gmail *Service*
- 22 **Get customer** Hubspot *Service*
- 23 **ネガポジ判定** Open Ai *Model*
- 24 **Create calendar info** Open Ai *Model*
- 25 **Get Customer** Hubspot *Service*
- 26 **Update row in sheet1** Google Sheets *Service*
- 27 **Insert message history** Data Table *Service*
- 28 **Filter customer** Filter *Logic*
- 29 **Update reply's category** Data Table *Service*
- 30 **Convert to JSON Object** Code *Logic*
- 31 **reply to customer** Open Ai *Model*
- 32 **Get histories** Data Table *Service*
- 33 **Create an event** Google Calendar *Service*
- 34 **Convert to JSON object2** Code *Logic*
- 35 **Code in JavaScript** Code *Logic*
- 36 **Reply to a message** Gmail *Service*
- 37 **Insert new mesage** Data Table *Service*
- 38 **Update Campaign** Data Table *Service*
- 39 **Update row in sheet** Google Sheets *Service*

## How it's built

- **Starts on:** A clock
- **Steps:** 39
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Calendar, Google Sheets, HubSpot, n8n data table
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Calendar, Google Sheets and HubSpot accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 39 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 39 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomated-marketing-campaign-email-system-with-hubspot)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Google Calendar](https://millionrounds.com/workflows?service=Google+Calendar#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[HubSpot](https://millionrounds.com/workflows?service=HubSpot#library)[n8n data table](https://millionrounds.com/workflows?service=n8n+data+table#library)

## Workflows like it

Also scheduling, with the same services where possible, closest in size first.

- [**Integrate Google Workspace with OpenAI** 39 steps · Gmail, Google Calendar](https://millionrounds.com/workflow/integrate-google-workspace-with-openai)
- [**Manage HR offboarding and archival with Odoo** 39 steps · Gmail, Google Calendar](https://millionrounds.com/workflow/manage-hr-offboarding-and-archival-with-odoo)
- [**AI daily brief with OpenAI and Gmail** 38 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/ai-daily-brief-with-openai-and-gmail)
- [**Priya AI Virtual Assisstant Version 2 with Gemini and OpenAI** 40 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/priya-ai-virtual-assisstant-version-2-with-gemini-and-openai)
- [**AI-Powered WhatsApp Chatbot: Complete Booking Assistant** 37 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/ai-powered-whatsapp-chatbot-complete-booking-assistant)
- [**Automate agile refinement prep with Gmail and OpenAI** 42 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/automate-agile-refinement-prep-with-gmail-and-openai)
