Community写作与编辑github.com

Linked-API/linkedin-skills

面向AI代理的LinkedIn自动化技能:销售、社交销售、数据提取等。

linkedin-skills 是什么?

此技能为AI代理(如Claude Code、Cursor、Codex等)提供全面的LinkedIn自动化能力。它通过`linkedin`命令行工具,使代理能够执行配置文件检索、人员与公司搜索、消息发送、连接管理、帖子创建、互动(点赞、评论)以及数据提取等操作。其核心机制是向Linked API发送请求,该API会启动真实的云端浏览器来模拟用户操作,因此操作并非瞬时完成,通常需要30秒到几分钟。该技能支持基于结构化JSON的输出,便于程序化处理,并提供了详细的认证设置流程和错误代码说明。主要应用场景包括销售拓展、社交销售、招聘研究、市场分析和个人品牌管理。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add Linked-API/linkedin-skills

Installed? Explore more 写作与编辑 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

LinkedIn 技能

您可以访问 linkedin —— 一个用于 LinkedIn 自动化的 CLI 工具。用它来获取个人资料、搜索人员和公司、发送消息、管理人脉、创建帖子、点赞、评论等。

每个命令都会向 Linked API 发送请求,该 API 会运行一个真实的云端浏览器来在 LinkedIn 上执行操作。操作不是瞬间完成的——根据复杂程度,可能需要 30 秒到几分钟。

如果 linkedin 不可用,请安装:

npm install -g @linkedapi/linkedin-cli

身份验证

如果命令失败并返回退出码 2(身份验证错误),请让用户设置其帐户:

  1. 前往 app.linkedapi.io 并注册或登录
  2. 关联他们的 LinkedIn 帐户
  3. 从控制面板复制 Linked API Token 和 Identification Token

一旦用户提供了令牌,请运行:

linkedin setup --linked-api-token=TOKEN --identification-token=TOKEN

全局标志

始终使用 --json 和 -q 以获得机器可读的输出:

LINKEDAPI_CLIENT=skill:linkedin linkedin <command> --json -q

使用此技能时,请确保为下面的每个 linkedin ... 示例都加上 LINKEDAPI_CLIENT=skill:linkedin 前缀,以便 Linked API 可以将使用情况归因于该技能。

标志描述
--json结构化的 JSON 输出
--quiet / -q禁止 stderr 进度消息
--fields name,url,...在输出中选择特定字段
--no-color禁用颜色
--account "Name"为此命令使用特定帐户

输出格式

成功:

{"success": true, "data": {"name": "John Doe", "headline": "Engineer"}}

错误:

{"success": false, "error": {"type": "personNotFound", "message": "Person not found"}}

退出码为 0 表示 API 调用成功——请始终检查 success 字段以确定操作结果。非零退出码表示基础设施错误:

退出码含义
0成功(检查 success 字段——操作可能返回了“未找到人员”等错误)
1常规/意外错误
2缺少或无效的令牌
3需要订阅/方案
4LinkedIn 帐户问题
5无效参数
6请求频率受限
7网络错误
8工作流超时(返回了 workflowId,可用于恢复)

命令

获取个人资料

linkedin person fetch <url> [flags] --json -q

包含附加数据的可选标志:

  • --experience – 工作经历
  • --education – 教育经历
  • --skills – 技能列表
  • --languages – 语言
  • --posts – 最近的帖子(配合 --posts-limit N,--posts-since TIMESTAMP)
  • --comments – 最近的评论(配合 --comments-limit N,--comments-since TIMESTAMP)
  • --reactions – 最近的点赞(配合 --reactions-limit N,--reactions-since TIMESTAMP)

仅在有需要时才请求附加数据——每个标志都会增加执行时间。

# 基本资料
linkedin person fetch https://www.linkedin.com/in/username --json -q

# 包含工作经历和教育经历
linkedin person fetch https://www.linkedin.com/in/username --experience --education --json -q

# 包含最近 5 篇帖子
linkedin person fetch https://www.linkedin.com/in/username --posts --posts-limit 5 --json -q

搜索人员

