{
  "id": "FmBx6nhuF6oBguoL",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Send LinkedIn Connection Request",
  "tags": [],
  "nodes": [
    {
      "id": "887e533f-8c7e-410f-a1c0-6efa71afbfe1",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -460,
        -200
      ],
      "parameters": {
        "options": {},
        "formTitle": "LinkedIn connection requests",
        "formFields": {
          "values": [
            {
              "fieldLabel": "LinkedIn URL",
              "requiredField": true
            },
            {
              "fieldLabel": "Airtop Profile (connected to Linkedin)",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Message"
            }
          ]
        },
        "formDescription": "=<p>This automation checks whether a person is a contact on LinkedIn.</p>\n\n<p>If the person is not connected, the automation will send a connection request automatically.</p>\n\n<p>The automation requires an Airtop Profile that is authenticated on LinkedIn. Don't have one? Create a free profile and log in to LinkedIn at <a href=\"https://portal.airtop.ai/browser-profiles\">https://portal.airtop.ai/browser-profiles</a>.</p>\n"
      },
      "typeVersion": 2.2
    },
    {
      "id": "61a37f6b-a032-407e-b10c-070685902136",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -460,
        0
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "airtop_profile"
            },
            {
              "name": "linked_url"
            },
            {
              "name": "message"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "99ed7cb1-2b89-4b04-9cb4-e57040a9804c",
      "name": "Switch1",
      "type": "n8n-nodes-base.switch",
      "position": [
        1300,
        -240
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "28a7e0bb-72a4-43bf-b62b-6136a705c489",
                    "operator": {
                      "type": "string",
                      "operation": "empty",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Unify Params').item.json.message }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "cbd885ba-776c-4425-8213-9b74ac1af647",
                    "operator": {
                      "type": "string",
                      "operation": "notEmpty",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Unify Params').item.json.message }}",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "291b375d-e7e5-4248-a518-1f8d94f973f8",
      "name": "Unify Params",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        -100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "362c7a61-fa44-4ba0-8045-ff66ab37cd3b",
              "name": "linkedin_url",
              "type": "string",
              "value": "={{ $json.linkedin_url || $json['LinkedIn URL']}}"
            },
            {
              "id": "8ad1abd4-34d1-4d55-ae83-1320d41967b2",
              "name": "airtop_profile",
              "type": "string",
              "value": "={{ $json.airtop_profile || $json['Airtop Profile (connected to Linkedin)']}}"
            },
            {
              "id": "09630ef2-3561-40bb-aeb7-19feb8c5a8a5",
              "name": "message",
              "type": "string",
              "value": "={{ $json.message || $json['Message']}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "401038a9-24ef-4705-b80b-4cfd83bf1a89",
      "name": "Click on connect",
      "type": "n8n-nodes-base.airtop",
      "position": [
        1080,
        -240
      ],
      "parameters": {
        "resource": "interaction",
        "windowId": "={{ $json.windowId }}",
        "sessionId": "={{ $json.sessionId }}",
        "additionalFields": {
          "visualScope": "viewport"
        },
        "elementDescription": "Connect"
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "19225625-1941-4f59-bd9b-b3b9b7e9b1ca",
      "name": "Send connection w/out message",
      "type": "n8n-nodes-base.airtop",
      "position": [
        1840,
        -300
      ],
      "parameters": {
        "resource": "interaction",
        "windowId": "={{ $('Click on connect').item.json.windowId }}",
        "sessionId": "={{ $('Click on connect').item.json.sessionId }}",
        "additionalFields": {
          "visualScope": "viewport"
        },
        "elementDescription": "Send without a note"
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f73c4d2e-6484-4406-a387-ba2bbe7bb946",
      "name": "Click add a note",
      "type": "n8n-nodes-base.airtop",
      "position": [
        1480,
        -20
      ],
      "parameters": {
        "resource": "interaction",
        "windowId": "={{ $('Click on connect').item.json.windowId }}",
        "sessionId": "={{ $('Click on connect').item.json.sessionId }}",
        "additionalFields": {
          "visualScope": "viewport"
        },
        "elementDescription": "Add a note"
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "897ef0b7-dd75-45ed-9e9d-b9b00e7d8855",
      "name": "Type the message",
      "type": "n8n-nodes-base.airtop",
      "position": [
        1700,
        -20
      ],
      "parameters": {
        "text": "={{ $('Unify Params').item.json.message }}",
        "resource": "interaction",
        "windowId": "={{ $json.windowId }}",
        "operation": "type",
        "sessionId": "={{ $json.sessionId }}",
        "additionalFields": {
          "visualScope": "viewport"
        }
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "743a2347-fd6c-4327-af41-5872ff9f8bca",
      "name": "Send connection w/ message",
      "type": "n8n-nodes-base.airtop",
      "position": [
        1900,
        -20
      ],
      "parameters": {
        "resource": "interaction",
        "windowId": "={{ $json.windowId }}",
        "sessionId": "={{ $json.sessionId }}",
        "additionalFields": {
          "visualScope": "viewport"
        },
        "elementDescription": "Send"
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "adba0046-7288-46ec-8c13-c76760c44edd",
      "name": "Create a Session",
      "type": "n8n-nodes-base.airtop",
      "position": [
        -20,
        -100
      ],
      "parameters": {
        "profileName": "={{ $json.airtop_profile }}",
        "additionalFields": {},
        "saveProfileOnTermination": true
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f081e081-9525-4d31-bc56-9be6123e81d2",
      "name": "Create a window",
      "type": "n8n-nodes-base.airtop",
      "position": [
        200,
        -100
      ],
      "parameters": {
        "url": "={{ $('Unify Params').item.json.linkedin_url }}",
        "resource": "window",
        "getLiveView": true,
        "additionalFields": {}
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ab766028-e576-49aa-8bdc-9615ed403282",
      "name": "Click More button",
      "type": "n8n-nodes-base.airtop",
      "position": [
        420,
        -100
      ],
      "parameters": {
        "resource": "interaction",
        "additionalFields": {
          "visualScope": "viewport"
        },
        "elementDescription": "More button"
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "66bebc96-fb99-445b-b0a4-b05b3a2f6980",
      "name": "Is a connection?",
      "type": "n8n-nodes-base.switch",
      "position": [
        860,
        -100
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b798dcb0-1ab0-486e-8d46-1707f4f45737",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.data.modelResponse }}",
                    "rightValue": "Connect"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9a21639a-ff59-40c5-9dc2-a77a212c3d19",
                    "operator": {
                      "type": "string",
                      "operation": "notContains"
                    },
                    "leftValue": "={{ $json.data.modelResponse }}",
                    "rightValue": "Connect"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "9ff5f293-1c49-455d-b7bb-260bc88585e4",
      "name": "Terminate session",
      "type": "n8n-nodes-base.airtop",
      "position": [
        1080,
        0
      ],
      "parameters": {
        "operation": "terminate",
        "sessionId": "={{ $json.sessionId }}"
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5e525111-b621-47ed-b5a6-4041f7e9eb86",
      "name": "Terminate session1",
      "type": "n8n-nodes-base.airtop",
      "position": [
        2360,
        -120
      ],
      "parameters": {
        "operation": "terminate"
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0a483ecb-6967-4f47-8716-df8d218d40b1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        -320
      ],
      "parameters": {
        "width": 440,
        "height": 480,
        "content": "## Input Parameters\nRun this workflow using a form or another workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "bf0c6f69-b175-4c3f-ac1a-09fd9fda014c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 1040,
        "height": 480,
        "content": "## LinkedIn Connection Checker\nVerifies whether a specified individual is a first-degree connection on LinkedIn using Airtop"
      },
      "typeVersion": 1
    },
    {
      "id": "f0d42603-d85b-4bea-9edd-950decaab8dd",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -320
      ],
      "parameters": {
        "color": 5,
        "width": 1100,
        "height": 480,
        "content": "## Send connection request\n"
      },
      "typeVersion": 1
    },
    {
      "id": "26a9ce2e-31e1-4f3c-a0ea-033cbe28c108",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -80
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 240,
        "content": "## End Airtop session \nThe user is already a connection"
      },
      "typeVersion": 1
    },
    {
      "id": "041c730f-3e1c-4b40-a0c1-af8041166839",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2340,
        -320
      ],
      "parameters": {
        "color": 3,
        "width": 210,
        "height": 480,
        "content": "## End Airtop session "
      },
      "typeVersion": 1
    },
    {
      "id": "47a7face-b181-4975-9c52-dd4a88f76c40",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -320
      ],
      "parameters": {
        "color": 6,
        "width": 640,
        "height": 200,
        "content": "## Send request without a note\nIf a message is not provided, \nthe request is send without a note"
      },
      "typeVersion": 1
    },
    {
      "id": "19ae1946-161c-4696-bdec-309cdeda56a1",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -100
      ],
      "parameters": {
        "width": 640,
        "height": 260,
        "content": "##                    Send request with a note\nIf a message is provided, the request is send with a note"
      },
      "typeVersion": 1
    },
    {
      "id": "676c1d9f-5478-4c59-9764-4a2d8336d46d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1240,
        -620
      ],
      "parameters": {
        "width": 700,
        "height": 1080,
        "content": "README\n\n# Automating LinkedIn Connection Requests\n\n## Use Case\n\nAutomatically sending LinkedIn connection requests to prospects can significantly streamline your outreach process. This automation ensures you only send requests to users you're not already connected with, and can optionally include a personalized message.\n\n## What This Automation Does\n\nThis automation sends a LinkedIn connection request using the following input parameters:\n\n- **linked_url**: The LinkedIn profile URL of the person you want to connect with.\n- **airtop_profile**: The name of your [Airtop Profile](https://portal.airtop.ai/browser-profiles) authenticated on LinkedIn.\n- **message** *(optional)*: The note you want to include with your connection request.\n\n## How It Works\n\n1. Starts an Airtop browser session using your authenticated profile.\n2. Opens the target LinkedIn profile in a new browser window.\n3. Detects if you're already connected or if a connection request is pending.\n4. If the \"Connect\" button is available:\n   - If no message is provided, clicks \"Connect\" and sends the request without a note.\n   - If a message is provided, clicks \"Add a note\", types the message, and sends the request.\n5. Terminates the browser session.\n\n## Setup Requirements\n\n1. [Airtop API Key](https://portal.airtop.ai/api-keys) \u2014 free to generate.\n2. An [Airtop Profile](https://portal.airtop.ai/browser-profiles) logged in to LinkedIn (requires one-time authentication).\n\n## Next Steps\n\n- **Pair with People Enrichment**: Use with the [LinkedIn Profile Finder](https://www.airtop.ai/blog/find-linkedin-profile-from-email) to generate URLs before sending requests.\n- **CRM Integration**: Log connection attempts and responses in your CRM.\n- **Campaign Sequencing**: Combine with message follow-up automations for a complete outreach flow.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ace44b2d-dbb7-4525-80b0-0d720b19815e",
      "name": "Check connection status",
      "type": "n8n-nodes-base.airtop",
      "position": [
        640,
        -100
      ],
      "parameters": {
        "prompt": "=This is a LinkedIn profile page. Please perform the following actions based on the presence of specific elements in the top profile box:\n\n- Reply \"Connect\" if a \"Connect\" button is present.\n- Reply \"Pending\" if a \"Pending\" message is present.\n- Reply \"1st degree\" if this person is a first-degree connection, indicated by \"1st\" near the name.\n\nDo not reply with anything else.\n\nFor example:\n- If the \"Connect\" button is present, the output should be: \"Connect\"\n- If the \"Pending\" message is present, the output should be: \"Pending\"\n- If the person is a first-degree connection, the output should be: \"1st degree\"",
        "resource": "extraction",
        "operation": "query",
        "additionalFields": {}
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8c0f7084-04ac-4b58-a44c-cce663de1b68",
      "name": "Airtop",
      "type": "n8n-nodes-base.airtop",
      "position": [
        2160,
        -120
      ],
      "parameters": {
        "resource": "window",
        "operation": "takeScreenshot",
        "outputImageAsBinary": true
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "jOzgI7as1gGhlZ91",
    "executionOrder": "v1"
  },
  "versionId": "2e66163a-0490-4e6f-99f0-939f3e26e6b3",
  "connections": {
    "Airtop": {
      "main": [
        [
          {
            "node": "Terminate session1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "Send connection w/out message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Click add a note",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unify Params": {
      "main": [
        [
          {
            "node": "Create a Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a window": {
      "main": [
        [
          {
            "node": "Click More button",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Click add a note": {
      "main": [
        [
          {
            "node": "Type the message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Click on connect": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a Session": {
      "main": [
        [
          {
            "node": "Create a window",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is a connection?": {
      "main": [
        [
          {
            "node": "Click on connect",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Terminate session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Type the message": {
      "main": [
        [
          {
            "node": "Send connection w/ message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Click More button": {
      "main": [
        [
          {
            "node": "Check connection status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Unify Params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check connection status": {
      "main": [
        [
          {
            "node": "Is a connection?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send connection w/ message": {
      "main": [
        [
          {
            "node": "Airtop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send connection w/out message": {
      "main": [
        [
          {
            "node": "Airtop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Unify Params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}