Dynamic E-commerce Content Generation and Sales Analytics - n8n Workflow

Automate Shopify product descriptions using n8n and GPT-4o Vision. This n8n workflow includes custom AI copywriting rules, robust pagination handling, and daily sales report logging to Google Sheets.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

E-commerce managers and content teams needing automated, high-quality product content generation at scale.
Technical marketers who require strictly controlled, brand-compliant content using large language models (LLMs).
n8n Automation Specialists looking for advanced examples of AI Agents, vision models, and custom pagination logic within an n8n workflow.
Operations teams needing automated, reliable daily sales reporting from Shopify to Google Sheets.

Overview

This comprehensive n8n workflow is designed to streamline critical e-commerce operations, focusing on both content scalability and performance monitoring. The core challenge solved is automating the creation of high-quality, SEO-aware product descriptions for new Shopify inventory. It leverages state-of-the-art AI technology: GPT-4o Vision analyzes product images to extract factual, physical attributes, which are then passed to a highly specialized AI Agent powered by Claude 3.5 (via OpenRouter). This agent adheres to complex, strict brand rules (e.g., origin logic, style code inclusion, mandatory color removal), guaranteeing compliance and consistency.

This robust n8n workflow also features advanced, custom pagination logic to reliably fetch large product lists from Shopify and manage processing state in Google Sheets. Additionally, a separate, scheduled n8n trigger ensures daily extraction and summation of Shopify sales data, logging key metrics to a separate Google Sheet for analytics. This entire n8n automation is fortified with an AI-driven error handling system that automatically diagnoses and documents failures, enhancing the reliability of the overall n8n solution.

How it Works

The overall n8n workflow operates in three distinct branches:

1. Product Discovery and Pagination Flow


  1. Scheduled n8n trigger: The main product fetching flow starts via the Every 5 Minutes n8n trigger.

  2. State Retrieval: The Get row(s) in sheet2 n8n node retrieves the pageinfonext marker from a Google Sheet, ensuring the n8n workflow resumes where the last batch left off.

  3. Data Fetching: The Fetch Shopify Products HTTP Request uses the retrieved pageinfo to get the next batch of up to 200 products from the Shopify API.

  4. Filtering: The Code1 n8n node executes custom JavaScript to strictly filter products, selecting only those that have a valid image URL, an empty bodyhtml, and the mandatory currSeas:SS2025 tag. This n8n node also extracts style, origin, and gender from product tags.

  5. State Update: The custom Code5 n8n node parses the Shopify API’s Link header to extract the next pagination cursor. The If2 node checks if a next page exists, and if so, the Update row in sheet1 n8n node records the new pageinfo back into the Google Sheet for the next run.

2. AI Content Generation Flow


  1. Generation n8n trigger: A separate Schedule Trigger initiates the description generation process by fetching up to 10 products marked 'Ready for AI Description' from the main Google Sheet (Get row(s) in sheet1).

  2. Image Analysis: The Analyze image n8n node uses GPT-4o Vision to generate a concise, factual summary of the product's physical traits from the Image url supplied in the data.

  3. AI Copywriting: The Shopify Content Generator AI Agent receives the image analysis and detailed system instructions. It uses the OpenRouter Chat Model (Claude 3.5) and a Perplexity Tool to write 60-80 word product descriptions based on strict rules (color removal, origin logic, SEO).

  4. Structured Output: The Structured Output Parser n8n node ensures the Agent's response is valid JSON, containing productid, producttitle, and the generateddescription.

  5. Logging: The Update row in sheet n8n node writes the final generated description and status ('generated' or 'retry') back to the source Google Sheet.

3. Sales Analytics Flow


  1. Daily n8n trigger: The Schedule Trigger1 runs daily to collect data.

  2. Data Extraction: The HTTP Request1 n8n node fetches all paid Shopify orders from the previous day.

  3. Summarization: An If n8n node checks if orders exist. Orders are split by Split Out, prices are extracted by Edit Fields2, and the Summarize n8n node calculates the total sum of sales.

  4. Reporting: The total sales figure (or 0 if no orders) is logged to the shopifydailysales Google Sheet.