linkedin person search [flags] --json -q
标志描述
--term搜索关键词或短语
--limit最大结果数
--first-name按名字筛选
--last-name按姓氏筛选
--position按职位筛选
--locations逗号分隔的地点列表
--industries逗号分隔的行业列表
--current-companies逗号分隔的当前公司名称列表
--previous-companies逗号分隔的以前的公司名称列表
--schools逗号分隔的学校名称列表
linkedin person search --term "product manager" --locations "San Francisco" --json -q
linkedin person search --current-companies "Google" --position "Engineer" --limit 20 --json -q

获取公司信息

linkedin company fetch <url> [flags] --json -q

可选标志:

  • --employees – 包含员工
  • --dms – 包含决策者
  • --posts – 包含公司帖子

员工筛选器(需要 --employees):

标志描述
--employees-limit最多检索的员工数量
--employees-first-name按名字筛选
--employees-last-name按姓氏筛选
--employees-position按职位筛选
--employees-locations逗号分隔的地点列表
--employees-industries逗号分隔的行业列表
--employees-schools逗号分隔的学校名称列表
标志描述
--dms-limit最多检索的决策者数量(需要 --dms)
--posts-limit最多检索的帖子数量(需要 --posts)
--posts-since自 ISO 时间戳以来的帖子(需要 --posts)
# 基本公司信息
linkedin company fetch https://www.linkedin.com/company/name --json -q

# 包含按职位筛选的员工
linkedin company fetch https://www.linkedin.com/company/name --employees --employees-position "Engineer" --json -q

# 包含决策者和帖子
linkedin company fetch https://www.linkedin.com/company/name --dms --posts --posts-limit 10 --json -q

搜索公司

linkedin company search [flags] --json -q
标志描述
--term搜索关键词
--limit最大结果数
--sizes逗号分隔的规模:1-10,11-50,51-200,201-500,501-1000,1001-5000,5001-10000,10001+
--locations逗号分隔的地点列表
--industries逗号分隔的行业列表
linkedin company search --term "fintech" --sizes "11-50,51-200" --json -q

发送消息

linkedin message send <person-url> '<text>' --json -q

文本最多 1900 个字符。将消息用单引号括起来,以避免 shell 解释问题。

linkedin message send https://www.linkedin.com/in/username 'Hey, loved your latest post!' --json -q

获取对话

linkedin message get <person-url> [--since TIMESTAMP] --json -q

首次调用对话时会触发后台同步,可能需要更长时间。后续调用会更快。

linkedin message get https://www.linkedin.com/in/username --json -q
linkedin message get https://www.linkedin.com/in/username --since 2024-01-15T10:30:00Z --json -q

人脉管理

检查连接状态

linkedin connection status <url> --json -q

发送连接请求

linkedin connection send <url> [--note 'text'] [--email [email protected]] --json -q

列出连接

linkedin connection list [flags] --json -q
标志描述
--limit最多返回的连接数
--since仅返回自 ISO 时间戳以来的连接(仅在不使用其他筛选标志时有效)
--first-name按名字筛选
--last-name按姓氏筛选
--position按职位筛选
--locations逗号分隔的地点列表
--industries逗号分隔的行业列表
--current-companies逗号分隔的当前公司名称列表
--previous-companies逗号分隔的以前的公司名称列表
--schools逗号分隔的学校名称列表
linkedin connection list --limit 50 --json -q
linkedin connection list --current-companies "Google" --position "Engineer" --json -q
linkedin connection list --since 2024-01-01T00:00:00Z --json -q

列出待处理的发出请求

linkedin connection pending --json -q

列出收到的连接请求

其他人发送给您的邀请(接收到的请求)。

linkedin connection requests --json -q

接受收到的请求

linkedin connection accept <url> --json -q

忽略收到的请求

linkedin connection ignore <url> --json -q

撤回待处理请求

linkedin connection withdraw <url> [--no-unfollow] --json -q

默认情况下,撤回还会取消关注该人。使用 --no-unfollow 保持关注状态。

删除连接

linkedin connection remove <url> --json -q

帖子

获取帖子

linkedin post fetch <url> [flags] --json -q
标志描述
--comments包含评论
--reactions包含点赞
--comments-limit最多检索的评论数量(需要 --comments)
--comments-sort排序方式:mostRelevant 或 mostRecent(需要 --comments)
--comments-replies包含对评论的回复(需要 --comments)
--reactions-limit最多检索的点赞数量(需要 --reactions)
linkedin post fetch https://www.linkedin.com/posts/username_activity-123 --json -q

