Auto-Produce LinkedIn Content with n8n: OpenAI Ideas & Drafts, Gmail Reply Approval, Google Sheets Tracking
Input niche and audience config → OpenAI generates post ideas → approve by replying with a number in Gmail → receive drafts → reply again to publish to LinkedIn, all tracked in Sheets
- Who
- Content operators, founders, or brand managers who need consistent LinkedIn posting
- You get
- Complete a content cycle from idea to published post with two numeric email replies, with every stage logged to Google Sheets
- You need
- n8n · openai · gmail · google-sheets · linkedin
Constraints
Requires an n8n instance; configure OpenAI, Gmail, Google Sheets OAuth2, and LinkedIn Community Management credentials. Create a Google Sheet with the specified columns and map it in all Sheets nodes. Fill the Configuration node with niche, audience, notification email, idea/draft counts, word limits, OpenAI model, LinkedIn post-as mode (person or organization), and URN.
What they did
Author drfiras published this workflow in the n8n official template gallery (template ID 17592). The workflow uses a single Configuration node to centralize niche, audience, counts, model, and posting settings; uses n8n AI Agent nodes calling OpenAI Chat Model to generate structured ideas and drafts; routes human approvals via Gmail email exchanges; uses Google Sheets as a state-tracking database; and publishes via the LinkedIn node.
How it went
The author reports that this workflow turns a simple inbox into a LinkedIn content machine: click to trigger (or schedule) to generate 10 ideas, reply with a number to receive 3 full drafts, reply again with a number to auto-publish, with every stage tracked in the sheet. (author_report; not tested by this site)
Worth knowing
1. Default model is gpt-5-mini and can be changed in Configuration. 2. LinkedIn posting requires Community Management OAuth2 and a valid person URN or organization URN; verify the URN before publishing. 3. Approval replies must preserve the original [CID: …] token in the subject and contain only the number in the body, or parsing will fail. 4. This site has not executed the workflow; actual runs require verifying OAuth scopes, credential access, and Sheets column mapping. 5. workflow.json is complete and importable, but credential references and placeholders must be reviewed and replaced after import.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- OpenAI Chat Model (Ideas) node: connect OpenAI API credentials.
- Log Idea Batch to Tracking Sheet node: connect Google Sheets OAuth2 credentials.
- Email Ideas for Approval node: connect Gmail OAuth2 credentials.
- Gmail Trigger - Await Reply node: connect Gmail OAuth2 credentials.
- Get Row by Correlation ID node: connect Google Sheets OAuth2 credentials.
- OpenAI Chat Model (Drafts) node: connect OpenAI API credentials.
- Update Sheet with Drafts node: connect Google Sheets OAuth2 credentials.
- Email Drafts for Approval node: connect Gmail OAuth2 credentials.
- Update Sheet as Posted node: connect Google Sheets OAuth2 credentials.
- Email Publish Confirmation node: connect Gmail OAuth2 credentials.
Configuration to replace
- Source template is n8n public workflow #17592 (~32 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Configure credentials and runtime parameters
In n8n, add credentials for OpenAI, Gmail, Google Sheets, and LinkedIn (Community Management). Open the Configuration node and set niche (e.g., startup founders in SaaS), audience (e.g., growth-focused professionals), num_ideas (default 10), num_drafts (default 3), openai_model (default gpt-5-mini), notification_email, draft_min_words (120), draft_max_words (200), linkedin_post_as (person or organization), and linkedin_organization_urn if applicable. Create a Google Sheet with columns: correlationId, stage, niche, audience, ideas, selectedTopic, drafts, linkedinUrn, num_drafts, openai_model, draft_min_words, draft_max_words, linkedin_post_as, linkedin_organization_urn, notification_email, and select it on all 4 Google Sheets nodes.
Generate LinkedIn post ideas
Manually trigger Start Content Cycle. The Configuration output feeds the AI Agent node Generate LinkedIn Post Ideas, which calls the OpenAI Chat Model to produce a numbered list of ideas. The Ideas Output Parser structures the output as a JSON array of ideas with id and title.
Execution prompt · Source text。AI Agent node Generate LinkedIn Post Ideas User Prompt field (text parameter)
=Generate exactly {{ $json.num_ideas }} scroll-stopping LinkedIn post idea titles. Niche: {{ $json.niche }} Audience: {{ $json.audience }}Execution prompt · Source text。AI Agent node Generate LinkedIn Post Ideas System Message field (options.systemMessage)
You are an expert LinkedIn content strategist. Given a niche and an audience, produce concise, scroll-stopping post title ideas. Always return exactly the number of ideas requested, each under 12 words, numbered starting at 1.
Log ideas and email for approval
The Prepare Ideas Email & Log Data node assembles the execution ID, config parameters, and idea list into an email body. Log Idea Batch to Tracking Sheet appends the batch to Google Sheets (stage=ideas). Email Ideas for Approval sends to notification_email with a subject containing [CID: execution-id] and a numbered list of ideas, prompting a numeric reply.
Await Gmail reply and route by stage
Gmail Trigger - Await Reply polls every minute for unread emails with [CID: in the subject, excluding promotions. Extract Reply Number & Correlation ID parses the CID from the subject and the number from the body. Get Row by Correlation ID looks up the matching row in Sheets. Route by Approval Stage branches based on the stage field: ideas goes to draft generation, drafts goes to publish, and unrecognized replies are ignored.
Generate drafts and email for final approval
If stage=ideas, Prepare Draft Request maps the reply number to the selectedTopic and carries word-count and model parameters. Generate LinkedIn Post Drafts calls OpenAI to produce num_drafts drafts; the Drafts Output Parser structures them as a drafts array. Update Sheet with Drafts updates the row (stage=drafts). Email Drafts for Approval sends the draft list, prompting a numeric reply to publish.
Execution prompt · Source text。AI Agent node Generate LinkedIn Post Drafts User Prompt field (text parameter)
=Write {{ $json.num_drafts }} LinkedIn post drafts about the topic below, tailored to the audience. Length: {{ $json.draft_min_words }}-{{ $json.draft_max_words }} words each, plain text, no emojis unless natural. Topic: {{ $json.selectedTopic }} Audience: {{ $json.audience }} Niche: {{ $json.niche }} Tone: insightful, practical, professional, founder-friendlyExecution prompt · Source text。AI Agent node Generate LinkedIn Post Drafts System Message field (options.systemMessage)
You are a professional LinkedIn ghostwriter. Write authentic, non-salesy posts that spark discussion. Follow the requested word count closely and number each draft starting at 1.
Publish to LinkedIn and send confirmation
If stage=drafts, Select Final Draft to Publish matches the reply number to the finalPost. Publish Post to LinkedIn publishes with PUBLIC visibility, with postAs determined by configuration (person or organization). Update Sheet as Posted marks the row status. Email Publish Confirmation sends a confirmation with the first 200 characters of the published post.
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
This is an official n8n template. Before building, confirm you have: an OpenAI API key, a Gmail OAuth2 account, a Google Sheets OAuth2 account, and a LinkedIn Community Management OAuth2 credential (required to post as an organization or person). Create the Google Sheet and fill the Configuration node per Step 1, then import workflow.json or install directly from n8n template 17592.
To publish to multiple platforms, swap the LinkedIn node for a Blotato multi-network post node. To use a dedicated approvals inbox, change the Gmail Trigger search query.
Source
Generate and publish LinkedIn posts with OpenAI, Gmail, and Google Sheets · drfiras · n8n.io · 2026-07-28
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.