{
  "id": "pWTmhRYCJDnpiG8S",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Track AI search rankings from Perplexity & BrowserAct to Google Sheets and Slack",
  "tags": [],
  "nodes": [
    {
      "id": "0199740a-c4c1-4916-893a-172484d35ccf",
      "name": "OpenRouter",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -848,
        608
      ],
      "parameters": {
        "model": "google/gemini-3-pro-preview",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0e3f21f9-0735-4983-a98a-86209b085752",
      "name": "Structured Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -736,
        608
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n  \"query_discovery\": \"What is the best CRM for small sales teams in 2025?\",\n  \"query_comparison\": \"Pipedrive vs Salesforce for startups\",\n  \"query_validation\": \"Is Pipedrive good for visual pipeline management?\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "054687cb-ca9f-4bde-9f1a-5e7ebb062e5f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -192,
        400
      ],
      "parameters": {
        "options": {}
      },
      "executeOnce": false,
      "typeVersion": 3
    },
    {
      "id": "d6e424e6-280c-4916-a71d-80a948d410f1",
      "name": "Create sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1664,
        400
      ],
      "parameters": {
        "title": "={{ $json[\"Readable date\"] }}",
        "options": {},
        "operation": "create",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA/edit?usp=drivesdk",
          "cachedResultName": "GEO Results & Rank Tracking"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "6cdad070-f29d-4d65-a8db-5453fa3f996b",
      "name": "add headers",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1264,
        400
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create sheet').first().json.sheetId }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA/edit?usp=drivesdk",
          "cachedResultName": "GEO Results & Rank Tracking"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "9915a04c-7301-42e9-ac37-7b606b6ac788",
      "name": "OpenRouter1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        464,
        336
      ],
      "parameters": {
        "model": "google/gemini-3-pro-preview",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c778d45e-5544-43e0-9e67-aa7507e6ff7a",
      "name": "Get Company data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1072,
        400
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA/edit#gid=0",
          "cachedResultName": "Main Sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA/edit?usp=drivesdk",
          "cachedResultName": "GEO Results & Rank Tracking"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "133bef13-d860-4760-9619-ddadbf2ccdb7",
      "name": "Company data analyzer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        464,
        176
      ],
      "parameters": {
        "text": "=Date : {{ $('Scheduled Daily').first().json[\"Readable date\"] }},\nCompany name : {{ $('Get Company data').first().json[\"Company name\"] }},\nWorking Category :{{ $('Get Company data').first().json[\"Worknig category\"] }}\nquestion and answers : {{ $json.data }}",
        "options": {
          "systemMessage": "=You are a Senior GEO Analyst. Your job is to take raw search engine results and turn them into a clean, strategic Slack update.\n\nRULES:\n- Use Slack-compatible formatting (single asterisks for bold, > for blockquotes).\n- Do NOT use markdown headers (#).\n- Use emojis (\ud83d\udd34 \ud83d\udfe1 \ud83d\udfe2) to grade the results.\n- Keep the tone professional but direct.\n- Your output must be the final Slack message text only.\n\nREPORT STRUCTURE:\n1. \ud83d\udea8 DAILY GEO REPORT: [Company Name]\n2. SCORECARD (Grade the 3 queries)\n3. DEEP DIVE (Brief analysis of why we passed/failed)\n4. RECOMMENDATION (One specific action item)"
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "3241f234-62e8-498a-8970-de68b0959630",
      "name": "Define Headers",
      "type": "n8n-nodes-base.set",
      "position": [
        -1456,
        400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2a55efd3-2bd4-40f1-a9e1-6953593a2b6d",
              "name": "Search",
              "type": "string",
              "value": ""
            },
            {
              "id": "9584ab62-f067-4671-853b-912526197bf8",
              "name": "Result",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "970f6775-cc1e-4d5c-9866-403da9c24bf6",
      "name": "Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2256,
        -176
      ],
      "parameters": {
        "width": 380,
        "height": 516,
        "content": "## \u26a1 Workflow Overview & Setup\n\n**Summary:** Automate Generative Engine Optimization (GEO) tracking by simulating strategic user queries on AI search engines, logging results to Google Sheets, and delivering a graded performance analysis via Slack.\n\n### Requirements\n* **Credentials:** BrowserAct, OpenRouter (Gemini), Google Sheets, Slack.\n* **Mandatory:** BrowserAct API (Template: **GEO Results & Rank Tracking**)\n\n### How to Use\n1. **Credentials:** Set up all API keys in the n8n credentials section.\n2. **BrowserAct Template:** Ensure you have the **GEO Results & Rank Tracking** template saved in your BrowserAct account.\n3. **Google Sheets:** \n    * **Main Sheet:** Must contain columns `Company name` and `Working Category`.\n    * **Tracking Sheet:** The workflow will automatically create new sheets for daily results.\n\n### Need Help?\n[How to Find Your BrowserAct API Key & Workflow ID](https://docs.browseract.com)\n[How to Connect n8n to BrowserAct](https://docs.browseract.com)\n[How to Use & Customize BrowserAct Templates](https://docs.browseract.com)"
      },
      "typeVersion": 1
    },
    {
      "id": "3df348a1-caa7-4d1e-8ad8-d5cc2f35957d",
      "name": "Step 1 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 1212,
        "height": 124,
        "content": "### \ud83c\udfaf Step 1: Strategy Generation\n\nThe workflow initializes a new dated Google Sheet for tracking. It then retrieves the target company's profile and uses AI to generate three distinct search queries (Discovery, Comparison, Validation) to test brand visibility on AI engines."
      },
      "typeVersion": 1
    },
    {
      "id": "5d48853b-ed23-4573-bda3-4daf82874489",
      "name": "Step 2 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        672
      ],
      "parameters": {
        "color": 7,
        "width": 804,
        "height": 152,
        "content": "### \ud83e\udd16 Step 2: Execution & Logging\n\nThe system iterates through the generated queries, triggering a BrowserAct automation to perform the actual searches. The raw answers from the search engine are then appended to the daily tracking sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "9f6905b5-e922-4f2b-94b8-f14a5f678e3f",
      "name": "Step 3 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 824,
        "height": 172,
        "content": "### \ud83d\udcca Step 3: Analysis & Reporting\n\nOnce all searches are complete, the workflow aggregates the results. A secondary AI agent analyzes the data to create a \"GEO Scorecard,\" grading the company's visibility and providing actionable recommendations via Slack."
      },
      "typeVersion": 1
    },
    {
      "id": "94eaa16b-5a05-4056-96dc-056dd5e06eaa",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        -176
      ],
      "parameters": {
        "color": 6,
        "width": 640,
        "height": 368,
        "content": "@[youtube](intc38qZ-68)"
      },
      "typeVersion": 1
    },
    {
      "id": "a50eb679-e33e-4d4a-97bb-31ce75950c6d",
      "name": "Store Extracted Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        240,
        464
      ],
      "parameters": {
        "columns": {
          "value": {
            "Result": "={{ $json.output.string }}",
            "Search": "={{ $('Loop Over Items').item.json.output }}"
          },
          "schema": [
            {
              "id": "Search",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Search",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Result",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Result",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create sheet').first().json.sheetId }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA/edit?usp=drivesdk",
          "cachedResultName": "GEO Results & Rank Tracking"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "788ef6bf-9854-4ccf-8e8b-176f177ccd5a",
      "name": "Retrieve Stored Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        32,
        176
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create sheet').first().json.sheetId }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ncrv123uXTUTCvEK_0lQvpWvQcoTQt5gJpoF8XpUyDA/edit?usp=drivesdk",
          "cachedResultName": "GEO Results & Rank Tracking"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "b266363f-181c-4d4c-80f1-454a71769d12",
      "name": "Send Message to Team on Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        784,
        176
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09KLV9DJSX",
          "cachedResultName": "all-browseract-workflow-test"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "f5e9e6f4-47e0-4845-859a-56fcec38cf46",
      "name": "Run GEO Results & Rank Tracking workflow",
      "type": "n8n-nodes-browseract.browserAct",
      "position": [
        32,
        416
      ],
      "parameters": {
        "type": "WORKFLOW",
        "workflowId": "7+1234567890",
        "workflowConfig": {
          "value": {
            "input-Inputs": "={{ $json.output }}"
          },
          "schema": [
            {
              "id": "input-perplexity",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "perplexity",
              "defaultMatch": true
            },
            {
              "id": "input-Inputs",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "Inputs",
              "defaultMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "input-Inputs"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "open_incognito_mode": false
      },
      "credentials": {
        "browserActApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "edc51c25-2fbd-42a5-9da5-3957d0bcbee9",
      "name": "Split AI-Generated Questions",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -416,
        400
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output"
      },
      "typeVersion": 1
    },
    {
      "id": "52cba85c-5e5e-4502-833e-0a71f228b024",
      "name": "Scheduled Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1840,
        400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "8d359c31-42a1-401d-9df4-c4cc269758ca",
      "name": "Generate Search Queries",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -848,
        400
      ],
      "parameters": {
        "text": "=Company name : {{ $json[\"Company name\"] }},\nWorking Category :{{ $json[\"Worknig category\"] }}",
        "options": {
          "systemMessage": "You are a GEO (Generative Engine Optimization) Strategy Expert. Your goal is to generate 3 distinct, high-impact search queries that a user might type into an AI Answer Engine (like Perplexity or ChatGPT) to find a product in a specific category.\n\nI will provide you with a {{Company Name}} and a {{Category}}.\n\nYou must return exactly 3 queries. Each query must target a different \"Intent Phase\" of the buyer's journey:\n\n1. QUERY 1 (Broad Discovery): A generic question asking for the best tools in the {{Category}} for a specific persona (e.g., \"small business,\" \"startups,\" or \"enterprise\"). Do NOT mention the {{Company Name}} here. We want to see if the AI organically recommends it.\n\n2. QUERY 2 (Direct Comparison): A \"Vs.\" query comparing the {{Company Name}} against the single biggest competitor in that industry (e.g., Salesforce, HubSpot, Jira, Slack). If you don't know the specific competitor, use a generic industry giant.\n\n3. QUERY 3 (Specific Validation): A natural language question asking \"What is {{Company Name}}?\" or \"Is {{Company Name}} good for [specific task]?\" to test if the AI hallucinates or provides accurate facts.\n\n**OUTPUT RULES:**\n- Return ONLY a valid JSON object with no Markdown formatting.\n- The JSON keys must be \"query_discovery\", \"query_comparison\", and \"query_validation\".\n- Do not add conversational filler.\n\nOutput structure example :\n{\n  \"query_discovery\": \"What is the best CRM for small sales teams in 2025?\",\n  \"query_comparison\": \"Pipedrive vs Salesforce for startups\",\n  \"query_validation\": \"Is Pipedrive good for visual pipeline management?\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "681225fe-038f-4a19-a5e5-393db5301861",
      "name": "Aggregate Google Sheet Rows",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        256,
        176
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4ce7a3e5-d26a-423e-9978-d4064a352b75",
  "connections": {
    "OpenRouter": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Search Queries",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter1": {
      "ai_languageModel": [
        [
          {
            "node": "Company data analyzer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "add headers": {
      "main": [
        [
          {
            "node": "Get Company data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create sheet": {
      "main": [
        [
          {
            "node": "Define Headers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Headers": {
      "main": [
        [
          {
            "node": "add headers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Retrieve Stored Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Run GEO Results & Rank Tracking workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scheduled Daily": {
      "main": [
        [
          {
            "node": "Create sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Company data": {
      "main": [
        [
          {
            "node": "Generate Search Queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Search Queries",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Stored Data": {
      "main": [
        [
          {
            "node": "Aggregate Google Sheet Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Extracted Data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Company data analyzer": {
      "main": [
        [
          {
            "node": "Send Message to Team on Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Search Queries": {
      "main": [
        [
          {
            "node": "Split AI-Generated Questions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Google Sheet Rows": {
      "main": [
        [
          {
            "node": "Company data analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split AI-Generated Questions": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run GEO Results & Rank Tracking workflow": {
      "main": [
        [
          {
            "node": "Store Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}