This workflow corresponds to n8n.io template #12286 — we link there as the canonical source.
This workflow follows the Agent → Google Sheets recipe pattern — see all workflows that pair these two integrations.
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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "8e280a53-57a8-4c12-86dd-97e798c66331",
"name": "Shopify Trigger",
"type": "n8n-nodes-base.shopifyTrigger",
"position": [
-1504,
-640
],
"parameters": {
"topic": "products/create",
"authentication": "accessToken"
},
"credentials": {
"shopifyAccessTokenApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "587ad810-2aad-442f-97e5-a24f98061213",
"name": "Gemini",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-1008,
-368
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "b7f595c6-b559-40db-bb00-51a6e00a6296",
"name": "No Operation",
"type": "n8n-nodes-base.noOp",
"position": [
-384,
-48
],
"parameters": {},
"typeVersion": 1
},
{
"id": "3915596c-927c-4cd5-951c-f626bb98d5e0",
"name": "input set",
"type": "n8n-nodes-base.set",
"position": [
-1296,
-640
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e738b77a-5be6-41db-a1d1-481a20c238e5",
"name": "id",
"type": "number",
"value": "={{ $json.id }}"
},
{
"id": "1bf7b574-db76-4911-a1bf-fe19ecd88359",
"name": "title",
"type": "string",
"value": "={{ $json.title }}"
},
{
"id": "6559c586-2357-4147-9b60-094fb4c82e34",
"name": "body_html",
"type": "string",
"value": "={{ $json.body_html }}"
},
{
"id": "3c4db7aa-291c-4853-b1ce-eddfc1af2e2c",
"name": "vendor",
"type": "string",
"value": "={{ $json.vendor }}"
},
{
"id": "7528aeef-64cc-480f-abd5-f35b6d277f7b",
"name": "product_type",
"type": "string",
"value": "={{ $json.product_type }}"
},
{
"id": "0b6681bd-6ac9-44f2-8f7b-11a3d7d29343",
"name": "handle",
"type": "string",
"value": "={{ $json.handle }}"
},
{
"id": "4445023b-733e-43c8-a289-2f690ff26735",
"name": "images",
"type": "string",
"value": "={{ $json.images[0].src }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e2d01126-c96f-4b30-b1ba-d029aa092cbc",
"name": "input update",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1072,
-640
],
"parameters": {
"columns": {
"value": {
"id": "={{ $json.id }}",
"title": "={{ $json.title }}",
"handle": "={{ $json.handle }}",
"images": "={{ $json.images }}",
"status": "product data",
"vendor": "={{ $json.vendor }}",
"body_html": "={{ $json.body_html }}",
"product_type": "={{ $json.product_type }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "body_html",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "body_html",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ai_blog",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "ai_blog",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "vendor",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "vendor",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product_type",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "product_type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "handle",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "handle",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "images",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "images",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "status",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit#gid=0",
"cachedResultName": "data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit?usp=drivesdk",
"cachedResultName": "shopify_to_blog"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "01b46429-b331-4775-86e2-16ee0cd26b27",
"name": "web search",
"type": "n8n-nodes-base.perplexity",
"position": [
-800,
-640
],
"parameters": {
"options": {},
"messages": {
"message": [
{
"content": "=# You are an e\u2011commerce market researcher and SEO strategist.\n\n## Use the following Shopify product data as your only ground truth:\nTitle: {{ $json.title }}\nDescription (HTML): {{ $json.body_html }}\nVendor / Brand: {{ $json.vendor }}\nProduct type / Category: {{ $json.product_type }}\n\n## Your task is to analyze this product conceptually and return structured research that another AI agent will later use to write a blog post.\nDo not write the blog post itself.\n\n## Focus your reasoning on:\n- The problem this product solves and why customers look for it.\n- The typical target audience and their priorities.\n- Common use cases and real\u2011world situations where the product is helpful.\n- Key features and the benefits those features deliver.\n- Likely objections or questions customers might have before buying.\n- Search\u2011intent and SEO opportunities around this type of product.\n\n## Return your findings as the following JSON object:\n\njson\n{\n \"productSummary\": \"2-3 sentence neutral summary of what this product is and what it does.\",\n \"targetAudience\": [\n \"Short description of a key audience segment\",\n \"Another audience segment\"\n ],\n \"customerGoals\": [\n \"What customers want to achieve by buying this product\"\n ],\n \"painPoints\": [\n \"3\u20137 concrete problems or frustrations this product helps solve\"\n ],\n \"usageScenarios\": [\n \"3\u20137 realistic situations where the product is used\"\n ],\n \"featureToBenefitMap\": [\n {\n \"feature\": \"Name or description of a feature\",\n \"benefit\": \"Why this matters to the customer in practical terms\"\n }\n ],\n \"objectionsAndConcerns\": [\n \"3\u20137 likely doubts, risks, or questions customers might have before purchase\"\n ],\n \"faqIdeas\": [\n \"5\u201310 good FAQ questions a shopper would ask about this type of product\"\n ],\n \"seoResearch\": {\n \"searchIntent\": \"Short description of the main search intent for this product type (informational, commercial, transactional, etc.).\",\n \"primaryKeyword\": \"One main keyword phrase you infer for this product.\",\n \"secondaryKeywords\": [\n \"3\u201310 related and long\u2011tail keyword ideas\"\n ],\n \"contentAngleIdeas\": [\n \"3\u20137 potential blog angles or headlines themes (not full titles, just angles).\"\n ]\n }\n}\n\n## Rules:\n- Base your reasoning on the product data and general domain knowledge about similar products.\n- Do not fabricate highly specific technical specs if they are not implied; keep assumptions generic and reasonable.\n- Do not output a blog article or paragraphs of prose.\n- Respond only with valid JSON matching the schema above, no extra commentary."
}
]
},
"simplify": true,
"requestOptions": {}
},
"credentials": {
"perplexityApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "47a37577-cbde-4d34-b326-4fe76c644d1a",
"name": "content generator",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-496,
-640
],
"parameters": {
"text": "=## Input Data\nYou are given:\n\nproduct_title : {{ $('input update').item.json.title }}\nproduct_description (HTML from Shopify) : {{ $('input update').item.json.body_html }}\nbrand_name : {{ $('input update').item.json.vendor }}\nproduct_type : {{ $('input update').item.json.product_type }}\nwebsearch_data (research summary about this product/type) : {{ $json.message }}",
"options": {
"systemMessage": "=# AI Agent Prompt for Structured Product Blog Generator\n\nYou are an expert automotive copywriter and e\u2011commerce content strategist. \nYour task is to generate a structured JSON object for a product-focused article, following strict length and formatting rules.\n\n## Use all of this information to understand:\n- What the product is. \n- Who it is for. \n- What problems it solves for professional users (e.g., mechanics, technicians, workshop owners, or relevant audience based on product_type). \n- How it compares to typical alternatives in the market.\n\n## Required Output Structure\nYou must return a **single JSON object** with **exactly** these fields and constraints:\n\n{\n \"article_title\": \"\",\n \"introduction\": \"\",\n \"problem_title\": \"\",\n \"problem_paragraph\": \"\",\n \"problem_pointers\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"solution_title\": \"\",\n \"solution_paragraph\": \"\",\n \"features_and_benefits\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"technical_specifications\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"real_life_usage\": [\n {\n \"title\": \"\",\n \"description\": \"\",\n \"points\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"comparative_advantage\": [\n {\n \"factor\": \"\",\n \"this_product\": \"\",\n \"others\": \"\"\n }\n ],\n \"recommendations_and_cta\": {\n \"title\": \"\",\n \"description\": \"\"\n }\n}\n\n## Field Specifications & Limits\n### 1. article_title\n- Start with **product name** (use product_title and brand_name) \n- Add short descriptive hook \n- **Max: 100 characters or 15 words** \nExample: \"Autel MaxiCOM Ultra Lite Review: The One Diagnostic Tool Your Workshop Needs?\"\n\n### 2. introduction\n- 1 short paragraph introducing main problem + solution hint \n- **Max: 400 characters or 60\u201370 words**\n\n### 3. problem_title\n- Short, problem-focused heading \n- **Max: 100 characters or 15 words** \nExample: \"The Core Problem: The Diagnostic Dilemma for Modern Mechanics\"\n\n### 4. problem_paragraph\n- 1 paragraph explaining core problem \n- **Max: 400 characters or 60\u201370 words**\n\n### 5. problem_pointers (3\u20135 items)\nEach:\nname: 2\u20133 words\nvalue: Max 150 characters\n**Example:**\n[\n {\"name\": \"Time Waste\", \n \"value\": \"Without precise diagnostics, hours are lost on trial-and-error instead of efficient repairs.\"\n },\n {\"name\": \"Customer Dissatisfaction\", \n \"value\": \"Inaccurate diagnoses lead to repeat repairs, eroding trust and damaging reputation.\"\n }\n]\n\n### 6. solution_title\n- Introduces product as solution \n- **Max: 100 characters or 15 words**\n\n### 7. solution_paragraph\n- Presents product as practical solution \n- **Max: 500 characters or 100 words**\n\n### 8. features_and_benefits (5\u20137 items)\nEach:\nname: 3\u20135 words max\nvalue: Max 150 characters (feature + benefit)\n\n### 9. technical_specifications (5\u20137 items)\nEach:\nname: 1\u20132 words\nvalue: 50\u201370 characters\n**Example:**\n[\n {\n \"name\": \"Connectivity\", \n \"value\": \"Fast XP200 Platform with 2.4/5Ghz dual-band Wi-Fi\"\n },\n {\"name\": \"Display\", \n \"value\": \"7-inch capacitive touchscreen for workshop use\"\n }\n]\n\n### 10. real_life_usage (2\u20133 scenarios)\nEach scenario:\ntitle: 5\u201310 words\ndescription: Max 70 characters\npoints: 3\u20135 items (name: 2\u20133 words, value: 60\u2013100 characters)\n\n### 11. comparative_advantage (7\u201310 items)\nEach:\nfactor: 2\u20134 words\nthis_product: 1 concise line\nothers: 1 concise line about competitors\n\n### 12. recommendations_and_cta\ntitle: 7\u201310 words\ndescription: 120\u2013150 characters\n\n## Rules\n- Use actual product name, brand, type from inputs \n- Professional, problem\u2013solution tone like Autel example \n- Use websearch_data to enrich features/use cases \n- **Return ONLY valid JSON** - no extra text/comments \n- Respect all character limits strictly"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 3.1
},
{
"id": "f542a85c-5675-438c-8d80-93d76c0d3f70",
"name": "Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-912,
-368
],
"parameters": {
"sessionKey": "={{ $now.minute }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "cf68bc52-f847-47a1-b437-3856eb615027",
"name": "Output Parser1",
"type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
"position": [
-784,
-368
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "47bd077c-7178-4347-944f-ebead1607016",
"name": "Gemini3",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-480,
-368
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "6652db78-962d-4aa7-ae7e-3f7c26eb26cb",
"name": "Structured",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-368,
-368
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"article_title\": \"\",\n \"introduction\": \"\",\n \"problem_title\": \"\",\n \"problem_paragraph\": \"\",\n \"problem_pointers\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"solution_title\": \"\",\n \"solution_paragraph\": \"\",\n \"features_and_benefits\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"technical_specifications\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"real_life_usage\": [\n {\n \"title\": \"\",\n \"description\": \"\",\n \"points\": [\n {\n \"name\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"comparative_advantage\": [\n {\n \"factor\": \"\",\n \"this_product\": \"\",\n \"others\": \"\"\n }\n ],\n \"recommendations_and_cta\": {\n \"title\": \"\",\n \"description\": \"\"\n }\n}"
},
"typeVersion": 1.3
},
{
"id": "e90f6621-222b-4983-94b1-1099cb83e671",
"name": "get product data",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1088,
-48
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "blog generated",
"lookupColumn": "status"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit#gid=0",
"cachedResultName": "data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit?usp=drivesdk",
"cachedResultName": "shopify_to_blog"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "94413cf5-1514-4ab0-9ec1-b3302bc587a3",
"name": "article creation",
"type": "n8n-nodes-base.httpRequest",
"position": [
-816,
-48
],
"parameters": {
"url": "https://{store_id}.myshopify.com/admin/api/2025-07/blogs/118631235877/articles.json",
"method": "POST",
"options": {},
"jsonBody": "={\n \"article\": {\n \"title\": \"{{ $('HTML structuring').item.json.article.title }}\",\n \"author\": \"{{ $json.vendor }}\",\n \"tags\": \"Electronics\",\n \"body_html\": \"{{ $json.ai_blog }}\",\n \"published_at\": \"{{$now}}\"\n }\n}\n",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "shopifyAccessTokenApi"
},
"credentials": {
"shopifyAccessTokenApi": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "650e20c5-ff2c-4754-aad4-7f7777b0d19b",
"name": "update blog post status",
"type": "n8n-nodes-base.googleSheets",
"position": [
-592,
-48
],
"parameters": {
"columns": {
"value": {
"id": "={{ $('input update').item.json.id }}",
"status": "posted"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "body_html",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "body_html",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ai_blog",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "ai_blog",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "vendor",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "vendor",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product_type",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "product_type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "handle",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "handle",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "images",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "images",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "status",
"type": "string",
"display": true,
"required": false,
"displayName": "status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit#gid=0",
"cachedResultName": "data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit?usp=drivesdk",
"cachedResultName": "shopify_to_blog"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "a2453318-c638-4cca-9cea-fc0f5f943978",
"name": "HTML structuring",
"type": "n8n-nodes-base.code",
"position": [
-1088,
208
],
"parameters": {
"jsCode": "// Extract data from AI Agent AND Shopify product node\nconst aiData = $input.first().json.output;\nconst productData = $('input update').first().json;\n\n// Get the first product image URL (Shopify format)\nconst productImage = productData.images && productData.images.length > 0 \n ? productData.images[0].src \n : 'https://via.placeholder.com/800x400/2563eb/ffffff?text=No+Image+Available';\n\n// Clean up any problematic newlines from AI output\nfunction cleanText(text) {\n if (!text) return '';\n return text\n .replace(/\\n\\s*\\n/g, ' ')\n .replace(/[\\r\\n]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n// Shopify-safe JSON escaping function\nfunction makeJsonSafe(text) {\n if (!text) return '';\n return text\n .replace(/\\\\/g, '\\\\\\\\') // Escape backslashes first\n .replace(/\"/g, '\\\\\"') // Escape double quotes\n .replace(/\\n/g, '\\\\n') // Escape newlines\n .replace(/\\r/g, ''); // Remove carriage returns\n}\n\n// Clean and escape ALL text fields\nconst cleanedData = {\n article_title: makeJsonSafe(cleanText(aiData.article_title)),\n introduction: makeJsonSafe(cleanText(aiData.introduction)),\n problem_title: makeJsonSafe(cleanText(aiData.problem_title)),\n problem_paragraph: makeJsonSafe(cleanText(aiData.problem_paragraph)),\n solution_title: makeJsonSafe(cleanText(aiData.solution_title)),\n solution_paragraph: makeJsonSafe(cleanText(aiData.solution_paragraph)),\n problem_pointers: aiData.problem_pointers.map(p => ({\n name: makeJsonSafe(cleanText(p.name)),\n value: makeJsonSafe(cleanText(p.value))\n })),\n features_and_benefits: aiData.features_and_benefits.map(fb => ({\n name: makeJsonSafe(cleanText(fb.name)),\n value: makeJsonSafe(cleanText(fb.value))\n })),\n technical_specifications: aiData.technical_specifications.map(spec => ({\n name: makeJsonSafe(cleanText(spec.name)),\n value: makeJsonSafe(cleanText(spec.value))\n })),\n real_life_usage: aiData.real_life_usage.map(scenario => ({\n title: makeJsonSafe(cleanText(scenario.title)),\n description: makeJsonSafe(cleanText(scenario.description)),\n points: scenario.points.map(point => ({\n name: makeJsonSafe(cleanText(point.name)),\n value: makeJsonSafe(cleanText(point.value))\n }))\n })),\n comparative_advantage: aiData.comparative_advantage.map(comp => ({\n factor: makeJsonSafe(cleanText(comp.factor)),\n this_product: makeJsonSafe(cleanText(comp.this_product)),\n others: makeJsonSafe(cleanText(comp.others))\n })),\n recommendations_and_cta: {\n title: makeJsonSafe(cleanText(aiData.recommendations_and_cta.title)),\n description: makeJsonSafe(cleanText(aiData.recommendations_and_cta.description))\n }\n};\n\n// Build BODY HTML (no escaping needed here - HTML content)\nconst bodyHtmlParts = [\n `<div class=\"hero\" style=\"background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:white;padding:2.5rem;border-radius:20px;margin:2rem 0;box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);text-align:center;position:relative;overflow:hidden;\"><h1 style=\"margin:0;font-size:2.5rem;font-weight:800;\">${cleanedData.article_title}</h1><p style=\"font-size:1.2rem;margin:1rem 0 0;opacity:0.95;\">${cleanedData.introduction}</p></div>`,\n\n `<div class=\"product-image\" style=\"text-align:center;margin:3rem 0;\"><img src=\"${productImage}\" alt=\"${cleanedData.article_title}\" loading=\"lazy\" style=\"max-width:100%;max-height:400px;height:auto;border-radius:24px;box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);border:4px solid white;\"></div>`,\n\n `<div class=\"card\" style=\"background:white;border-radius:16px;padding:2rem;margin:1.5rem 0;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);border:1px solid #e2e8f0;\"><h2 style=\"font-size:1.75rem;font-weight:700;color:#1f2937;margin:0 0 1.5rem;padding-bottom:0.75rem;border-bottom:3px solid #2563eb;\">${cleanedData.problem_title}</h2><p style=\"margin-bottom:1.5rem;line-height:1.7;\">${cleanedData.problem_paragraph}</p><ul style=\"margin-top:1rem;list-style:none;padding:0;\">${cleanedData.problem_pointers.map(pointer => `<li style=\"padding:1rem;margin:0.75rem 0;background:linear-gradient(90deg,#f8fafc,#f1f5f9);border-radius:12px;border-left:4px solid #2563eb;font-size:1rem;\"><strong style=\"color:#1e40af;display:block;margin-bottom:0.25rem;font-size:1.05rem;\">${pointer.name}</strong> ${pointer.value}</li>`).join('')}</ul></div>`,\n\n `<div class=\"card\" style=\"background:white;border-radius:16px;padding:2rem;margin:1.5rem 0;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);border:1px solid #e2e8f0;\"><h2 style=\"font-size:1.75rem;font-weight:700;color:#1f2937;margin:0 0 1.5rem;padding-bottom:0.75rem;border-bottom:3px solid #2563eb;\">${cleanedData.solution_title}</h2><p style=\"line-height:1.7;\">${cleanedData.solution_paragraph}</p></div>`,\n\n `<div class=\"card\" style=\"background:white;border-radius:16px;padding:2rem;margin:1.5rem 0;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);border:1px solid #e2e8f0;\"><h2 style=\"font-size:1.75rem;font-weight:700;color:#1f2937;margin:0 0 1.5rem;padding-bottom:0.75rem;border-bottom:3px solid #2563eb;\">Key Features & Benefits</h2><ul style=\"margin-top:1rem;list-style:none;padding:0;\">${cleanedData.features_and_benefits.map(fb => `<li style=\"padding:1rem;margin:0.75rem 0;background:linear-gradient(90deg,#f8fafc,#f1f5f9);border-radius:12px;border-left:4px solid #2563eb;font-size:1rem;\"><strong style=\"color:#1e40af;display:block;margin-bottom:0.25rem;font-size:1.05rem;\">${fb.name}</strong><br>${fb.value}</li>`).join('')}</ul></div>`,\n\n `<div class=\"card\" style=\"background:white;border-radius:16px;padding:2rem;margin:1.5rem 0;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);border:1px solid #e2e8f0;\"><h2 style=\"font-size:1.75rem;font-weight:700;color:#1f2937;margin:0 0 1.5rem;padding-bottom:0.75rem;border-bottom:3px solid #2563eb;\">Technical Specifications</h2><ul style=\"display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:1rem;margin:1.5rem 0 0;list-style:none;padding:0;\">${cleanedData.technical_specifications.map(spec => `<li style=\"padding:1.25rem;border-radius:12px;background:#f0f9ff;border:1px solid #bae6fd;\"><strong style=\"color:#1e40af;\">${spec.name}:</strong> ${spec.value}</li>`).join('')}</ul></div>`,\n\n `<h2 style=\"font-size:1.75rem;font-weight:700;color:#1f2937;margin:3rem 0 1.5rem;padding-bottom:0.75rem;border-bottom:3px solid #2563eb;\">Real Life Usage</h2>${cleanedData.real_life_usage.map(scenario => `<div class=\"usage-card\" style=\"background:linear-gradient(135deg,#fef3c7 0%,#fde68a 100%);border:1px solid #f59e0b;border-radius:16px;overflow:hidden;margin:2rem 0;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\"><h3 style=\"background:#f59e0b;color:white;padding:1rem 1.5rem;margin:0;font-size:1.2rem;font-weight:600;\">${scenario.title}</h3><div class=\"usage-meta\" style=\"padding:1rem 1.5rem 0.5rem;color:#92400e;font-style:italic;\">${scenario.description}</div><ul style=\"margin:0;padding-left:1.5rem;\">${scenario.points.map(point => `<li style=\"padding-left:1.5rem;margin:0.75rem 0;\"><strong style=\"display:block;margin-bottom:0.25rem;font-size:1.05rem;color:#1e40af;\">${point.name}:</strong> ${point.value}</li>`).join('')}</ul></div>`).join('')}`,\n\n `<div class=\"card\" style=\"background:white;border-radius:16px;padding:2rem;margin:1.5rem 0;box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);border:1px solid #e2e8f0;\"><h2 style=\"font-size:1.75rem;font-weight:700;color:#1f2937;margin:0 0 1.5rem;padding-bottom:0.75rem;border-bottom:3px solid #2563eb;\">Comparative Advantage</h2><table style=\"width:100%;border-collapse:collapse;border-spacing:0;margin:2rem 0 0;\"><tr style=\"background:linear-gradient(135deg,#2563eb,#1e40af);\"><th style=\"color:white;padding:1.25rem 1rem;font-weight:600;text-align:left;\">Factor</th><th style=\"color:white;padding:1.25rem 1rem;font-weight:600;text-align:left;\">${cleanedData.article_title.split(':')[0]} Advantage</th><th style=\"color:white;padding:1.25rem 1rem;font-weight:600;text-align:left;\">Competitors</th></tr>${cleanedData.comparative_advantage.map(comp => `<tr><td style=\"padding:1.25rem 1rem;border-bottom:1px solid #e2e8f0;font-weight:600;color:#1e40af;width:25%;\">${comp.factor}</td><td style=\"padding:1.25rem 1rem;border-bottom:1px solid #e2e8f0;\">${comp.this_product}</td><td style=\"padding:1.25rem 1rem;border-bottom:1px solid #e2e8f0;\">${comp.others}</td></tr>`).join('')}</table></div>`,\n\n `<div class=\"cta\" style=\"background:linear-gradient(135deg,#2563eb,#1e40af);color:white;padding:3rem 2rem;border-radius:24px;text-align:center;margin:4rem 0 2rem;box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\"><h2 style=\"font-size:2rem;margin:0 0 1rem;font-weight:700;\">${cleanedData.recommendations_and_cta.title}</h2><p style=\"font-size:1.15rem;margin:0;line-height:1.6;\">${cleanedData.recommendations_and_cta.description}</p></div>`\n];\n\n// Join and clean body_html\nconst rawBodyHtml = bodyHtmlParts.join('').replace(/[\\r\\n]+/g, '');\nconst body_html = makeJsonSafe(rawBodyHtml); // FINAL JSON escaping\n\n// Return PERFECTLY clean Shopify JSON\nreturn [{\n json: {\n article: {\n title: cleanedData.article_title,\n body_html: body_html,\n excerpt: cleanedData.introduction.substring(0, 160) + '...',\n published: true,\n tags: \"product-review, featured\"\n }\n }\n}];"
},
"typeVersion": 2
},
{
"id": "045c226c-6517-4915-8383-5f7320362449",
"name": "update content",
"type": "n8n-nodes-base.googleSheets",
"position": [
-816,
208
],
"parameters": {
"columns": {
"value": {
"id": "={{ $('input update').item.json.id }}",
"status": "blog generated",
"ai_blog": "={{ $json.article.body_html }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "body_html",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "body_html",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ai_blog",
"type": "string",
"display": true,
"required": false,
"displayName": "ai_blog",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "vendor",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "vendor",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product_type",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "product_type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "handle",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "handle",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "images",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "images",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "status",
"type": "string",
"display": true,
"required": false,
"displayName": "status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit#gid=0",
"cachedResultName": "data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mKEh5BO9v8bY1iJNQDxu8Kvy1GMaTFheifvhCenfZOQ/edit?usp=drivesdk",
"cachedResultName": "shopify_to_blog"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "291f997c-3bcc-47dc-a649-7cb495c1c411",
"name": "error handling",
"type": "n8n-nodes-base.switch",
"position": [
-592,
208
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "available",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0bb153d6-c8b3-4082-a902-690eeeff1947",
"operator": {
"type": "number",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.id }}",
"rightValue": 0
}
]
},
"renameOutput": true
},
{
"outputKey": "no output",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6064ea97-acb7-4a60-8d84-1f90b9e78065",
"operator": {
"type": "number",
"operation": "notExists",
"singleValue": true
},
"leftValue": "={{ $json.id }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.4
},
{
"id": "e37f2b02-2b6f-4d23-9f00-8274cdccbdaf",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1536,
-688
],
"parameters": {
"color": 7,
"width": 1344,
"height": 512,
"content": ""
},
"typeVersion": 1
},
{
"id": "26bbe4d7-1779-40f3-8609-e7beb2ad1434",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1536,
-160
],
"parameters": {
"color": 7,
"width": 1344,
"height": 672,
"content": ""
},
"typeVersion": 1
},
{
"id": "0781ee33-2b39-4325-874f-23f178a2b8f2",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2048,
-464
],
"parameters": {
"color": 2,
"width": 496,
"height": 272,
"content": "# Author Details\n## Manish Kumar\n### AI Engineer helping brands scale with Custom Shopify Apps & other AI Automations\n## Contact:\n### \ud83d\udce7 [manipritraj@gmail.com](mailto:manipritraj@gmail.com)\n### \ud83d\udcde +91-9334888899\n\n"
},
"typeVersion": 1
},
{
"id": "830f636f-f246-47ef-b9e2-fe51e08b4d0f",
"name": "Sticky Note11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2048,
-688
],
"parameters": {
"color": 7,
"width": 496,
"height": 208,
"content": "\n"
},
"typeVersion": 1
},
{
"id": "4bcef998-d528-4b2c-92b9-ceac1d9bd3cc",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2048,
-176
],
"parameters": {
"color": 2,
"width": 500,
"height": 686,
"content": "## Shopify Product-to-Blog Automation (AI + Google Sheets) with Perplexity & Gemini\n\nAutomate your e-commerce content strategy by transforming new Shopify products into high-quality, SEO-optimized blog posts. This workflow monitors your store, researches market trends, and publishes structured articles automatically.\n\n### How it works\n1. Trigger: Detects a new product creation in your Shopify store.\n2. Research: Uses Perplexity AI to perform live web research on search intent, target audience, and customer pain points.\n3. Generation: An AI agent powered by Gemini processes the research and product data to write a structured, professional blog post.\n4. Formatting: A JavaScript step converts the AI output into a custom-styled HTML template with your product images.\n5. Publishing: Automatically creates the blog article in Shopify and logs the entry in a Google Sheet for tracking.\n\n### Setup\n- [ ] Connect your Shopify account with Admin API access.\n- [ ] Link your Google Sheets account and select your tracking spreadsheet.\n- [ ] Add your Perplexity API key to the research node.\n- [ ] Add your Google Gemini API key to the AI nodes.\n- [ ] Update the Shopify Blog ID in the HTTP Request node URL.\n- [ ] Ensure your Google Sheet has a column named 'status' to track progress.\n- [ ] Enable the Shopify Trigger to start monitoring for new products.\n"
},
"typeVersion": 1
}
],
"connections": {
"Gemini": {
"ai_languageModel": [
[
{
"node": "content generator",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Memory": {
"ai_memory": [
[
{
"node": "content generator",
"type": "ai_memory",
"index": 0
}
]
]
},
"Gemini3": {
"ai_languageModel": [
[
{
"node": "Output Parser1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"input set": {
"main": [
[
{
"node": "input update",
"type": "main",
"index": 0
}
]
]
},
"Structured": {
"ai_outputParser": [
[
{
"node": "Output Parser1",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"web search": {
"main": [
[
{
"node": "content generator",
"type": "main",
"index": 0
}
]
]
},
"input update": {
"main": [
[
{
"node": "web search",
"type": "main",
"index": 0
}
]
]
},
"Output Parser1": {
"ai_outputParser": [
[
{
"node": "content generator",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"error handling": {
"main": [
[
{
"node": "get product data",
"type": "main",
"index": 0
}
],
[
{
"node": "input update",
"type": "main",
"index": 0
}
]
]
},
"update content": {
"main": [
[
{
"node": "error handling",
"type": "main",
"index": 0
}
]
]
},
"Shopify Trigger": {
"main": [
[
{
"node": "input set",
"type": "main",
"index": 0
}
]
]
},
"HTML structuring": {
"main": [
[
{
"node": "update content",
"type": "main",
"index": 0
}
]
]
},
"article creation": {
"main": [
[
{
"node": "update blog post status",
"type": "main",
"index": 0
}
]
]
},
"get product data": {
"main": [
[
{
"node": "article creation",
"type": "main",
"index": 0
}
]
]
},
"content generator": {
"main": [
[
{
"node": "HTML structuring",
"type": "main",
"index": 0
}
]
]
},
"update blog post status": {
"main": [
[
{
"node": "No Operation",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApigoogleSheetsOAuth2ApiperplexityApishopifyAccessTokenApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
(From Shopify product to SEO-optimized blog post — fully automated)
Source: https://n8n.io/workflows/12286/ — 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.
This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.
This Shopify AI automation is an advanced n8n-powered workflow that transforms Shopify product collections into SEO-optimized blog articles with images, while maintaining full visibility and control t
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
The AI-Powered Shopify SEO Content Automation is an enterprise-grade workflow that transforms product content creation for e-commerce stores. This sophisticated multi-agent system integrates GPT-4o, C
How it Works