The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "writer-agent",
"name": "Writer Agent",
"description": "AI agent that writes engaging LinkedIn post content",
"nodes": [
{
"parameters": {
"functionCode": "return {\n systemPrompt: `You are an expert LinkedIn content writer. Your role is to create compelling, professional content that drives engagement.\n\nBased on the content plan, write a high-quality LinkedIn post that:\n1. Has a strong hook in the first 3 lines\n2. Provides value to the reader\n3. Includes storytelling elements\n4. Ends with a clear call-to-action\n5. Is optimized for LinkedIn's algorithm\n\nFormat your response as JSON with these fields:\n{\n \"postContent\": \"string (200-300 words)\",\n \"hashtags\": [\"array of 3-5 relevant hashtags\"],\n \"engagementTips\": [\"array of tips\"],\n \"wordCount\": \"number\"\n}\n\nMake it authentic, conversational, and professional.`\n};"
},
"id": "set-writer-prompt",
"name": "Set Writer Prompt",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
0,
0
]
},
{
"parameters": {
"model": "gpt-4",
"messages": "=[{\n 'role': 'system',\n 'content': $input.first().json.systemPrompt\n}, {\n 'role': 'user',\n 'content': `Content Plan: ${JSON.stringify($input.first().json)}\\n\\nPlease write an engaging LinkedIn post based on this plan.`\n}]",
"options": {
"temperature": 0.8,
"maxTokens": 1500
}
},
"id": "openai-writer",
"name": "OpenAI Writer",
"type": "n8n-nodes-base.openai",
"typeVersion": 1,
"position": [
250,
0
]
},
{
"parameters": {
"functionCode": "const response = $input.first().json.choices[0].message.content;\n\ntry {\n const content = JSON.parse(response);\n return {\n ...content,\n chatId: $input.first().json.chatId\n };\n} catch (e) {\n // Fallback parsing\n const lines = response.split('\\n');\n const hashtags = lines.filter(l => l.includes('#')).map(l => l.trim());\n const postContent = lines.filter(l => !l.includes('#')).join('\\n');\n \n return {\n postContent: postContent || response,\n hashtags: hashtags.length > 0 ? hashtags : ['#LinkedIn', '#ProfessionalDevelopment'],\n engagementTips: ['Ask questions', 'Use emojis', 'Tag relevant people'],\n wordCount: (postContent || response).split(' ').length,\n chatId: $input.first().json.chatId,\n rawResponse: response\n };\n}"
},
"id": "parse-writer-output",
"name": "Parse Writer Output",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
500,
0
]
}
],
"connections": {
"Set Writer Prompt": {
"main": [
[
{
"node": "OpenAI Writer",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Writer": {
"main": [
[
{
"node": "Parse Writer Output",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"staticData": null
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Writer Agent. Uses openai. Manual trigger; 3 nodes.
Source: https://github.com/ruvcaltd/n8n/blob/a4620cfa4f1aee541f2b2a96f276c689204f06cc/workflows/writer-agent.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Send one WhatsApp message → Get AI-optimized content across 7+ social platforms.
Video runthrough
This template is built for solo attorneys, small law firms, and legal billing coordinators who receive timesheet documents by email and need to produce LEDES-compliant e-billing files for client billi