LinkedIn Connect
Automates sending LinkedIn connection requests from a list and tracks results in a data file.
⚠️ Pre-flight Checklist — Confirm Before Starting
Before doing anything else, confirm all of the following with the user. Do not proceed until each item is confirmed.
1. Data File
Ask the user to provide their spreadsheet/CSV/TSV file and confirm it has (or can have) these columns:
- - Person/Founder Name — full name of the person to connect with
- Company/Brand Name — their company or brand (used for search fallback)
- LinkedIn Profile URL — optional but highly recommended; reduces automation footprint
If the file lacks any column, tell the user which columns are missing and offer to add them.
2. Browser Setup
Ask which browser setup they're using:
Option A — Chrome Browser Relay (recommended for accounts flagged for automation)
- - User must have the OpenClaw Browser Relay Chrome extension installed
- User opens LinkedIn in their regular Chrome browser and clicks the OpenClaw Relay toolbar icon on that tab (badge turns ON)
- Use
profile="chrome" for all browser tool calls in this mode
Option B — OpenClaw Isolated Browser (openclaw profile)
- - OpenClaw manages a separate Chrome instance
- On first use, navigate to
https://www.linkedin.com and let the user log in; cookies persist across sessions - Use
profile="openclaw" for all browser tool calls in this mode
Confirm which option they've set up. Default to Option A (Chrome Relay) if the user's account has been flagged or warned about automation.
3. Ready Check
Only proceed once the user says:
- - ✅ File is ready and accessible
- ✅ Browser is open with LinkedIn logged in (and relay is attached if Option A)
Browser Profile
Set the profile variable based on user's choice in the Pre-flight Checklist:
- - Option A:
profile="chrome" — reuse the relay-attached tab; get targetId via INLINECODE7 - Option B:
profile="openclaw" — OpenClaw-managed isolated Chrome instance
Do not mix profiles mid-run. Pick one and use it consistently for every browser tool call.
Data File Setup
Ensure the tracking file has a Connection Status column. If missing, add it:
CODEBLOCK0
Three-Tier Profile Discovery (Priority Order)
Always try in this order. Move to the next tier only if the current one fails.
Tier 1 — Direct LinkedIn URL (fastest, zero ambiguity)
Navigate directly to the LinkedIn profile URL from the data file.
- - ✅ URL loads → correct profile, proceed to connect
- ❌ Returns 404 → escalate to Tier 2
- Skip Tier 1 if no URL is in the data file for this person
Tier 2 — Google Search (reliable fallback, preserves accuracy)
Search Google for
"Founder Name" "Brand/Company" linkedin.
- - Navigate to: INLINECODE11
- Find the LinkedIn profile link in results (usually first result), click it
- Once on the profile, proceed to Connect step
- ⚠️ Only escalate to Tier 3 if Google can't find the right person or returns no LinkedIn result
Tier 3 — LinkedIn People Search (last resort)
Run a LinkedIn people search for the founder + brand directly inside LinkedIn.
- - Navigate to: INLINECODE12
- Look for inline
Connect buttons first; otherwise open the profile from search results - Confirm name + headline/company match before connecting
- ❌ No trustworthy match → mark INLINECODE14
See references/browser-workflow.md for detailed browser steps for each tier.
Connecting on a Profile
Once on the correct profile, two patterns exist:
Pattern A - Direct Connect button visible on profile → click it → confirm dialog → INLINECODE16
Pattern B - Follow mode (no Connect button, only Follow + Message + More) → click More actions → use selector .artdeco-dropdown__content--is-open to get dropdown → click Invite [Name] to connect → confirm dialog → INLINECODE20
If neither Connect nor Invite is available → mark Follow Only.
Status Values
| Status | Meaning |
|---|
| INLINECODE22 | Connection request sent this session |
| INLINECODE23 |
1st degree - no action needed |
|
Pending | Request already sent previously |
|
Follow Only | No Connect option available on this profile |
|
Profile Not Found | All three tiers failed |
|
Skipped | Intentionally skipped |
Multi-founder Rows
When a TSV row has multiple founders, track per-founder status separated by | :
CODEBLOCK1
Rate Limiting & Anti-Detection
⚠️ LinkedIn flags accounts that jump directly between profile URLs. Always visit the feed between profiles — no exceptions.
- - Navigate to
/feed/ before every single profile, without exception. See references/browser-workflow.md for the exact call. This is the primary anti-detection measure. - Add a short natural pause (2–4 seconds) after loading the feed before navigating to the next profile.
- If >3 consecutive clean URLs return 404, pause for 10 seconds on the feed before continuing (then fall back to Google/LinkedIn search).
- Do not open new browser tabs — the relay breaks; reuse the same attached tab for every action.
- Aim for no more than 20–25 connection requests per session. Stop and tell the user if you're approaching this limit.
Saving Progress
Use a linkedin_progress.json sidecar file:
{ "statuses": { "https://www.linkedin.com/in/username/": "Request Sent" } }
Update the TSV from this dict every 10 profiles or at the end.
References
- -
references/browser-workflow.md - Detailed browser steps for all three tiers and both connect patterns
LinkedIn Connect
自动从列表中发送LinkedIn好友请求,并将结果记录在数据文件中。
⚠️ 飞行前检查清单 — 开始前确认
在执行任何操作之前,请与用户确认以下所有事项。每项确认完成前不得继续。
1. 数据文件
请用户提供其电子表格/CSV/TSV文件,并确认文件包含(或可以添加)以下列:
- - 人员/创始人姓名 — 要建立联系的人员全名
- 公司/品牌名称 — 其公司或品牌(用于搜索备用)
- LinkedIn个人资料URL — 可选但强烈推荐;可减少自动化痕迹
如果文件缺少任何列,请告知用户缺少哪些列,并提供添加这些列的帮助。
2. 浏览器设置
询问用户使用哪种浏览器设置:
选项A — Chrome浏览器中继(推荐用于被标记自动化的账户)
- - 用户必须安装OpenClaw Browser Relay Chrome扩展程序
- 用户在常规Chrome浏览器中打开LinkedIn,并点击该标签页上的OpenClaw Relay工具栏图标(徽章变为开启状态)
- 在此模式下,所有浏览器工具调用使用 profile=chrome
选项B — OpenClaw隔离浏览器(openclaw配置文件)
- - OpenClaw管理一个独立的Chrome实例
- 首次使用时,导航至 https://www.linkedin.com 并让用户登录;Cookie在会话间持久保存
- 在此模式下,所有浏览器工具调用使用 profile=openclaw
确认用户已设置哪个选项。如果用户的账户已被标记或收到关于自动化的警告,默认使用选项A(Chrome中继)。
3. 就绪检查
仅在用户确认以下内容后才继续:
- - ✅ 文件已就绪且可访问
- ✅ 浏览器已打开且LinkedIn已登录(如果选择选项A,中继已附加)
浏览器配置文件
根据飞行前检查清单中用户的选择设置 profile 变量:
- - 选项A: profile=chrome — 复用附加了中继的标签页;通过 browser action=tabs 获取 targetId
- 选项B: profile=openclaw — OpenClaw管理的独立Chrome实例
运行过程中不得混合使用配置文件。选择一个配置文件并在每次浏览器工具调用中一致使用。
数据文件设置
确保跟踪文件包含 Connection Status 列。如果缺失,则添加该列:
python
import csv
rows = []
with open(file.tsv, r) as f:
reader = csv.DictReader(f, delimiter=\t)
fieldnames = reader.fieldnames + [Connection Status]
rows = list(reader)
with open(file.tsv, w, newline=) as f:
writer = csv.DictWriter(f, fieldnames=fieldnames, delimiter=\t)
writer.writeheader()
for row in rows:
row[Connection Status] =
writer.writerow(row)
三层个人资料发现(优先级顺序)
始终按此顺序尝试。仅当当前层级失败时才移至下一层级。
第1层 — 直接LinkedIn URL(最快,零歧义)
直接从数据文件导航至LinkedIn个人资料URL。
- - ✅ URL加载成功 → 正确的个人资料,继续建立联系
- ❌ 返回404 → 升级至第2层
- 如果数据文件中没有此人的URL,跳过第1层
第2层 — Google搜索(可靠的备用方案,保持准确性)
搜索Google 创始人姓名 品牌/公司 linkedin。
- - 导航至:https://www.google.com/search?q=<姓名>+<公司>+linkedin
- 在搜索结果中找到LinkedIn个人资料链接(通常为第一个结果),点击该链接
- 进入个人资料页面后,继续执行建立联系步骤
- ⚠️ 仅当Google无法找到正确人员或未返回LinkedIn结果时,才升级至第3层
第3层 — LinkedIn人员搜索(最后手段)
在LinkedIn内部直接运行针对创始人和品牌的人员搜索。
- - 导航至:https://www.linkedin.com/search/results/people/?keywords=<姓名>+<公司>
- 首先查找内联的 Connect 按钮;否则从搜索结果中打开个人资料
- 在建立联系前确认姓名和头衔/公司匹配
- ❌ 无可靠匹配 → 标记为 Profile Not Found
各层级详细的浏览器操作步骤请参见 references/browser-workflow.md。
在个人资料上建立联系
进入正确的个人资料后,存在两种模式:
模式A - 直接连接按钮 在个人资料上可见 → 点击该按钮 → 确认对话框 → 发送时不附带备注
模式B - 关注模式(无连接按钮,仅有关注 + 消息 + 更多)→ 点击 更多操作 → 使用选择器 .artdeco-dropdowncontent--is-open 获取下拉菜单 → 点击 邀请[姓名]建立联系 → 确认对话框 → 发送时不附带备注
如果既无连接也无邀请选项 → 标记为 Follow Only。
状态值
| 状态 | 含义 |
|---|
| Request Sent | 本次会话已发送好友请求 |
| Already Connected |
一度人脉 — 无需操作 |
| Pending | 之前已发送请求 |
| Follow Only | 此个人资料上无连接选项 |
| Profile Not Found | 所有三层均失败 |
| Skipped | 有意跳过 |
多创始人行
当TSV行包含多个创始人时,按创始人状态以 | 分隔跟踪:
创始人1简称: Request Sent | 创始人2简称: Already Connected
速率限制与反检测
⚠️ LinkedIn会标记直接在个人资料URL之间跳转的账户。每次访问个人资料前必须访问信息流 — 无例外。
- - 每次访问个人资料前,必须导航至 /feed/,无例外。具体调用方法请参见 references/browser-workflow.md。这是主要的反检测措施。
- 加载信息流后,在导航至下一个个人资料前添加短暂的自然停顿(2–4秒)。
- 如果连续超过3个干净的URL返回404,在信息流上暂停10秒后再继续(然后回退至Google/LinkedIn搜索)。
- 不要打开新的浏览器标签页 — 中继会中断;每次操作复用同一个附加的标签页。
- 每次会话的好友请求数量不超过20–25个。如果接近此限制,请停止并告知用户。
保存进度
使用 linkedin_progress.json 辅助文件:
json
{ statuses: { https://www.linkedin.com/in/username/: Request Sent } }
每处理10个个人资料或结束时,从此字典更新TSV文件。
参考资料
- - references/browser-workflow.md — 所有三个层级和两种连接模式的详细浏览器操作步骤