{
  "name": "Research people with Perplexity AI and log results to Google Sheets",
  "nodes": [
    {
      "id": "d9fe9c9c-0336-4146-82ff-38323a024f33",
      "name": "Get All Rows",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -2432,
        48
      ]
    },
    {
      "id": "da22e108-3c0a-415e-8853-73b810023e68",
      "name": "Filter — Pending Only",
      "type": "n8n-nodes-base.filter",
      "position": [
        -2224,
        48
      ]
    },
    {
      "id": "69b19172-da6d-403a-a0e8-509190cff583",
      "name": "Loop Over Rows",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -2000,
        48
      ]
    },
    {
      "id": "5af35002-68e8-47e9-85ed-78654f38c570",
      "name": "Set Status — Processing",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1792,
        64
      ]
    },
    {
      "id": "44e92705-608d-4fb9-b345-0a29d59a6646",
      "name": "Get Config Tab",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1568,
        64
      ]
    },
    {
      "id": "0287a14f-474e-4a3a-952e-62dfa5f03414",
      "name": "Build Dynamic Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        -1360,
        64
      ]
    },
    {
      "id": "53cf4ac3-46a0-4d19-a65d-2936f9319567",
      "name": "Perplexity — Research Call",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1152,
        64
      ]
    },
    {
      "id": "bf7da2fb-7917-4e7f-90d7-7ba3910ad67c",
      "name": "Parse Perplexity Response",
      "type": "n8n-nodes-base.code",
      "position": [
        -912,
        48
      ]
    },
    {
      "id": "1c26a085-d3e2-4c15-98ee-513daac1bd63",
      "name": "Map Fields to Sheet Columns",
      "type": "n8n-nodes-base.code",
      "position": [
        -704,
        48
      ]
    },
    {
      "id": "7b38f127-0f4e-41fe-aed9-bcecb58aedc9",
      "name": "Write Results to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -512,
        48
      ]
    },
    {
      "id": "044f9ae9-289f-4f64-a33e-6c8198eccc19",
      "name": "Any Fields Missing?",
      "type": "n8n-nodes-base.if",
      "position": [
        -320,
        48
      ]
    },
    {
      "id": "95c3e58e-ce5e-47be-b97e-decbde3ec7e5",
      "name": "Slack — Missing Fields Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -64,
        32
      ]
    },
    {
      "id": "5e8aa6f9-161e-49b6-b3a2-b5d7c9187bd5",
      "name": "Write Error to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -848,
        320
      ]
    },
    {
      "id": "dcaf2dc4-6ab2-4372-9d24-274564f24b70",
      "name": "Slack — API Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -688,
        320
      ]
    },
    {
      "id": "dc63b796-3e14-44ec-a50b-8739cae1cbff",
      "name": "When clicking 'Execute workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2608,
        48
      ]
    },
    {
      "id": "c09cf0a2-a99d-44f4-9d9e-8ff302437764",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3120,
        -256
      ],
      "parameters": {
        "width": 432,
        "height": 640,
        "content": "## Perplexity People Researcher\nAutomatically researches people from a Google Sheet using the Perplexity AI API and writes the results back to the same sheet.\n\n## What It Does\nAdd a name to your Googl"
      }
    },
    {
      "id": "541146bc-880f-438c-a20d-aae84e4aa7ce",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2512,
        -400
      ],
      "parameters": {
        "width": 656,
        "height": 432,
        "content": "## How To Use\nOpen your Google Sheet\nType a name in Column A\nSet Column B status to Pending\nRun the workflow — results appear in columns C through G automatically\n\nTo change what gets researched, edit"
      }
    },
    {
      "id": "7b306700-1fce-4496-936e-28fedf05d844",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        304
      ],
      "parameters": {
        "width": 288,
        "height": 224,
        "content": "## Error Handling\nIf Perplexity cannot find an answer for a field, the cell is written as \"Not found\" and a Slack alert is sent with the name and which fields were missing. If the API call fails entir"
      }
    },
    {
      "id": "e87c8fdc-8989-487b-bf7e-c46756fd982f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1664,
        -256
      ],
      "parameters": {
        "width": 480,
        "height": 288,
        "content": "## Creating and formating questions \n\nThe next few nodes are grabbing the status of the spreadsheet from pending to processing.\n\nThen taking the sheet called \"config tab\" which is where you will input"
      }
    },
    {
      "id": "4790c847-22b6-4628-a289-568aca3d2ea7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -192
      ],
      "parameters": {
        "width": 432,
        "height": 192,
        "content": "## Parse and write answers\n\nThose individual values are then mapped to their correct column headers, matching exactly what your sheet expects. The row number is carried through this entire process so "
      }
    },
    {
      "id": "9be4c5ae-f203-4f10-9564-703ac98374a8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -208
      ],
      "parameters": {
        "width": 288,
        "height": 224,
        "content": "## Error Handling\nSimilar to the other error log node this one will send a detailed slack message on what rows are experiencing the missing fields error. "
      }
    }
  ],
  "connections": {
    "Get All Rows": {
      "main": [
        [
          {
            "node": "Filter — Pending Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Config Tab": {
      "main": [
        [
          {
            "node": "Build Dynamic Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Rows": {
      "main": [
        [],
        [
          {
            "node": "Set Status — Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any Fields Missing?": {
      "main": [
        [
          {
            "node": "Slack — Missing Fields Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Dynamic Prompt": {
      "main": [
        [
          {
            "node": "Perplexity — Research Call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Error to Sheet": {
      "main": [
        [
          {
            "node": "Slack — API Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Results to Sheet": {
      "main": [
        [
          {
            "node": "Any Fields Missing?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter — Pending Only": {
      "main": [
        [
          {
            "node": "Loop Over Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Perplexity Response": {
      "main": [
        [
          {
            "node": "Map Fields to Sheet Columns",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Status — Processing": {
      "main": [
        [
          {
            "node": "Get Config Tab",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Fields to Sheet Columns": {
      "main": [
        [
          {
            "node": "Write Results to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity — Research Call": {
      "main": [
        [
          {
            "node": "Parse Perplexity Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Write Error to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Execute workflow'": {
      "main": [
        [
          {
            "node": "Get All Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}