{
  "name": "Track share of AI voice across Local Falcon scans",
  "nodes": [
    {
      "parameters": {
        "content": "## Track Share of AI Voice Across Local Falcon Scans\n\n**Who is this for:** SEO professionals and agencies who need to measure and report on AI search visibility metrics, particularly for clients concerned about their presence in ChatGPT, Gemini, and AI Overviews.\n\n**What this workflow does:**\n1. Fetches recent scan reports filtered by AI platforms\n2. Calculates Share of AI Voice (SAIV) - the percentage of scans where you appear\n3. Tracks visibility trends across different AI search engines\n4. Sends weekly summary with SAIV metrics to Slack\n\n**How to set up:**\n1. Add your Local Falcon API credentials (get your key at https://www.localfalcon.com/api/credentials)\n2. Connect your Slack workspace\n3. Configure the platforms to track in Settings node\n4. Set up a schedule (default: weekly on Mondays)\n5. Activate the workflow\n\n**Requirements:**\n- Local Falcon account with API access\n- Existing scans on AI platforms (ChatGPT, Gemini, GAIO, etc.)\n- Slack workspace\n\n**How to customize:**\n- Filter by specific locations or keywords\n- Add Google Sheets logging for historical tracking\n- Create separate alerts for each platform\n- Set threshold alerts when SAIV drops below a target",
        "height": 560,
        "width": 460,
        "color": 5
      },
      "id": "sticky-main",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        100,
        -200
      ]
    },
    {
      "parameters": {
        "content": "### What is Share of AI Voice (SAIV)?\n\nSAIV measures what percentage of AI search results include your business. Unlike traditional rankings, AI platforms either mention you or they don't.\n\n**Example:**\n- 100 ChatGPT queries about \"pizza near me\"\n- Your business mentioned in 35 responses\n- SAIV = 35%\n\nHigher SAIV = More AI visibility",
        "height": 240,
        "width": 320
      },
      "id": "sticky-context",
      "name": "Sticky Note Context",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        580,
        -200
      ]
    },
    {
      "parameters": {
        "content": "### Step 1: Schedule\nRuns weekly. Adjust frequency as needed.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        40,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 2: Settings\nConfigure platforms and notification channel.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        300,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 3: Fetch Reports\nGets scan data from AI platforms.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        560,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 4: Calculate SAIV\nComputes visibility percentages.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step4",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        820,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 5: Send Report\nDelivers SAIV summary to Slack.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1080,
        680
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 9
            }
          ]
        }
      },
      "id": "schedule",
      "name": "Every Monday 9am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        140,
        460
      ]
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "{\n  \"platforms\": \"chatgpt,gemini,gaio,grok,aimode\",\n  \"reportLimit\": 100,\n  \"slackChannel\": \"#seo-reports\",\n  \"targetSAIV\": 30\n}",
        "options": {}
      },
      "id": "settings",
      "name": "SAIV Settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        400,
        460
      ]
    },
    {
      "parameters": {
        "resource": "scan",
        "operation": "listReports",
        "additionalFields": {
          "limit": "={{ $json.reportLimit }}",
          "platform": "={{ $json.platforms }}"
        }
      },
      "id": "get-reports",
      "name": "Fetch AI Platform Reports",
      "type": "@local-falcon/n8n-nodes-localfalcon.localFalcon",
      "typeVersion": 1,
      "position": [
        660,
        460
      ],
      "credentials": {
        "localFalconApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const settings = $('SAIV Settings').first().json;\nconst reports = $input.first().json.reports || [];\n\n// Group reports by platform\nconst platformStats = {};\nconst platformNames = {\n  'chatgpt': 'ChatGPT',\n  'gemini': 'Gemini',\n  'gaio': 'Google AI Overview',\n  'grok': 'Grok',\n  'aimode': 'AI Mode'\n};\n\nfor (const report of reports) {\n  const platform = report.platform || 'unknown';\n  \n  if (!platformStats[platform]) {\n    platformStats[platform] = {\n      total: 0,\n      visible: 0,\n      avgRank: []\n    };\n  }\n  \n  platformStats[platform].total++;\n  \n  // Consider \"visible\" if avg_rank exists and is <= 20\n  const avgRank = parseFloat(report.avg_rank);\n  if (avgRank && avgRank <= 20) {\n    platformStats[platform].visible++;\n    platformStats[platform].avgRank.push(avgRank);\n  }\n}\n\n// Calculate SAIV for each platform\nlet message = `:chart_with_upwards_trend: *Weekly Share of AI Voice Report*\\n`;\nmessage += `_${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}_\\n\\n`;\n\nlet overallVisible = 0;\nlet overallTotal = 0;\n\nfor (const [platform, stats] of Object.entries(platformStats)) {\n  const saiv = stats.total > 0 ? ((stats.visible / stats.total) * 100).toFixed(1) : 0;\n  const avgRank = stats.avgRank.length > 0 \n    ? (stats.avgRank.reduce((a, b) => a + b, 0) / stats.avgRank.length).toFixed(1)\n    : 'N/A';\n  \n  const platformName = platformNames[platform] || platform;\n  const emoji = parseFloat(saiv) >= settings.targetSAIV ? ':white_check_mark:' : ':warning:';\n  \n  message += `${emoji} *${platformName}*\\n`;\n  message += `   SAIV: ${saiv}% | Avg Rank: ${avgRank} | Scans: ${stats.total}\\n\\n`;\n  \n  overallVisible += stats.visible;\n  overallTotal += stats.total;\n}\n\nconst overallSAIV = overallTotal > 0 ? ((overallVisible / overallTotal) * 100).toFixed(1) : 0;\nmessage += `---\\n*Overall SAIV: ${overallSAIV}%* (Target: ${settings.targetSAIV}%)`;\n\nreturn [{\n  json: {\n    slackMessage: message,\n    slackChannel: settings.slackChannel,\n    overallSAIV: parseFloat(overallSAIV),\n    platformStats\n  }\n}];"
      },
      "id": "calculate-saiv",
      "name": "Calculate SAIV Metrics",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        920,
        460
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.slackChannel }}"
        },
        "text": "={{ $json.slackMessage }}",
        "otherOptions": {}
      },
      "id": "slack",
      "name": "Send SAIV Report",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1180,
        460
      ],
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Every Monday 9am": {
      "main": [
        [
          {
            "node": "SAIV Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SAIV Settings": {
      "main": [
        [
          {
            "node": "Fetch AI Platform Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch AI Platform Reports": {
      "main": [
        [
          {
            "node": "Calculate SAIV Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate SAIV Metrics": {
      "main": [
        [
          {
            "node": "Send SAIV Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}