{
  "name": "YA-RE-08: Negative Keyword Recommendation Agent",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "08-negative-keyword-recommendation-agent",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        220,
        300
      ],
      "id": "node-wh-08",
      "name": "Webhook: Trigger Event"
    },
    {
      "parameters": {
        "jsCode": "// Privacy Sanitization & Context Preparation for Negative Keyword Recommendation Agent\nconst input = $input.first().json.body || $input.first().json;\nconst sanitizedPayload = { context: input.context || 'Real Estate Campaign Data', parameters: input.parameters || {} };\nreturn [{ json: { workflow_id: '08', raw_id: input.id || Date.now(), sanitized_prompt: JSON.stringify(sanitizedPayload) } }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        300
      ],
      "id": "node-code-08",
      "name": "Code: Privacy Sanitizer"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are an expert Real Estate Marketing Operations AI Agent specialized in 'Negative Keyword Recommendation Agent'.\nAnalyze the context below:\n{{ $json.sanitized_prompt }}\nProvide structured outputs with objective practitioner recommendations.",
        "hasOutputParser": true
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        660,
        300
      ],
      "id": "node-agent-08",
      "name": "AI Agent: Negative Keyword Recommendation Agent"
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {
          "temperature": 0.2
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        600,
        520
      ],
      "id": "node-model-08",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "jsonSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"summary\": { \"type\": \"string\" },\n    \"findings\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n    \"recommended_actions\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n  },\n  \"required\": [\"summary\", \"findings\", \"recommended_actions\"]\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.2,
      "position": [
        780,
        520
      ],
      "id": "node-parser-08",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://YOUR_INTERNAL_SERVICE_URL/api/v1/agent-output",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_SERVICE_API_KEY"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"workflow_id\": \"{{ $('Code: Privacy Sanitizer').item.json.workflow_id }}\",\n  \"output\": {{ JSON.stringify($json.output) }}\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        960,
        300
      ],
      "id": "node-http-08",
      "name": "HTTP: Forward Output"
    }
  ],
  "connections": {
    "Webhook: Trigger Event": {
      "main": [
        [
          {
            "node": "Code: Privacy Sanitizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Privacy Sanitizer": {
      "main": [
        [
          {
            "node": "AI Agent: Negative Keyword Recommendation Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent: Negative Keyword Recommendation Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent: Negative Keyword Recommendation Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent: Negative Keyword Recommendation Agent": {
      "main": [
        [
          {
            "node": "HTTP: Forward Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1.0.0",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "yehia-ahmed-re-playbook"
  },
  "tags": [
    {
      "name": "Google Ads"
    },
    {
      "name": "AI Agent"
    }
  ]
}