{
  "id": "RYcoxYMGXy8I4MaS",
  "name": "FAQ Generator with AI Agent",
  "tags": [],
  "nodes": [
    {
      "id": "df30968f-84e0-47e8-a6c9-c21a82f3c08f",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -192,
        384
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "f31476dd-a7e3-42ce-8af0-ce786052dab8",
      "name": "Get Questions from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        16,
        384
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1234567891,
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE/edit#gid=1234567891",
          "cachedResultName": "Database"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "12345abcde678910fghij",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE/edit?usp=drivesdk",
          "cachedResultName": "Name of Document - FAQ Content Backlog"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cffd3173-bbb3-4f63-805d-f479f27318aa",
      "name": "Generate FAQ Answer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        416,
        384
      ],
      "parameters": {
        "text": "=Research the user\u2019s question on the open web and produce a high-quality, SEO-optimized FAQ answer.\n\nInputs:\n- Question: {{ $json.Article }}\n- Target Keyword: {{ $json.KW }}\n- Target Audience: {{ $json.Audience }}\n\nOutput:\n## Short Answer\n[Write a 1-2 sentence TLDR-style answer that incorporates the target keyword naturally]\n\n## Detailed Answer\n[Write a comprehensive answer with 2-3 headlines that:\n- Focus on unique, valuable content for people\n- Is optimized for the target keyword \"{{ $json.KW }}\"\n- Speaks to {{ $json.Audience }} (you dont need to explicitly say it)\n- References n8n automation platform where relevant\n- Uses HTML text formatting for better readability (using: H2, H3, ordered lists or bullet points)\n- Includes relevant subheadings if needed\n- Naturally incorporates the keyword 2-3 times]\n\nEnsure the answer is informative, engaging, and provides real value to the reader while being SEO-friendly.",
        "options": {
          "systemMessage": "=You are a marketing SEO specialist for our company specializing in creating SEO-optimized FAQ answers. You have deep knowledge of the n8n automation platform and write content that ranks well while delivering real value.\n\nInstructions:\n- ALWAYS format your responses in HTML and ensure they are tailored to the specified target audience.\n- Use H2, H3 headlines. Never use H1 headline in output, it will be the question for this answer.\n\nQuality content constraints:\n- Use plain language, be accurate, practical, and actionable; avoid fluff. Use examples.\n- Incorporate insights from current, reputable sources; synthesize rather than copy.\n- Maintain our company\u2019s professional, helpful tone (concise, clear, trustworthy).\n- Use british english.\n- Output SHOULD be sentence case as a capitalization style. CAPITALIZE ONLY the FIRST WORD in headlines, headings, titles, subjects, names and ideas.\n- Write \"n8n\" always with lower case, even if sentence start with n8n. It's a brand name."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "1414eb1d-13f3-49ee-b4f3-d40c01ae3ceb",
      "name": "Parse FAQ Answer",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        688,
        592
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"shortAnswer\": {\n      \"type\": \"string\",\n      \"description\": \"The 1-2 sentence TLDR answer\"\n    },\n    \"detailedAnswer\": {\n      \"type\": \"string\",\n      \"description\": \"The comprehensive HTML-formatted answer\"\n    },\n    \"fullAnswer\": {\n      \"type\": \"string\",\n      \"description\": \"The complete answer combining both short and detailed sections\"\n    }\n  },\n  \"required\": [\"shortAnswer\", \"detailedAnswer\", \"fullAnswer\"]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "9b5560a9-1c91-41c2-b191-4da0a63410d8",
      "name": "Update Sheet with Answer",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        720,
        384
      ],
      "parameters": {
        "columns": {
          "value": {
            "Article": "={{ $('Get Questions from Sheet').item.json.Article }}",
            "Answer long": "={{ $json.output.detailedAnswer }}",
            "Answer short": "={{ $json.output.shortAnswer }}"
          },
          "schema": [
            {
              "id": "Article",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Article",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Audience",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Audience",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "KD",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "KD",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "KW",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "KW",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Traffic",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Traffic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Answer short",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Answer short",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Answer long",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Answer long",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Article"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1234567891,
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE/edit#gid=1234567891",
          "cachedResultName": "Database"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "12345abcde678910fghij",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE/edit?usp=drivesdk",
          "cachedResultName": "Name of Document - FAQ Content Backlog"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d3eaaa2e-03ee-42dc-92ea-16eee2a4085b",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        320,
        592
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b8a4b3b5-5454-48a0-a31f-20d14970d7d5",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        224,
        384
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "97236a8c-62d3-4656-9e69-fedb0e48029d",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.row_number }}",
              "rightValue": 12
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "255469c3-3038-4d43-90ee-3e9130b5f7b1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        16
      ],
      "parameters": {
        "width": 672,
        "height": 1632,
        "content": "## Auto-Generate SEO FAQ Answers from Google Sheets with OpenAI\n\n**Automatically generate SEO-optimized FAQ answers using AI, sync them back into your Google Sheet, and instantly publish them to WordPress.**\n\n\n### About Workflow\nThis automation fetches FAQ-style questions from a Google Sheet and uses OpenAI to generate unique, SEO-friendly answers tailored to a target audience. It then writes the AI-generated answer back into the same row of the sheet **and publishes it as a WordPress post**.\n\nPerfect for:\n- Marketing teams scaling content for landing pages, help docs, or blogs\n- SEO specialists optimizing FAQs with target keywords\n- Agencies building content at scale for clients\n\n\n### How it works\n- **Schedule Trigger** ensures the workflow runs at regular intervals  \n  \u21d2 Time-based trigger using cron settings (e.g. every day at 9 AM)\n\n- **Get Questions from Sheet** pulls rows from a Google Sheet  \n  \u21d2 Reads values from columns: `Question`, `KW`, `Audience`, `Article`  \n  \u21d2 Uses Google Sheets node to fetch data from specified sheet and range\n\n- **Filter** checks if an answer already exists  \n  \u21d2 Only proceed if `Answer` column is empty (prevents duplicate processing)\n\n- **Generate FAQ Answer** sends inputs to OpenAI  \n  \u21d2 Uses AI Agent (Chat Model) with structured system prompt  \n  \u21d2 Inputs: Question, Keyword, Audience  \n  \u21d2 Output: Short + detailed answer\n\n- **Parse FAQ Answer** formats AI output for writing  \n  \u21d2 Separates short + long answers using Output Parser node  \n  \u21d2 Ensures markdown structure and SEO compliance\n\n- **Update Sheet with Answer** writes results back to Google Sheets  \n  \u21d2 Updates the `Answer` column in the original row  \n  \u21d2 Uses Update Sheet node to match row and insert formatted content\n\n- **Create WordPress Post** publishes each answer as a new post  \n  \u21d2 Uses WordPress node with \u201cCreate Post\u201d operation  \n  \u21d2 Title: `Article` field from the sheet  \n  \u21d2 Content: AI-generated detailed answer  \n  \u21d2 Requires WordPress credentials (REST API or Application Password)\n\n### How to Use\n1. Connect Google Sheets credentials  \n2. Connect OpenAI credentials (API key)  \n3. Connect WordPress credentials  \n4. Update the sheet ID and range in the relevant nodes  \n5. Add sample questions in the sheet:  \n   - `Question`: Your FAQ  \n   - `KW`: Target keyword  \n   - `Audience`: Intended reader  \n   - `Article`: Desired post title  \n   - Leave `Answer` blank  \n6. Manually trigger or let it run on schedule\n\n### Use Cases\n- Bulk-generate and publish SEO FAQ content directly to WordPress  \n- Update knowledge base or help center articles automatically  \n- Personalize answers based on different audiences\n\n### Requirements  \n- Google Account => with access to target Google Sheet  \n- WordPress account => with API access or Application Password  \n- OpenAI API key\n\n### Need Help? \n- Reach out through n8n community => https://community.n8n.io/u/easy8.ai  \n- Contact our team directly => Easy8.ai  \n- Visit our YouTube channel => https://www.youtube.com/@easy8ai\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3117911a-7e41-4843-b77c-77a88c4f4466",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        16
      ],
      "parameters": {
        "color": 7,
        "width": 1456,
        "height": 880,
        "content": "## Auto-Generate SEO FAQ Answers from Google Sheets with OpenAI\n1. **Schedule Trigger** \u2013 runs the workflow on a defined interval\n2. **Get Questions from Sheet** \u2013 reads FAQ rows (question, keyword, audience) from Google Sheets\n3. **Filter** \u2013 skips rows that already have an answer\n4. **Generate FAQ Answer** \u2013 uses OpenAI to create SEO-friendly short + detailed answers\n5. **Parse FAQ Answer** \u2013 extracts markdown-formatted output\n6. **Update Sheet with Answer** \u2013 writes the result back to the \u201cAnswer\u201d column\n7. **WordPress Node** - posts detailed answer as content from Google Sheets to WordPress"
      },
      "typeVersion": 1
    },
    {
      "id": "83080eb8-a484-4025-b165-e8ab7a2e4b91",
      "name": "WordPress",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        928,
        384
      ],
      "parameters": {
        "title": "={{ $('Get Questions from Sheet').item.json.Article }}",
        "additionalFields": {
          "content": "={{ $json.output.detailedAnswer }}\n\n"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "79025fb2-f07c-43ca-bb05-cda53aa445d0",
  "connections": {
    "Filter": {
      "main": [
        [
          {
            "node": "Generate FAQ Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse FAQ Answer": {
      "ai_outputParser": [
        [
          {
            "node": "Generate FAQ Answer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Questions from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate FAQ Answer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate FAQ Answer": {
      "main": [
        [
          {
            "node": "Update Sheet with Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Questions from Sheet": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Sheet with Answer": {
      "main": [
        [
          {
            "node": "WordPress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}