{
  "name": "Collect Physician Profiles with n8n (free workflow JSON)",
  "nodes": [
    {
      "id": "a1c3e5f7-2b4d-4f60-8a91-0c1d2e3f4a51",
      "name": "On-Demand Execution",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "31c3822d-20cf-446e-85fa-a676844918de",
      "name": "Define Location",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        0
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "0411384e-7a25-4aa3-b1e9-be72ce7a110c",
              "name": "City",
              "type": "string",
              "value": "Brooklyn"
            },
            {
              "id": "60b18157-88b0-41b1-bc21-ab83a3ae09d3",
              "name": "State",
              "type": "string",
              "value": "NY"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "cec08a88-a511-4720-9e72-5bf17d756dc3",
      "name": "Run BrowserAct Workflow",
      "type": "n8n-nodes-browseract.browserAct",
      "typeVersion": 1,
      "position": [
        480,
        0
      ],
      "parameters": {}
    },
    {
      "id": "0af9c556-6b8c-47d3-bab0-722de1127819",
      "name": "Splitting Items",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        0
      ],
      "parameters": {
        "jsCode": "// Get the JSON string using the exact path provided by the user.\nconst jsonString = $input.first().json.output.string;\n\nlet parsedData;\n\n// Check if the string exists before attempting to parse\nif (!jsonString) {\n    // Return an empty array or throw an error if no string is found\n    // Throwing an error is usually better to stop the workflow if data is missing.\n    throw new Error(\"Input string is empty or missing at the specified path: $input.first().json.output.string\");\n}\n\ntry {\n    // 1. Parse the JSON string into a JavaScript array of objects\n    parsedData = JSON.parse(jsonString);\n} catch (error) {\n    // Handle JSON parsing errors (e.g., if the string is malformed)\n    throw new Error(`Failed to parse JSON string: ${error.message}`);\n}\n\n// 2. Ensure the parsed data is an array\nif (!Array.isArray(parsedData)) {\n    throw new Error('Parsed data is not an array. It cannot be split into multiple items.');\n}\n\n// 3. Map the array of objects into the n8n item format { json: object }\n// Each element in this array will be treated as a new item by n8n, achieving the split.\nconst outputItems = parsedData.map(item => ({\n    json: item,\n}));\n\n// 4. Return the new array of items\nreturn outputItems;"
      }
    },
    {
      "id": "289cd4a1-bfc5-4827-8395-375e92847137",
      "name": "Update Leads",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        960,
        0
      ],
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "sheetName": {
          "__rl": true,
          "value": "Physician Profile",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      }
    },
    {
      "id": "c16f982d-e745-42fc-a438-e22d0eb03353",
      "name": "Alert Team",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        1200,
        0
      ],
      "executeOnce": true,
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "text": "=Physician profiles for {{ $('Define Location').first().json.City }}, {{ $('Define Location').first().json.State }} have been added to the \"Physician Profile\" sheet.",
        "otherOptions": {}
      }
    },
    {
      "id": "3f70263f-f704-4f7d-8802-2f56b13d5ce7",
      "name": "Setup Notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -360
      ],
      "parameters": {
        "width": 520,
        "height": 300,
        "content": "## Setup\n\n1. Add your own credentials: Google Sheets in **Update Leads**, Slack in **Alert Team**, BrowserAct in **Run BrowserAct Workflow**.\n2. In Google Sheets, create a tab named `Physician Profile` with the headers `Name`, `Address`, `Specialty`.\n3. Set **City** and **State** in **Define Location** (Brooklyn and NY are only examples).\n4. Click **Execute workflow**.\n\nSource: based on a template from n8n.io, documented by LeenLabs."
      }
    },
    {
      "id": "1ba59dc8-0198-4f02-8149-0582d433444b",
      "name": "BrowserAct Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        440,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 160,
        "content": "### BrowserAct step\n\nSelect your own BrowserAct extraction workflow and map City and State to its inputs.\n\nThe next node expects the result in `output.string`, as text containing a JSON list of physicians. Field names should match your sheet headers (Name, Address, Specialty)."
      }
    }
  ],
  "connections": {
    "On-Demand Execution": {
      "main": [
        [
          {
            "node": "Define Location",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Location": {
      "main": [
        [
          {
            "node": "Run BrowserAct Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run BrowserAct Workflow": {
      "main": [
        [
          {
            "node": "Splitting Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Splitting Items": {
      "main": [
        [
          {
            "node": "Update Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Leads": {
      "main": [
        [
          {
            "node": "Alert Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}