Skip to content
AI Automations

n8n LinkedIn post generator: the workflow, the prompts and the JSON

An n8n workflow that turns one form submission into a LinkedIn post, a matching image and a draft in your inbox. Three AI agents, an OpenAI image call, and a LinkedIn node we keep switched off on purpose.

The n8n canvas for the LinkedIn post generator, showing five labelled groups: the form trigger, three chained AI agents, the OpenAI image request with a Convert to File node, a disabled LinkedIn node and a Gmail confirmation.

An n8n LinkedIn post generator is a workflow that takes a topic from a form, writes the post, generates an image to go with it, and puts both in front of a human before anything reaches LinkedIn. Ours runs on three AI agents instead of one long prompt, and it emails the draft out for review rather than publishing on its own.

This is the whole build, node by node, including the step that breaks most often and the four things we corrected before publishing the file.

What the n8n LinkedIn post generator does end to end

The canvas is split into five groups, and each one has a single job.

Content ideas holds the trigger. It's an n8n form with three required fields: the post topic, the audience it is written for, and the email address the finished draft should land in. That third field matters more than it looks, because it means anyone on the team can run the workflow and get the result back themselves.

Create content holds three AI agents in a row. The first writes the post body and is the only one with a web search tool. The second turns that post into an image prompt. The third reads the post and writes the title. The writer and the title agent run on GPT-4o, and the image prompt agent runs on GPT-4o mini, because describing a picture is a smaller job than writing the argument.

Generate image sends the image prompt to the OpenAI images endpoint through an HTTP Request node, then converts the response into a real file.

Publish holds the LinkedIn node, set to create a post with the image attached. Ours is switched off, and we'll get to why.

Send a confirmation emails the title, the post and the image to whoever filled in the form.

That's it. No queue, no scheduler, no database of ideas waiting their turn. It runs when somebody has something to say.

Download the n8n workflow JSON

The file is this workflow, exported and cleaned: 17 nodes, the sticky notes that label each group, and the full system prompts for all three agents.

Download the n8n LinkedIn post generator workflow (JSON)

To use it, open n8n, go to Workflows, choose Import from File and pick the JSON. Then connect the credentials: an OpenAI account for the three chat models, a header auth credential for the search tool, a Gmail account for the confirmation, and LinkedIn if you decide to switch publishing on.

Every credential reference has been stripped, so nothing of ours travels with the file. Three placeholders need your attention before the first run. The image request carries an Authorization header that reads YOUR_OPENAI_API_KEY. The LinkedIn node needs your own person ID selected from its dropdown. The search tool needs a Tavily key attached as header auth.

One thing worth saying out loud, since we nearly published the mistake ourselves. An n8n export embeds anything you typed directly into a node, including an API key pasted into a header field. Open any workflow JSON in a text editor and read it before you send it to anyone.

What we changed before publishing the file

Four corrections, all small, all worth knowing if you built something similar.

The image request was reading the output of the node immediately before it, which is the title agent, so it was drawing a picture of the title rather than the prompt the image agent had just written. It now references the image prompt node by name.

The Convert to File node was reading a property called data. The images endpoint answers with an object that holds an array, so the value it wants is data[0].b64_json.

The LinkedIn node was looking for a binary property called binary, while Convert to File writes to one called data. Names have to match or the upload fails the moment you enable the node.

The confirmation email stopped at the word "Title:" with nothing after it. It now carries the title, the post body and the image as an attachment.

Why the trigger is a form and not a schedule

Most content automations start with a cron job. Every Tuesday at 9am, write a post. The output reads exactly like what it is, which is a machine that was told to have an opinion on a schedule.

Our form asks for the topic and the audience first. The thinking stays with the person, and the workflow handles the part nobody enjoys, which is turning a half formed thought into something readable with a picture attached.

If you want it on a timer anyway, swap the form trigger for a schedule trigger and feed it from a list of topics a human wrote earlier. Keep the ideas human. That's the part worth protecting.

Why three AI agents beat one prompt

You can ask a single agent for a post, an image prompt and a title in one go. You'll get a decent post and two afterthoughts, because everything after the first instruction gets less attention than the first one.

Splitting the job into three gives each output its own prompt and its own space to fail.

The writer agent researches and drafts. The image prompt agent reads the finished post and describes a visual for it, which works far better than guessing at an image before the copy exists. The title agent reads the post and writes the hook last, because a hook written first tends to promise something the post never delivers.

The Memory ports on all three agents are empty, and that's deliberate. Memory is useful for a chat assistant that needs to remember what you said four messages ago. In a content workflow it just lets last week's post bleed into this week's. Every run starts clean.

