# Generate and publish LinkedIn posts with OpenAI and Gmail: n8n workflow

> Started by an arriving email, and works across Gmail, Google Sheets and LinkedIn. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/generate-and-publish-linkedin-posts-with-openai-and-gmail (Millionrounds; every figure on the page links to its filing or article)

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

# Generate and publish LinkedIn posts with OpenAI and Gmail

Started by an arriving email, and works across Gmail, Google Sheets and LinkedIn. It hands the judgement calls to OpenAI. 24 steps, 1 branch: 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%2Fgenerate-and-publish-linkedin-posts-with-openai-and-gmail)

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

**1** Branch: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 2 Model 6 Logic 8 Service 8

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

- 1 **Start Content Cycle** Manual trigger *Starts it*
- 2 **OpenAI Chat Model (Ideas)** Lm Chat Open Ai *Model*
- 3 **Gmail Trigger - Await Reply** Gmail trigger *Starts it*
- 4 **OpenAI Chat Model (Drafts)** Lm Chat Open Ai *Model*
- 5 **Configuration** Set *Logic*
- 6 **Generate LinkedIn Post Ideas** Agent *Model*
- 7 **Ideas Output Parser** Output Parser Structured *Model*
- 8 **Extract Reply Number & Correlation ID** Set *Logic*
- 9 **Generate LinkedIn Post Drafts** Agent *Model*
- 10 **Drafts Output Parser** Output Parser Structured *Model*
- 11 **Prepare Ideas Email & Log Data** Set *Logic*
- 12 **Get Row by Correlation ID** Google Sheets *Service*
- 13 **Prepare Drafts Email & Log Data** Set *Logic*
- 14 **Log Idea Batch to Tracking Sheet** Google Sheets *Service*
- 15 **Route by Approval Stage** Switch *Logic*
- 16 **Update Sheet with Drafts** Google Sheets *Service*
- 17 **Email Ideas for Approval** Gmail *Service*
- 18 **Prepare Draft Request** Set *Logic*
- 19 **Select Final Draft to Publish** Set *Logic*
- 20 **Ignore Unrecognized Reply** No Op *Logic*
- 21 **Email Drafts for Approval** Gmail *Service*
- 22 **Publish Post to LinkedIn** Linked In *Service*
- 23 **Update Sheet as Posted** Google Sheets *Service*
- 24 **Email Publish Confirmation** Gmail *Service*

## How it's built

- **Starts on:** An arriving email
- **Steps:** 24, with 1 branch
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Sheets, LinkedIn
- **Model:** OpenAI

## Questions

What does it need to run?

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

What starts it?

It starts on an arriving email.

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 24 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 24 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%2Fgenerate-and-publish-linkedin-posts-with-openai-and-gmail)
- **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 Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[LinkedIn](https://millionrounds.com/workflows?service=LinkedIn#library)

## Workflows like it

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

- [**AI content creation and auto WordPress publishing** 24 steps · calls a model · Google Sheets, WordPress](https://millionrounds.com/workflow/ai-content-creation-and-auto-wordpress-publishing)
- [**Analyze websites for UX & SEO quality with Airtop and OpenAI** 24 steps · calls a model · Gmail](https://millionrounds.com/workflow/analyze-websites-for-ux-and-seo-quality-with-airtop-and-open)
- [**Auto-generate Instagram carousels with OpenAI** 24 steps · calls a model · Google Sheets](https://millionrounds.com/workflow/auto-generate-instagram-carousels-with-openai)
- [**Automate blog-to-social media with OpenAI and Reddit** 24 steps · calls a model · LinkedIn, Postgres](https://millionrounds.com/workflow/automate-blog-to-social-media-with-openai-and-reddit)
- [**Automated LinkedIn post generator with Gemini** 24 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/automated-linkedin-post-generator-with-gemini)
- [**Automated Thai content creation & publishing with Ollama** 24 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/automated-thai-content-creation-and-publishing-with-ollama)
