{
  "id": "qmhqkZH8DhISWMmc",
  "meta": {
    "instanceId": "7a1d1fd830bae2a00010153cf810fd67e0c87b8ae64ceb62273c87183efda365",
    "templateCredsSetupCompleted": true
  },
  "name": "N8N + Browser Use Cloud API",
  "tags": [],
  "nodes": [
    {
      "id": "81166dab-eb91-4627-b773-1aa7f7bd86ee",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -480,
        176
      ],
      "webhookId": "025bc4bf-00c0-47d4-bd5f-79046674d017",
      "parameters": {
        "path": "get-research-data",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "b38737cc-0b8a-4a76-930f-362eb5de9ef9",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -256,
        176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8d9701b6-1dc2-4e55-9fe4-ef1735ff1ebc",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.body.payload.status }}",
              "rightValue": "finished"
            },
            {
              "id": "7cf18a23-f3d8-4a70-a77c-c286a231fc7f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.body.payload.metadata.source }}",
              "rightValue": "n8n-competitor-demo"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fcfc33dd-7d8a-460b-838d-955c65416aea",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -336,
        -64
      ],
      "webhookId": "b2712d5b-14ae-424b-8733-fe6e77cebd43",
      "parameters": {
        "options": {},
        "formTitle": "Run Competitor Analysis",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Competitor Name",
              "placeholder": "(e.g. OpenAI)",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d10bef40-e2a3-41ff-a507-4f365c13dc52",
      "name": "BrowserUse Run Task",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -112,
        -64
      ],
      "parameters": {
        "url": "https://api.browser-use.com/api/v1/run-task",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"task\": \"Do exhaustive research on {{ $json['Competitor Name'] }} and extract all pricing information, job postings, new features and announcements\",\n  \"save_browser_data\": true,\n  \"structured_output_json\": \"{\\n  \\\"pricing\\\": {\\n    \\\"plans\\\": [\\\"string\\\"],\\n    \\\"prices\\\": [\\\"string\\\"],\\n    \\\"features\\\": [\\\"string\\\"]\\n  },\\n  \\\"jobs\\\": {\\n    \\\"titles\\\": [\\\"string\\\"],\\n    \\\"departments\\\": [\\\"string\\\"],\\n    \\\"locations\\\": [\\\"string\\\"]\\n  },\\n  \\\"new_features\\\": {\\n    \\\"titles\\\": [\\\"string\\\"],\\n    \\\"description\\\": [\\\"string\\\"]\\n  },\\n  \\\"announcements\\\": {\\n    \\\"titles\\\": [\\\"string\\\"],\\n    \\\"description\\\": [\\\"string\\\"]\\n  }\\n}\",\n\"metadata\": {\"source\": \"n8n-competitor-demo\"}\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "credential-id",
          "name": "httpBearerAuth Credential"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e49c28ff-11a2-4195-94ab-ca5796572c34",
      "name": "Get Task details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        144
      ],
      "parameters": {
        "url": "=https://api.browser-use.com/api/v1/task/{{ $('Webhook').item.json.body.payload.session_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "credential-id",
          "name": "httpBearerAuth Credential"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "54bc087d-237d-438a-b688-bcbec25d9c45",
      "name": "Generate Slack message",
      "type": "n8n-nodes-base.code",
      "position": [
        208,
        144
      ],
      "parameters": {
        "jsCode": "const output_data = $input.first().json.output;\nconst data = JSON.parse(output_data);\n\nconst pricing = data?.pricing;\nconst jobs = data?.jobs;\nconst newFeatures = data?.new_features;\nconst announcements = data?.announcements;\n\n// Helper function to format arrays as bullet points\nconst formatAsBullets = (arr, prefix = \"• \") => {\n  if (!arr || arr.length === 0) return \"• N/A\";\n  return arr.map(item => `${prefix}${item}`).join(\"\\n\");\n};\n\nreturn {\n  text: `🏷️ *Pricing*\nPlans:\n${formatAsBullets(pricing?.plans)}\n\nPrices:\n${formatAsBullets(pricing?.prices)}\n\nFeatures:\n${formatAsBullets(pricing?.features)}\n\n💼 *Jobs*\nTitles:\n${formatAsBullets(jobs?.titles)}\n\nDepartments:\n${formatAsBullets(jobs?.departments)}\n\nLocations:\n${formatAsBullets(jobs?.locations)}\n\n✨ *New Features*\nTitles:\n${formatAsBullets(newFeatures?.titles)}\n\nDescription:\n${formatAsBullets(newFeatures?.description)}\n\n📢 *Announcements*\n${formatAsBullets(announcements?.description)}`\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "969a16f0-677b-4e46-a8bb-57a80b5daf07",
      "name": "Send to Slack",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        144
      ],
      "parameters": {
        "url": "",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f3b38678-4821-41ad-952c-df9bbba40fc8",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Task details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Task details": {
      "main": [
        [
          {
            "node": "Generate Slack message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "BrowserUse Run Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Slack message": {
      "main": [
        [
          {
            "node": "Send to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}