{
  "id": "dY3d837LI6zH814n",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Track brand visibility on Perplexity and ChatGPT with BrowserAct & OpenRouter",
  "tags": [],
  "nodes": [
    {
      "id": "8eefc82b-5cad-4b7a-ab58-3f2802d84b68",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        304,
        192
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5df60446-12ec-42f6-920d-629801d95d12",
      "name": "Run a Perplexity Search",
      "type": "n8n-nodes-browseract.browserAct",
      "position": [
        1056,
        -128
      ],
      "parameters": {
        "type": "WORKFLOW",
        "workflowId": "76059068857656105",
        "workflowConfig": {
          "value": {
            "input-Search_Querry": "={{ $json.output.perplexity_query }}",
            "input-Target_Ai_Link": "https://www.perplexity.ai/"
          },
          "schema": [
            {
              "id": "input-Target_Ai_Link",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "Target_Ai_Link",
              "defaultMatch": true
            },
            {
              "id": "input-Search_Querry",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "Search_Querry",
              "defaultMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "input-Search_Querry"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "credentials": {
        "browserActApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "e48903d6-e743-4099-85d0-dc095bfc093c",
      "name": "Run ChatGPT Search",
      "type": "n8n-nodes-browseract.browserAct",
      "position": [
        1056,
        64
      ],
      "parameters": {
        "type": "WORKFLOW",
        "workflowId": "76059068857656105",
        "workflowConfig": {
          "value": {
            "input-Search_Querry": "={{ $json.output.chatgpt_query }}",
            "input-Target_Ai_Link": "https://chatgpt.com"
          },
          "schema": [
            {
              "id": "input-Target_Ai_Link",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "Target_Ai_Link",
              "defaultMatch": true
            },
            {
              "id": "input-Search_Querry",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "description": "If left blank, the default value defined in BrowserAct will be used.",
              "displayName": "Search_Querry",
              "defaultMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "input-Search_Querry"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "credentials": {
        "browserActApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "99a713af-5479-42c9-b551-f350d613518f",
      "name": "OpenRouter Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1712,
        144
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "af4a6f5f-fa71-4b07-aa6d-c6f19d984fdb",
      "name": "Weekly Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -96,
        -16
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "faec4726-613c-45d2-bd95-935c31bce465",
      "name": "Add Brand & Description",
      "type": "n8n-nodes-base.set",
      "position": [
        112,
        -16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fe0c6b09-c38f-4f7b-9f94-68748c17edf2",
              "name": "Brand",
              "type": "string",
              "value": "BrowserAct Automation"
            },
            {
              "id": "e7f0e590-c811-4d59-9ad1-21154d33d0b7",
              "name": "Description",
              "type": "string",
              "value": "A headless browser automation tool for AI agents that handles captchas and deep scraping."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "54df6e82-7efd-4f40-a1f9-e84d3569cf18",
      "name": "Wait for both paths",
      "type": "n8n-nodes-base.merge",
      "position": [
        1328,
        -48
      ],
      "parameters": {
        "mode": "chooseBranch"
      },
      "typeVersion": 3.2
    },
    {
      "id": "c5c836d4-71eb-4aaa-9643-d4259d071363",
      "name": "Analyze both results & generate report",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1728,
        -48
      ],
      "parameters": {
        "text": "=perplexity_query : {{ $('Generate search queries').first().json.output.perplexity_query }},\nchatgpt_query : {{ $('Generate search queries').first().json.output.chatgpt_query }},\nBrand : {{ $('Add Brand & Description').first().json.Brand }}\nDescription : {{ $('Add Brand & Description').first().json.Description }},\n\n-------------------------------\n\nChatGPt Search Result : {{ $('Run ChatGPT Search').first().json.output.string }}\nPerplexity Search Result : {{ $('Run a Perplexity Search').first().json.output.string }}\n",
        "options": {
          "systemMessage": "### ROLE\nYou are a GEO (Generative Engine Optimization) Analyst. Your job is to review search results from Perplexity and ChatGPT and determine if a specific brand is being recommended.\n\n### INPUT DATA\n- Brand Name: {{ $json.brand_name }}\n- Brand Description: {{ $json.brand_description }}\n- Perplexity Result: {{ $json.perplexity_result_text }}\n- ChatGPT Result: {{ $json.chatgpt_result_text }}\n\n### ANALYSIS LOGIC\n1. **Scan:** Look for the [Brand Name] in both search results.\n2. **Judge:**\n   - **VISIBLE:** The brand is explicitly named or recommended.\n   - **INVISIBLE:** The brand is not mentioned at all.\n   - **HALLUCINATED:** The brand is mentioned but with incorrect details.\n3. **Sentiment:** Is the mention Positive, Neutral, or Negative?\n\n### OUTPUT FORMAT\nReturn **ONLY** a raw JSON object (no markdown, no ```json ``` blocks).\nThe JSON must contain two parts:\n1. `data`: Structured fields for your database.\n2. `slack_message`: A beautifully formatted string using Slack markdown (*bold*, emoji, > quotes) ready to post.\n\n### EXAMPLE OUTPUT STRUCTURE\n{\n  \"data\": {\n    \"perplexity_visible\": true,\n    \"chatgpt_visible\": false,\n    \"overall_sentiment\": \"Positive\"\n  },\n  \"slack_message\": \":rotating_light: *GEO Visibility Report: [Brand Name]*\\n\\n*Perplexity AI Check:*\\n:white_check_mark: *VISIBLE* - It ranked as #2.\\n> \\\"[Brand] is a top contender for...\\\"\\n\\n*ChatGPT Check:*\\n:x: *NOT FOUND* - It recommended competitors instead.\\n\\n*Action Item:* Review competitor feature lists.\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "4c0173da-d145-489c-a4cf-5bbe0b13cc76",
      "name": "Structured Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        464,
        176
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n  \"perplexity_query\": \"Top rated team communication platforms for enterprise 2025 features and pricing\",\n  \"chatgpt_query\": \"I am managing a remote team and need to replace email. How does Slack compare to Microsoft Teams for project management?\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0be5bcdf-bc5e-4705-8c87-3fe9edcc3f43",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1872,
        144
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n  \"data\": {\n    \"perplexity_visible\": true,\n    \"chatgpt_visible\": false,\n    \"overall_sentiment\": \"Positive\"\n  },\n  \"slack_message\": \":rotating_light: *GEO Visibility Report: [Brand Name]*\\n\\n*Perplexity AI Check:*\\n:white_check_mark: *VISIBLE* - It ranked as #2.\\n> \\\"[Brand] is a top contender for...\\\"\\n\\n*ChatGPT Check:*\\n:x: *NOT FOUND* - It recommended competitors instead.\\n\\n*Action Item:* Review competitor feature lists.\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "ac87fffe-38f5-4b70-9ce3-d7a694d8f4b2",
      "name": "Send team update",
      "type": "n8n-nodes-base.slack",
      "position": [
        2256,
        -48
      ],
      "parameters": {
        "text": "={{ $json.output.slack_message}}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09KLV9DJSX",
          "cachedResultName": "all-browseract-workflow-test"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "a21d578e-6e5f-435a-a5b9-e95fd119be4c",
      "name": "Generate search queries",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        320,
        -16
      ],
      "parameters": {
        "text": "=Brand :  {{ $json.Brand }},\nDescription  : {{ $json.Description }}",
        "options": {
          "systemMessage": "### ROLE\nYou are a GEO (Generative Engine Optimization) Specialist.\n\n### TASK\nReceive a Brand Name and Description. Generate exactly TWO high-intent search queries to test the brand's visibility on different AI platforms.\n\n1. **Perplexity Query:** Focus on recent data, features, and \"best of\" lists. (Perplexity acts like a research engine).\n2. **ChatGPT Query:** Focus on conversational advice, scenarios, and implementation. (ChatGPT acts like a consultant).\n\n### OUTPUT RULES\n- Output **ONLY** a raw JSON object.\n- **CRITICAL:** Do NOT wrap the output in markdown code blocks (e.g., do NOT use ```json ... ```).\n- Do NOT include any introductory text or explanations. Just the JSON string.\n\n### EXAMPLE STRUCTURE\nInput:\nBrand: \"Slack\"\nDescription: \"Team communication platform.\"\n\nOutput:\n{\n  \"perplexity_query\": \"Top rated team communication platforms for enterprise 2025 features and pricing\",\n  \"chatgpt_query\": \"I am managing a remote team and need to replace email. How does Slack compare to Microsoft Teams for project management?\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "64a536e0-7532-45d3-b3dc-4a8926c9cd33",
      "name": "Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -592
      ],
      "parameters": {
        "width": 380,
        "height": 520,
        "content": "## \u26a1 Workflow Overview & Setup\n\n**Summary:** This automation acts as a \"GEO\" (Generative Engine Optimization) Tracker. It monitors how your brand appears in AI search engines (Perplexity & ChatGPT) by simulating real user queries and analyzing the visibility of your product.\n\n### Requirements\n* **Credentials:** BrowserAct, OpenRouter (GPT-4), Slack.\n* **Mandatory:** BrowserAct API (Template: **AI Search Visibility Tracker (Perplexity & ChatGPT)**)\n\n### How to Use\n1.  **Credentials:** Set up API keys for BrowserAct, OpenRouter, and Slack.\n2.  **BrowserAct Template:** Ensure you have the **AI Search Visibility Tracker (Perplexity & ChatGPT)** template saved in your BrowserAct account.\n3.  **Configuration:** Update the **Add Brand & Description** node with your specific Company Name and Value Proposition.\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": "064d19fc-a89b-4462-95fa-d4dbf3f17f10",
      "name": "Step 1 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -224
      ],
      "parameters": {
        "color": 7,
        "width": 684,
        "content": "### \ud83c\udfaf Step 1: Strategy & Query Generation\n\nThe workflow starts by defining your brand profile.\n\nAn AI agent analyzes your brand description and generates two distinct high-intent search queries:\n1.  **Research Query** (for Perplexity)\n2.  **Conversational Query** (for ChatGPT)"
      },
      "typeVersion": 1
    },
    {
      "id": "c2cd2565-dab4-4c76-8d02-56d33e3789f0",
      "name": "Step 2 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 140,
        "content": "### \ud83d\udd75\ufe0f Step 2: Parallel Search Execution\n\nBrowserAct executes the generated queries on both platforms simultaneously.\n\nIt navigates to Perplexity and ChatGPT, inputs the questions, and scrapes the full AI-generated answers to capture exactly what potential customers are seeing."
      },
      "typeVersion": 1
    },
    {
      "id": "58262d8f-bdc4-4321-a9f2-1f3bf906ba79",
      "name": "Step 3 Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 732,
        "height": 140,
        "content": "### \ud83e\udde0 Step 3: Visibility & Sentiment Analysis\n\nA \"GEO Analyst\" AI reviews the scraped results.\n\nIt determines if your brand was **Visible** (recommended), **Invisible** (ignored), or **Hallucinated** (incorrect facts). It also gauges the sentiment of the mention, then the findings are formatted into a clean Slack report."
      },
      "typeVersion": 1
    },
    {
      "id": "f29fb04d-1620-4129-8882-b7dfe9341ab8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -592
      ],
      "parameters": {
        "color": 6,
        "width": 608,
        "height": 352,
        "content": "@[youtube](lH-uMJYQIJ4)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9e46706a-642a-4fb2-a86e-7223d9ce49a4",
  "connections": {
    "Weekly Trigger": {
      "main": [
        [
          {
            "node": "Add Brand & Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output": {
      "ai_outputParser": [
        [
          {
            "node": "Generate search queries",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Run ChatGPT Search": {
      "main": [
        [
          {
            "node": "Wait for both paths",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Wait for both paths": {
      "main": [
        [
          {
            "node": "Analyze both results & generate report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate search queries",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze both results & generate report",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Add Brand & Description": {
      "main": [
        [
          {
            "node": "Generate search queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate search queries": {
      "main": [
        [
          {
            "node": "Run a Perplexity Search",
            "type": "main",
            "index": 0
          },
          {
            "node": "Run ChatGPT Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run a Perplexity Search": {
      "main": [
        [
          {
            "node": "Wait for both paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze both results & generate report",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Analyze both results & generate report": {
      "main": [
        [
          {
            "node": "Send team update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}