The prompts are where the quality lives, and all three ship with the download. The writer is told to research before drafting, open with a hook, keep paragraphs short, attribute anything it quotes, use emojis only where they genuinely help, and close on a call to action. The image agent is told to produce a marketing graphic rather than a photograph, which is why the prompts come back describing flat illustration, abstract shapes and space left for a headline. The title agent has the shortest brief of the three and still changes the post more than either of the others.

The web search tool, and when it earns its place

The writer agent has a Tavily search tool wired into its Tool port, set to advanced depth and limited to the last seven days. It only gets used when a post needs something current, like a recent product change or a number that moves.

Two things to tune there. The max results value ships at one, which is tight, and raising it to three or four gives the agent enough to compare sources instead of trusting the first one. The seven day window is right for commentary and wrong for anything evergreen.

One warning from building this. A search tool will happily find a statistic, wrap it in a confident sentence and hand it over with no source. If you publish that without checking it, you own it. We read every claim these agents make before a post goes anywhere, and we delete more of them than we keep.

Generating the image, and the base64 step that breaks

The image step uses an HTTP Request node pointed at the OpenAI API rather than a prebuilt node. That gives you direct control over the model, the size and the quality, and it means you aren't waiting for someone to ship a node update when the API changes.

The catch is what comes back. The response is base64 text, not a file. Nothing downstream can attach it, upload it or email it in that state. A Convert to File node sits right after the request and moves that string into a binary field, and only then does the image behave like an image.

This is the step that fails most often, and it's almost always the same cause: the property path no longer matches the shape of the response. Ours reads data[0].b64_json. When the workflow breaks, check there first.

Publishing to LinkedIn, and why our node is switched off

The LinkedIn node is configured to create a post with the image attached and the title in the additional fields. It's also disabled, and that wasn't an accident.

Two reasons. The practical one is that posting to LinkedIn through the API needs an app with the right scopes approved on their side, which is a separate job from building the workflow. The honest one is that we want to read the post before it goes out. A generator that publishes on its own is one confused prompt away from something you have to apologize for in public.

So the Gmail node does the last mile. It sends the title, the post body and the image to whoever submitted the form. If it reads well, a person posts it. If it doesn't, it gets deleted and nobody knows the run happened.

The node stays in the workflow, wired and ready, because switching it on later is a single click.

What we would add next

An approval step is the obvious upgrade. n8n can pause a run, email the draft with approve and reject buttons, and only continue to the LinkedIn node if someone approves. That keeps the human check without the copy and paste.

A character guard would help too. LinkedIn cuts posts off at 3,000 characters, and the see-more fold arrives long before that, so a small node that counts characters and sends anything too long back for a trim is cheap insurance.

Storing every draft in a sheet or a table is third on the list. Not for analytics, just so the posts that got rejected are somewhere findable when the idea comes back around.

Should you automate LinkedIn posting at all?

Partly. The workflow is good at the blank page problem, which is where most people stall. It is not good at deciding what is worth saying, and it never will be.

Run it five times a day and publish everything it produces, and you are teaching your network to scroll past your name. Once or twice a week with a real idea behind each post is a different outcome. The automation removes the friction. It should not raise the volume.

Common questions

Can n8n post to LinkedIn automatically?

Yes. The LinkedIn node creates posts directly once you connect an account with the right scopes, and the workflow can run unattended. Whether you should is a separate question, and our answer for now is no.

Is the n8n workflow template free to download?

Yes. The JSON is free, there is no form in front of it, and every credential reference has been removed. Import it, point it at your own keys and change whatever you disagree with.

Which OpenAI models does the workflow use?

GPT-4o writes the post and the title, GPT-4o mini writes the image prompt, and gpt-image-1 generates the picture at 1024 by 1024. All three are swappable in the node parameters without touching the rest of the workflow.

Will the posts sound like us, or like every other AI post?

Only if you show the agent what you sound like. Paste three or four of your own posts into the system prompt of the writer agent and tell it to match the rhythm and the vocabulary. Describing your tone in adjectives does almost nothing. Examples do the work.

What happens if a node fails halfway through a run?

The run stops and n8n keeps the execution, so you can open it, see which node failed and what data it was holding, then retry from that point instead of starting again. In this workflow the image conversion is the usual culprit.

1Downloads

Take it with you.

Ready to build something that pays for itself?

Tell us what you need and get a written scope, timeline and fixed quote within 48 hours of a free 30-minute call, whether you work with us or not.

Replies within 24 hours · NDA on request · No commitment