# 包含评论,按最新排序,包含回复
linkedin post fetch https://www.linkedin.com/posts/username_activity-123 \
  --comments --comments-sort mostRecent --comments-replies --json -q

创建帖子

linkedin post create '<text>' [flags] --json -q
标志描述
--company-url代表公司页面发帖(需要管理员权限)
--attachments附件,格式为 url:type 或 url:type:name。类型:image,video,document。可以多次指定。

附件限制:最多 9 张图片,或 1 个视频,或 1 个文档。不能混合类型。

linkedin post create 'Excited to share our latest update!' --json -q

# 附带文档
linkedin post create 'Our Q4 report' \
  --attachments "https://example.com/report.pdf:document:Q4 Report" --json -q

# 代表公司发帖
linkedin post create 'Company announcement' \
  --company-url https://www.linkedin.com/company/name --json -q

点赞帖子

linkedin post react <url> --type <reaction> [--company-url <url>] --json -q

点赞类型:like,love,support,celebrate,insightful,funny。

linkedin post react https://www.linkedin.com/posts/username_activity-123 --type like --json -q

# 代表公司点赞
linkedin post react https://www.linkedin.com/posts/username_activity-123 --type celebrate \
  --company-url https://www.linkedin.com/company/name --json -q

评论帖子

linkedin post comment <url> '<text>' [--company-url <url>] --json -q

文本最多 1000 个字符。

linkedin post comment https://www.linkedin.com/posts/username_activity-123 'Great insights!' --json -q

# 代表公司评论
linkedin post comment https://www.linkedin.com/posts/username_activity-123 'Well said!' \
  --company-url https://www.linkedin.com/company/name --json -q

统计数据

# 社交销售指数
linkedin stats ssi --json -q

# 表现分析(个人资料浏览量、帖子展示次数、搜索出现次数)
linkedin stats performance --json -q

# 指定日期范围的 API 使用情况
linkedin stats usage --start 2024-01-01T00:00:00Z --end 2024-01-31T00:00:00Z --json -q

销售导航器

需要 LinkedIn Sales Navigator 订阅。使用哈希 URL 进行人员/公司查找。

获取人员

linkedin navigator person fetch <hashed-url> --json -q

搜索人员

linkedin navigator person search [flags] --json -q
标志描述
--term搜索关键词或短语
--limit最大结果数
--first-name按名字筛选
--last-name按姓氏筛选
--position按职位筛选
--locations逗号分隔的地点列表
--industries逗号分隔的行业列表
--current-companies逗号分隔的当前公司名称列表
--previous-companies逗号分隔的以前的公司名称列表
--schools逗号分隔的学校名称列表
--years-of-experience逗号分隔的年限范围:lessThanOne,oneToTwo,threeToFive,sixToTen,moreThanTen
linkedin navigator person search --term "VP Marketing" --locations "United States" --json -q
linkedin navigator person search --years-of-experience "moreThanTen" --position "CEO" --json -q

获取公司信息

linkedin navigator company fetch <hashed-url> [flags] --json -q

可选标志:

  • --employees – 包含员工
  • --dms – 包含决策者

员工筛选器(需要 --employees):

标志描述
--employees-limit最多检索的员工数量
--employees-first-name按名字筛选
--employees-last-name按姓氏筛选
--employees-positions逗号分隔的职位列表
--employees-locations逗号分隔的地点列表
--employees-industries逗号分隔的行业列表
--employees-schools逗号分隔的学校名称列表
--employees-years-of-experience逗号分隔的年限范围
--dms-limit最多检索的决策者数量(需要 --dms)
linkedin navigator company fetch https://www.linkedin.com/sales/company/97ural --employees --dms --json -q
linkedin navigator company fetch https://www.linkedin.com/sales/company/97ural \
  --employees --employees-positions "Engineer,Designer" --employees-locations "Europe" --json -q

搜索公司

linkedin navigator company search [flags] --json -q
标志描述
--term搜索关键词
--limit最大结果数
--sizes逗号分隔的规模:1-10,11-50,51-200,201-500,501-1000,1001-5000,5001-10000,10001+
--locations逗号分隔的地点列表
--industries逗号分隔的行业列表
--revenue-min最低年收入(百万美元):0,0.5,1,2.5,5,10,20,50

...

[内容已截断以进行翻译]

相关技能