Build an advanced n8n workflow for AI blog writing and editing. This powerful n8n automation uses LangChain Agents, Google Sheets for memory, and the OpenAI n8n node to generate context-aware content.
Download this n8n workflow template and start using it instantly.
This comprehensive n8n workflow creates a powerful, persistent AI agent capable of writing or editing blog content while tracking its historical actions. Unlike simple prompts, this n8n automation uses Google Sheets as external memory. The core value lies in its ability to count the number of edits or writings performed for a specific user session ID, allowing you to implement flow control (e.g., limiting the number of revisions). This is a highly technical example of an n8n template utilizing advanced n8n node features like LangChain Tools (sub-workflows) and structured output parsing. Using this n8n workflow ensures context persistence and scalable data logging for all your AI interactions.
The process begins with the Ask about blog topic n8n trigger, which initiates the chat interaction.
Choose to Write or Edit Blog n8n node determines if the input is a new topic (Write) or existing text (Reword/Edit) based on the input data structure. It dynamically constructs the systemprompt and userprompt, explicitly instructing the Agent to use a dedicated tool to fetch the current session count.Blog Writer & Editor Agent n8n node takes the prompts and orchestrates the AI process. It uses the OpenAI Chat Model2 (GPT-4/5) for generation and the Simple Memory n8n node for short-term context.google n8n tool, passing only the session ID. This sub-workflow executes a memory lookup:When Executed by Another Workflow n8n trigger receives the session ID.Get History Google Sheets n8n node to retrieve all sheet rows.Filter n8n node isolates only the rows matching the current session ID.Summarize1 n8n node counts these rows, returning the session history count to the Agent.Structured Output Parser n8n node to guarantee the response is valid JSON, including the final blog body and the session history count.n8n History Google Sheets n8n node appends the structured results (session, Rows, output) to the memory sheet.Check if Ran 4+ times If n8n node evaluates the returned row count. If the count exceeds 3, the flow branches (e.g., to stop or notify). This demonstrates powerful control within the n8n workflow based on historical context.To deploy this powerful n8n template, follow these steps:
OpenAI Chat Model2 n8n node. Ensure your API key is configured with billing enabled, as this uses advanced models.session, Rows, and output. A sample sheet is often provided in the sticky notes.n8n History Google Sheets n8n node and the embedded Get History n8n node within the google tool. Select your specific spreadsheet ID and sheet name for both connections.Ask about blog topic LangChain Chat n8n trigger is active to start the automation. Ask about blog topic (LangChain Chat Trigger): Acts as the entry point or n8n trigger for the automation. It captures user input and session ID to maintain conversational context.
Choose to Write or Edit Blog (Code n8n node): This crucial n8n node acts as a prompt engineer. It dynamically generates tailored systemprompt and userprompt based on whether the task is a new write or an edit. It explicitly instructs the AI to use the attached google tool.
Blog Writer & Editor (LangChain Agent n8n node): The core intelligence of the n8n workflow. It utilizes GPT-4/5 via the OpenAI Chat Model2 and manages memory (Simple Memory) and tools (google). It is configured to enforce output structure using the Structured Output Parser n8n node.
google (LangChain Tool n8n node/Sub-workflow): This embedded n8n workflow executes the memory lookup logic. It uses the Google Sheets n8n node to fetch session history, the Filter n8n node to match the session ID, and the Summarize n8n node to count the results.
n8n History (Google Sheets n8n node): This n8n node is responsible for persistently storing the output from the AI agent, including the session ID and the final blog content, serving as the knowledge base for the next iteration.
Check if Ran 4+ times (If n8n node): A conditional n8n node that checks the returned row count (Rows > 3) to implement limits or branching logic based on the history stored in Google Sheets.
Monitor blockchain activity, detect high-risk transactions using ScrapeGraphAI, and send instant Slack alerts. This advanced n8n workflow template provides real-time monitoring and AI analysis.

Automate Bitrix24 app installation, manage access tokens, and serve dynamic data to custom task widgets using this robust n8n workflow template. Start building your Bitrix24 integration today.

Use this comprehensive n8n workflow template to deploy a custom Bitrix24 chatbot application. Learn how the n8n trigger handles events like new messages and bot installation, ensuring seamless integration.

Use this powerful n8n workflow to integrate a voice AI agent (VAPI) with Cal.com. Automate appointment booking and availability checks using a specialized n8n node flow.

A powerful n8n workflow for book club management, featuring AI agents (Mistral, Gemini) for book cover analysis, structured data parsing, member management, and automated email recommendations. Perfect n8n templates for custom backends.

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.







