4. Automated Error Reporting


  1. An Error Trigger n8n node intercepts any workflow failure.

  2. A dedicated AI Agent uses the raw error message, a specified LLM (OpenRouter Chat Model2), and a Perplexity Tool to research and diagnose the root cause.

  3. The agent generates a human-readable and technical explanation, which is logged to the dedicated Error_log Google Sheet using an Append row in sheet in Google Sheets n8n node.

Installation Guide

To deploy this expert n8n workflow, follow these steps:


  1. Import the JSON: Copy the provided JSON data and import it directly into your n8n instance via the Workflows section.

  2. Shopify Credentials: You will need two Shopify Access Token credentials set up: one for your main shop (for product fetching) and one for the shop used in the daily sales report (if different). Update the credentials in the Fetch Shopify Products and HTTP Request1 n8n nodes.

  3. AI Credentials: Set up credentials for:

OpenAI (or equivalent) for the Analyze image n8n node (GPT-4o Vision).
OpenRouter (or equivalent) for the OpenRouter Chat Model and OpenRouter Chat Model2 n8n nodes.
Perplexity for the research tools (Message a model in Perplexity n8n node).

  1. Google Sheets Setup: You require access to two main Google Sheets documents, potentially containing three distinct sheets:

A 'ProcessingState' sheet (for pagination status).
A 'Products' sheet (to log filtered products and generated descriptions).
An 'Errorlog' sheet (for error documentation).
* A 'shopify
daily_sales' sheet (for analytics).

  1. Configure Sheet IDs: Update the Document ID and Sheet Name (GID) parameters within all Google Sheets n8n node instances (e.g., Get row(s) in sheet1, Update row in sheet1, Append row in sheet2, etc.) to match your actual setup.

  2. Activate: Save and activate the n8n workflow. The various processes will start based on their respective schedule triggers.

Node Details

Every 5 Minutes (n8n trigger): The primary time-based n8n trigger for the product syncing and pagination continuation flow.
Analyze image (OpenAi n8n node): Function: Uses GPT-4o vision to meticulously analyze the product image URL, strictly extracting physical attributes for the copywriter agent. Key Configuration: Uses gpt-4o model with the analyze operation on the provided image URL.
Shopify Content Generator (AI Agent n8n node): Function: The core copywriting engine. It takes the image analysis and product metadata to generate a 60-80 word, rule-compliant, SEO-aware description. Key Configuration: Uses LangChain Agent setup, connected to an OpenRouter Chat Model (Claude 3.5 Sonnet) and the Message a model in Perplexity tool for research.
Structured Output Parser (LangChain n8n node): Function: Enforces that the output from the AI Agent is strictly a valid JSON object matching the defined schema, crucial for downstream mapping in this n8n workflow.
Fetch Shopify Products (HTTP Request n8n node): Function: Retrieves product batches from Shopify using the API. Key Configuration: Uses dynamic query parameters for pageinfo to manage stateful pagination.
Code5 (n8n node): Function: Parses the Link header returned by the Shopify HTTP request to extract the subsequent page
info cursor, enabling reliable sequence continuation of the n8n workflow.
Get row(s) in sheet1 (Google Sheets n8n node): Function: Fetches products from the queue with 'Ready for AI Description' status to begin processing.
Error Trigger (n8n trigger): Function: Captures execution errors within the n8n workflow. It is the initial n8n trigger for the automated diagnostic routine.


  • AI Agent (Error Handling) (n8n node): Function: Diagnoses the cause of the error reported by the Error Trigger and formulates a detailed explanation using external tools (Perplexity) before logging the result.

Related n8n Workflows

Free

Nodes: 20 Nodes
Updated: December 26 2025
View all
Created by

I'm an automation specialist who helps startups, agencies, and growth teams save time and scale faster using n8n. I design smart, reliable workflows that connect tools like HubSpot, Slack, OpenAI, Claude, Pipedrive, Google Ads, and vector databases (Qdrant, Pinecone). Whether it's auto-assigning leads, generating AI-powered reports, triggering Slack alerts, or syncing APIs — I build automations that just work. Let’s turn your manual processes into automated systems that scale.