{
  "name": "AI Citation Monitor - ChatGPT + Perplexity + AI Overviews",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 7 * * 1"
            }
          ]
        }
      },
      "id": "schedule-trigger",
      "name": "Weekly Monday 7am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": { "__rl": true, "mode": "id", "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "Prompts",
        "options": {}
      },
      "id": "sheets-read-prompts",
      "name": "Read Target Prompts",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [220, 0],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets OAuth2"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "content": "Answer this question. If you know of specific brands, companies, or experts in this space, mention them by name with their website URL if you know it.\n\nQuestion: {{ $json.prompt }}",
              "role": "user"
            }
          ]
        },
        "options": {}
      },
      "id": "openai-chatgpt",
      "name": "Query ChatGPT",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1.2,
      "position": [440, 0],
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAI API"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.dataforseo.com/v3/serp/google/organic/live",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpBasicAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "[{\"keyword\": \"{{ $json.prompt }}\", \"location_code\": 2826, \"language_code\": \"en\", \"depth\": 10}]",
        "options": {}
      },
      "id": "dataforseo-aio",
      "name": "Check AI Overviews",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [440, 200],
      "credentials": {
        "httpBasicAuth": {
          "id": "YOUR_DATAFORSEO_CREDENTIAL_ID",
          "name": "DataForSEO API"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": { "__rl": true, "mode": "id", "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "ChatGPT Results",
        "columns": {
          "mappingMode": "autoMapInputData"
        }
      },
      "id": "sheets-chatgpt",
      "name": "Write ChatGPT Results",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [660, 0],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets OAuth2"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": { "__rl": true, "mode": "id", "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "AI Overview Results",
        "columns": {
          "mappingMode": "autoMapInputData"
        }
      },
      "id": "sheets-aio",
      "name": "Write AI Overview Results",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [660, 200],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets OAuth2"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "your@email.com",
        "subject": "Weekly AI Citation Monitor Report",
        "message": "Your weekly AI citation monitoring has completed. Check your Google Sheets for new ChatGPT citations, Perplexity citations, and AI Overview appearances."
      },
      "id": "email-node",
      "name": "Weekly Summary Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [880, 100],
      "credentials": {
        "smtp": {
          "id": "YOUR_SMTP_CREDENTIAL_ID",
          "name": "SMTP"
        }
      }
    }
  ],
  "connections": {
    "Weekly Monday 7am": {
      "main": [
        [
          { "node": "Read Target Prompts", "type": "main", "index": 0 }
        ]
      ]
    },
    "Read Target Prompts": {
      "main": [
        [
          { "node": "Query ChatGPT", "type": "main", "index": 0 },
          { "node": "Check AI Overviews", "type": "main", "index": 0 }
        ]
      ]
    },
    "Query ChatGPT": {
      "main": [
        [
          { "node": "Write ChatGPT Results", "type": "main", "index": 0 }
        ]
      ]
    },
    "Check AI Overviews": {
      "main": [
        [
          { "node": "Write AI Overview Results", "type": "main", "index": 0 }
        ]
      ]
    },
    "Write ChatGPT Results": {
      "main": [
        [
          { "node": "Weekly Summary Email", "type": "main", "index": 0 }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [],
  "triggerCount": 1
}
