{
  "name": "Social Media Content Pipeline",
  "nodes": [
    {
      "id": "form_intake",
      "name": "Content Idea Intake",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.6,
      "position": [
        0,
        300
      ],
      "parameters": {
        "path": "content-idea-intake",
        "formTitle": "Content Idea Intake",
        "formDescription": "Drop in a content idea and the pipeline will research, outline, write, and (after your approvals) publish it to WordPress.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Idea / Topic",
              "fieldType": "text",
              "requiredField": true
            },
            {
              "fieldLabel": "Angle or notes",
              "fieldType": "textarea",
              "requiredField": false
            },
            {
              "fieldLabel": "Target keyword",
              "fieldType": "text",
              "requiredField": false
            }
          ]
        },
        "responseMode": "onReceived",
        "options": {}
      }
    },
    {
      "id": "research_model",
      "name": "Research Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        180,
        520
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "perplexity_tool",
      "name": "Perplexity",
      "type": "n8n-nodes-base.perplexityTool",
      "typeVersion": 2,
      "position": [
        340,
        520
      ],
      "parameters": {
        "resource": "search",
        "operation": "search",
        "query": "={{ $fromAI('query', 'the search query to research the content idea', 'string') }}",
        "toolDescription": "Search the live web for real, current facts, statistics, trends, and sources about a topic. Returns ranked results with URLs."
      }
    },
    {
      "id": "x_search_tool",
      "name": "X Search (add API)",
      "type": "n8n-nodes-base.twitter",
      "typeVersion": 2,
      "position": [
        260,
        700
      ],
      "disabled": true,
      "notes": "Disabled dead-end placeholder. Add a paid X (Twitter) API plan, then feed recent-tweet results into the Research Agent via an HTTP Request Tool node (the X node itself cannot be an ai_tool).",
      "parameters": {
        "resource": "tweet",
        "operation": "search",
        "searchText": "AI automation",
        "additionalFields": {}
      }
    },
    {
      "id": "research_agent",
      "name": "Research Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        300,
        300
      ],
      "parameters": {
        "promptType": "define",
        "text": "=Content idea: {{ $('Content Idea Intake').item.json['Idea / Topic'] }}\nAngle/notes: {{ $('Content Idea Intake').item.json['Angle or notes'] }}\nTarget keyword: {{ $('Content Idea Intake').item.json['Target keyword'] }}\n\nResearch this idea and produce a concise research brief.",
        "options": {
          "systemMessage": "You are a research assistant for a blog content pipeline. Use the Perplexity tool to gather real, current facts, statistics, trends, and angles about the idea, each with its source URL.\n\nHARD RULES (never break): Do not invent facts, statistics, studies, clients, results, or sources. Only report information you actually retrieved from a tool, and cite the source URL for each claim. Use honest ranges (around, up to, typically) for any benchmark number; never fabricate precise figures. If you cannot verify something, say so explicitly.\n\nOutput a concise research brief: key facts (each with its source URL), notable statistics, current angles/hooks, and a final list of source URLs."
        }
      }
    },
    {
      "id": "approve_research",
      "name": "Approve Research",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        580,
        300
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendAndWait",
        "sendTo": "YOUR_EMAIL@example.com",
        "subject": "=Approve research: {{ $('Content Idea Intake').item.json['Idea / Topic'] }}",
        "message": "={{ $('Research Agent').item.json.output }}",
        "responseType": "approval",
        "approvalOptions": {
          "values": {
            "approvalType": "single"
          }
        },
        "options": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "outline_model",
      "name": "Outline Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        820,
        520
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "outline_agent",
      "name": "Outline Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        860,
        300
      ],
      "parameters": {
        "promptType": "define",
        "text": "=Content idea: {{ $('Content Idea Intake').item.json['Idea / Topic'] }}\n\nApproved research brief:\n{{ $('Research Agent').item.json.output }}\n\nProduce the outline.",
        "options": {
          "systemMessage": "You are a content strategist. Using the content idea and the approved research brief, produce a clear blog-post outline: a working title, the target angle/hook, and an ordered list of sections (H2s) with a one-line note each.\n\nHARD RULES: Only use facts present in the research brief. Do not invent statistics, clients, results, or sources. Keep any numbers as honest ranges. Output the outline only."
        }
      }
    },
    {
      "id": "approve_outline",
      "name": "Approve Outline",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1140,
        300
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendAndWait",
        "sendTo": "YOUR_EMAIL@example.com",
        "subject": "=Approve outline: {{ $('Content Idea Intake').item.json['Idea / Topic'] }}",
        "message": "={{ $('Outline Agent').item.json.output }}",
        "responseType": "approval",
        "approvalOptions": {
          "values": {
            "approvalType": "single"
          }
        },
        "options": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "writer_model",
      "name": "Writer Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        1380,
        520
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "content_writer",
      "name": "Content Writer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1420,
        300
      ],
      "parameters": {
        "promptType": "define",
        "text": "=Content idea: {{ $('Content Idea Intake').item.json['Idea / Topic'] }}\n\nApproved outline:\n{{ $('Outline Agent').item.json.output }}\n\nResearch brief (for facts/sources):\n{{ $('Research Agent').item.json.output }}\n\nWrite the full HTML article.",
        "options": {
          "systemMessage": "You are a content writer. Using the approved outline and research brief, write a complete, publish-ready blog post in clean HTML (use <h2>, <p>, <ul>, <li> as needed; do NOT include <html>, <head>, or <body> wrappers).\n\nHARD RULES (never break): Do not invent facts, statistics, studies, clients, testimonials, results, or sources. Use only information from the research brief; cite sources inline or at the end where relevant. Keep any numbers as honest ranges (around, up to, typically), never fabricated precise figures. Do not claim any personal research about a specific company.\n\nWrite naturally and clearly. Output only the HTML article body."
        }
      }
    },
    {
      "id": "approve_final",
      "name": "Approve Final Draft",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1700,
        300
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendAndWait",
        "sendTo": "YOUR_EMAIL@example.com",
        "subject": "=Approve final draft: {{ $('Content Idea Intake').item.json['Idea / Topic'] }}",
        "message": "={{ $('Content Writer').item.json.output }}",
        "responseType": "approval",
        "approvalOptions": {
          "values": {
            "approvalType": "single"
          }
        },
        "options": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "wordpress_create",
      "name": "WordPress - Create Post",
      "type": "n8n-nodes-base.wordpress",
      "typeVersion": 1,
      "position": [
        1940,
        300
      ],
      "notes": "Add a WordPress credential (site URL + Application Password) before activating. status is set to draft; flip to publish when ready.",
      "parameters": {
        "resource": "post",
        "operation": "create",
        "title": "={{ $('Content Idea Intake').item.json['Idea / Topic'] }}",
        "additionalFields": {
          "content": "={{ $('Content Writer').item.json.output }}",
          "status": "draft"
        }
      }
    }
  ],
  "connections": {
    "Content Idea Intake": {
      "main": [
        [
          {
            "node": "Research Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "X Search (add API)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research Model": {
      "ai_languageModel": [
        [
          {
            "node": "Research Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity": {
      "ai_tool": [
        [
          {
            "node": "Research Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Research Agent": {
      "main": [
        [
          {
            "node": "Approve Research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve Research": {
      "main": [
        [
          {
            "node": "Outline Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outline Model": {
      "ai_languageModel": [
        [
          {
            "node": "Outline Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Outline Agent": {
      "main": [
        [
          {
            "node": "Approve Outline",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve Outline": {
      "main": [
        [
          {
            "node": "Content Writer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Writer Model": {
      "ai_languageModel": [
        [
          {
            "node": "Content Writer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Content Writer": {
      "main": [
        [
          {
            "node": "Approve Final Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve Final Draft": {
      "main": [
        [
          {
            "node": "WordPress - Create Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}