{
  "name": "Competitor Watch → Google Sheets + AI Analysis",
  "description": "Runs No Niner's Competitor Monitor actor on a list of competitor domains, then passes the raw changes through an AI summariser and writes the digest to a Google Sheets tab. Fully automated — schedule it and forget it.",
  "nodes": [
    {
      "id": "sticky-setup",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [0, 80],
      "parameters": {
        "content": "## 🔧 Setup (3 steps)\n\n**1. Apify** — Add an HTTP Query Auth credential:\n- Name: `Apify Token`\n- Query parameter name: `token`\n- Value: your Apify API key (apify.com → Account → Integrations)\n\n**2. OpenAI** — Add an OpenAI credential with your API key.\n\n**3. Google Sheets** — Connect your Google account via OAuth2.\n\nThen open the **Google Sheets** node and set `documentId` to your sheet's ID.",
        "height": 280,
        "width": 340,
        "color": 7
      }
    },
    {
      "id": "sticky-how",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [0, 400],
      "parameters": {
        "content": "## ⚙️ How it works\n\nThis workflow runs **daily at midnight** and:\n\n1. Calls [No Niner's Competitor Monitor](https://apify.com/noniner/competitor-monitor) — a cloud actor that detects pricing changes, new features and content updates across your competitor domains.\n\n2. Sends the raw change data to **GPT-4o mini** for summarisation into a crisp bullet-point digest.\n\n3. Appends the digest + raw JSON to a **Google Sheets** tab.\n\n**Cost:** ~$0.01–0.10 per run depending on competitor count. No Apify subscription needed — pay per use.",
        "height": 280,
        "width": 340,
        "color": 5
      }
    },
    {
      "id": "1",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [400, 300],
      "parameters": {
        "rule": { "interval": [{ "field": "hours", "hoursInterval": 24 }] }
      }
    },
    {
      "id": "2",
      "name": "Competitor Monitor (No Niner)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [620, 300],
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/noniner~competitor-monitor/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            { "name": "token", "value": "={{ $credentials.apifyToken }}" },
            { "name": "maxItems", "value": "50" },
            { "name": "timeout", "value": "120" }
          ]
        },
        "contentType": "json",
        "body": {
          "domains": ["competitor1.com", "competitor2.com"],
          "trackPricing": true,
          "trackContent": true,
          "trackNewFeatures": true
        },
        "options": {}
      },
      "credentials": {
        "httpQueryAuth": { "id": "apify-token", "name": "Apify Token" }
      }
    },
    {
      "id": "3",
      "name": "AI Summariser",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [840, 300],
      "parameters": {
        "resource": "chat",
        "model": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a competitive intelligence analyst. Summarise the competitor changes below as a crisp bullet-point digest. Focus on pricing changes, new features, and content updates that signal strategic intent. Keep it under 300 words."
            },
            {
              "role": "user",
              "content": "={{ JSON.stringify($json) }}"
            }
          ]
        }
      }
    },
    {
      "id": "4",
      "name": "Write to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [1060, 300],
      "parameters": {
        "operation": "append",
        "documentId": { "__rl": true, "value": "YOUR_SHEET_ID", "mode": "id" },
        "sheetName": "Competitor Digest",
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Date":    "={{ $now.toFormat('yyyy-MM-dd') }}",
            "Digest":  "={{ $json.choices[0].message.content }}",
            "RawJSON": "={{ JSON.stringify($('Competitor Monitor (No Niner)').all()) }}"
          }
        },
        "options": {}
      }
    }
  ],
  "connections": {
    "Schedule Trigger":               { "main": [[{ "node": "Competitor Monitor (No Niner)", "type": "main", "index": 0 }]] },
    "Competitor Monitor (No Niner)":  { "main": [[{ "node": "AI Summariser", "type": "main", "index": 0 }]] },
    "AI Summariser":                  { "main": [[{ "node": "Write to Google Sheets", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "noniner-template-competitor-watch"
  }
}
