{
  "id": "gYkswdSic8vl1xep",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automated LinkedIn Profile Summaries with GPT-4o and Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "ca40e73d-6f9b-4050-bc06-f1b3a62ea705",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1400,
        220
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "4f28b3ca-5e23-4309-984d-5c2951c4f3eb",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        -260
      ],
      "parameters": {
        "width": 280,
        "height": 420,
        "content": "## Configuration needed!\nIn order to get LinkedIn profiles, you need API. We use Real-Time LinkedIn Scraper API from RapidAPI. \n\n[Get your API Key HERE](https://rapidapi.com/rockapis-rockapis-default/api/linkedin-data-api)\n\n### Replace YOUR_API_KEY"
      },
      "typeVersion": 1
    },
    {
      "id": "2092c9b9-0558-4334-b70f-33f9876ff809",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        -100
      ],
      "parameters": {
        "width": 280,
        "height": 260,
        "content": "### Setup your Google Sheets API Account"
      },
      "typeVersion": 1
    },
    {
      "id": "04b48db8-938c-4cc5-8d9d-77a7ca928d5a",
      "name": "Split linkedin URL's",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        400,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "linkedin_url"
      },
      "typeVersion": 1
    },
    {
      "id": "b24e7486-307e-4587-b392-c0bff76dfffe",
      "name": "Combine each linkedin profile into single text",
      "type": "n8n-nodes-base.code",
      "position": [
        1140,
        0
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  const data = item.json;\n  const fullName = `${data.firstName || ''} ${data.lastName || ''}`.trim();\n  let combinedText = ``;\n  \n  // Process educations (handle array or single object)\n  if (data.educations) {\n    if (Array.isArray(data.educations)) {\n      data.educations.forEach(edu => {\n        combinedText += `Education at ${edu.schoolName} in ${edu.fieldOfStudy} from ${edu.start.year} to ${edu.end.year}.\\n`;\n      });\n    } else {\n      combinedText += `Education at ${data.educations.schoolName} in ${data.educations.fieldOfStudy} from ${data.educations.start.year} to ${data.educations.end.year}.\\n`;\n    }\n  }\n  \n  // Process fullPositions (handle array or single object)\n  if (data.fullPositions) {\n    if (Array.isArray(data.fullPositions)) {\n      data.fullPositions.forEach(pos => {\n        combinedText += `Worked as ${pos.title} at ${pos.companyName} starting ${pos.start.year}.\\n`;\n      });\n    } else {\n      combinedText += `Worked as ${data.fullPositions.title} at ${data.fullPositions.companyName} starting ${data.fullPositions.start.year}.\\n`;\n    }\n  }\n  \n  // Optionally, include headline if available\n  if (data.headline) {\n    combinedText = `Headline: ${data.headline}\\n` + combinedText;\n  }\n  \n  return { json: { fullName, combinedText } };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "582c4fca-ebe0-42e0-af37-4955f8437852",
      "name": "Summarize each profile using GPT model",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        1380,
        0
      ],
      "parameters": {
        "options": {
          "summarizationMethodAndPrompts": {
            "values": {
              "prompt": "=Based on the following information about a person\u2019s professional and educational background, generate a clear, concise summary that highlights their key accomplishments, current role, and academic credentials. Include their headline, major education achievements, and significant work experiences. The summary should provide a quick overview of their expertise and career trajectory.\n\nDetails:\n\nHeadline: [Insert Headline here]\nEducation: [List each education entry, including the institution, field of study, and the years attended]\nWork Experience: [List each role, including the title, company name, and starting year]\n\nThe context is:\n\n{{ $json.combinedText }}\n\nProvide a summary that outlines the candidate\u2019s current role, relevant academic background, and career progression in a professional tone.\nThe output text should be in plain text, without any additional formatting. Also, it should say any \"Summary:\" or \"Headline:\". Just text about the experience\n\nCONSICE SUMMARY:",
              "summarizationMethod": "stuff"
            }
          }
        }
      },
      "typeVersion": 2
    },
    {
      "id": "c98e9708-6ce6-43d2-8c24-3704820f1cb3",
      "name": "Tigger workflow when google sheets has new row added",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        140,
        0
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xqUBps0kFlaOpofrQITSivxWSbJmP7S90rVcPJEmbDg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1xqUBps0kFlaOpofrQITSivxWSbJmP7S90rVcPJEmbDg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xqUBps0kFlaOpofrQITSivxWSbJmP7S90rVcPJEmbDg/edit?usp=drivesdk",
          "cachedResultName": "LinkedIn Profiliai"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "5d780eb3-43a6-402f-851c-1d341a92bfcc",
      "name": "Get profile data using LinkedinAPI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        660,
        0
      ],
      "parameters": {
        "url": "https://linkedin-data-api.p.rapidapi.com/get-profile-data-by-url",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $json.linkedin_url }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "linkedin-data-api.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "YOUR_API_KEY"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "7ff52947-d30b-439f-986e-7cebb6c48b2d",
      "name": "Split results into multiple linkedin profiles",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        920,
        0
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "=firstName, lastName"
      },
      "typeVersion": 1
    },
    {
      "id": "8411c628-e206-4474-8c53-850b9c7f224b",
      "name": "Update Google Sheets rows with summarization for each profile",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1780,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "summary": "={{ $json.response.text }}",
            "full_name": "={{ $('Combine each linkedin profile into single text').item.json.fullName }}",
            "linkedin_url": "={{ $('Tigger workflow when google sheets has new row added').item.json.linkedin_url }}"
          },
          "schema": [
            {
              "id": "linkedin_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "full_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "full_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "linkedin_url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xqUBps0kFlaOpofrQITSivxWSbJmP7S90rVcPJEmbDg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1xqUBps0kFlaOpofrQITSivxWSbJmP7S90rVcPJEmbDg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xqUBps0kFlaOpofrQITSivxWSbJmP7S90rVcPJEmbDg/edit?usp=drivesdk",
          "cachedResultName": "LinkedIn Profiliai"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.5
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4dd50727-8014-4af5-a542-d57ff5317f15",
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize each profile using GPT model",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Split linkedin URL's": {
      "main": [
        [
          {
            "node": "Get profile data using LinkedinAPI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get profile data using LinkedinAPI": {
      "main": [
        [
          {
            "node": "Split results into multiple linkedin profiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize each profile using GPT model": {
      "main": [
        [
          {
            "node": "Update Google Sheets rows with summarization for each profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split results into multiple linkedin profiles": {
      "main": [
        [
          {
            "node": "Combine each linkedin profile into single text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine each linkedin profile into single text": {
      "main": [
        [
          {
            "node": "Summarize each profile using GPT model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tigger workflow when google sheets has new row added": {
      "main": [
        [
          {
            "node": "Split linkedin URL's",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}