返回顶部
u

unipile-linkedin-sdkLinkedIn集成SDK

LinkedIn integration via Unipile's official Node.js SDK. Send messages, InMail, view profiles, manage connections, create posts, and interact with content. Use for LinkedIn automation, messaging, profile retrieval, connection requests, or post interactions. Trigger phrases: "linkedin api", "scrape linkedin", "linkedin profile", "linkedin posts", "send linkedin message".

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.5.0
安全检测
已通过
143
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

unipile-linkedin-sdk

Unipile LinkedIn SDK

通过官方Unipile Node.js SDK实现LinkedIn API,支持消息、个人资料、帖子和邀请功能。

⚠️ 安全:遵循最小权限原则

推荐: 设置 UNIPILE_PERMISSIONS=read 以启用只读访问。

bash

推荐:只读模式(安全,无写入操作)


UNIPILE_PERMISSIONS=read node scripts/linkedin.mjs posts andrewyng

仅当需要发送消息或创建帖子时

UNIPILE_PERMISSIONS=read,write node scripts/linkedin.mjs create-post text

您的访问令牌可以代表您执行操作。请使用 UNIPILE_PERMISSIONS 限制其作用范围。

设置

安装

bash
npm install unipile-node-sdk

环境变量

变量必需描述
UNIPILEDSN✅ 是API端点(例如 https://api34.unipile.com:16473)
UNIPILEACCESSTOKEN
✅ 是 | 来自 dashboard.unipile.com 的访问令牌 | | UNIPILE_PERMISSIONS | 可选 | read、write 或 read,write。推荐:read |

权限模式

模式UNIPILE_PERMISSIONS允许的操作使用场景
只读read列出个人资料、帖子、聊天、消息、连接数据抓取、仪表盘、分析
只写
write | 发送消息、创建帖子、点赞、评论 | 自动化机器人 | | 完全访问 | read,write | 所有操作 | 完整的LinkedIn自动化 |

默认值: read,write(完全访问)— 为安全起见,请更改为 read。

最小权限最佳实践

bash

1. 从只读开始(最安全)


export UNIPILE_PERMISSIONS=read

2. 仅在特定需要时启用写入

export UNIPILE_PERMISSIONS=read,write # 临时用于特定任务

3. 完成后恢复为只读

export UNIPILE_PERMISSIONS=read

客户端初始化

javascript
import { UnipileClient } from unipile-node-sdk;

const client = new UnipileClient(
process.env.UNIPILE_DSN,
process.env.UNIPILEACCESSTOKEN
);

// 操作前检查权限
const canWrite = (process.env.UNIPILE_PERMISSIONS || read,write).includes(write);
const canRead = (process.env.UNIPILE_PERMISSIONS || read,write).includes(read);

凭据存储

推荐方法(按安全性排序):

  1. 1. 环境变量 — 在shell配置文件或.env中设置(将.env添加到.gitignore)
  2. 密钥管理器 — AWS Secrets Manager、HashiCorp Vault等
  3. CI/CD密钥 — GitHub Actions secrets、GitLab CI variables

避免: 将令牌以明文形式存储在文件中,尤其是在共享或版本控制的目录中。

获取凭据

  1. 1. 在 dashboard.unipile.com 注册
  2. 创建应用以获取您的DSN和访问令牌
  3. 通过仪表盘或API连接LinkedIn账户

调用示例

设置与账户发现

通过Unipile连接我的LinkedIn账户
列出我已连接的LinkedIn账户
我的LinkedIn个人资料信息是什么?

模式: 首先获取账户ID,然后将其用于所有其他操作。

javascript
// 步骤1:获取您的LinkedIn账户ID
const accounts = await client.account.getAll();
const linkedin = accounts.items.find(a => a.type === LINKEDIN);
const accountId = linkedin.id; // 用于所有操作

// 步骤2:获取您自己的个人资料
const me = await client.users.getOwnProfile(accountId);

个人资料查询

查看吴恩达的LinkedIn个人资料
获取萨提亚·纳德拉的LinkedIn工作经历部分
在LinkedIn上查找OpenAI的公司简介

javascript
// 通过公开标识符(URL slug)查询用户个人资料
const profile = await client.users.getProfile({
account_id: accountId,
identifier: andrewyng // 来自 linkedin.com/in/andrewyng
});

// 指定部分内容
const profile = await client.users.getProfile({
account_id: accountId,
identifier: satyanadella,
linkedin_sections: [experience, education, skills],
notify: true // 发送个人资料查看通知
});

// 公司简介
const company = await client.users.getCompanyProfile({
account_id: accountId,
identifier: openai // 公司URL slug
});

帖子与内容

列出上周吴恩达在LinkedIn上的帖子
获取桑达尔·皮查伊最新的5条帖子
显示微软最近的LinkedIn帖子
吴恩达最近关于AI发了什么?

javascript
// 获取用户的帖子
const posts = await client.users.getAllPosts({
account_id: accountId,
identifier: andrewyng, // 或使用个人资料查询中的provider_id
limit: 10
});

// 按日期范围过滤(客户端)
const oneWeekAgo = new Date(Date.now() - 7 24 60 60 1000);
const recentPosts = posts.items.filter(p =>
new Date(p.parsed_datetime) >= oneWeekAgo
);

// 获取特定帖子的详细信息
const post = await client.users.getPost({
account_id: accountId,
post_id: posts.items[0].id
});
// 返回:点赞数、评论数、分享链接、文本等

// 在您自己的个人资料上创建帖子
await client.users.createPost({
account_id: accountId,
text: 很高兴分享我的最新项目!🚀
});

消息

列出我的LinkedIn聊天
显示LinkedIn上未读的消息
给我上次的LinkedIn对话发送消息

javascript
// 列出所有聊天
const chats = await client.messaging.getAllChats({
account_type: LINKEDIN,
account_id: accountId,
limit: 20
});

// 过滤未读
const unreadChats = chats.items.filter(c => c.unread_count > 0);

// 获取聊天中的消息
const messages = await client.messaging.getAllMessagesFromChat({
chat_id: chats.items[0].id,
limit: 50
});

// 向现有聊天发送消息
await client.messaging.sendMessage({
chatid: chatid,
text: 感谢连接!
});

// 与某人开始新聊天
await client.messaging.startNewChat({
account_id: accountId,
attendeesids: [provideridfromprofile],
text: 你好,我想联系一下关于...
});

InMail(非联系人)

向网络外的人发送InMail
给未连接的LinkedIn用户发消息

javascript
await client.messaging.startNewChat({
account_id: accountId,
attendeesids: [targetprovider_id],
text: 你好,我看到了你的个人资料...,
options: {
linkedin: {
api: classic, // 或 recruiter, sales_navigator
inmail: true
}
}
});

注意:InMail需要LinkedIn Premium。

连接与邀请

列出我的LinkedIn联系人
显示我待处理的连接请求
向[个人资料]发送连接请求
取消我向[姓名]发送的待处理邀请

javascript
// 列出您的联系人
const connections = await client.users.getAllRelations({
account_id: accountId,
limit: 100
});

// 发送连接请求
await client.users.sendInvitation({
account_id: accountId,
provider_id: ACoAAA..., // 来自个人资料查询
message: 你好,我很喜欢你最近关于AI的帖子!
});

// 列出您已发送的待处理邀请
const invitations = await client.users.getAllInvitationsSent({
account_id: accountId
});

// 取消邀请
await client.users.cancelInvitationSent({
account_id: accountId,
invitation_id: invitations.items[0].id
});

点赞与评论

点赞吴恩达的最新帖子
在[帖子]上添加评论
在[帖子]上使用庆祝表情

javascript
//

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 unipile-linkedin-sdk-1776112102 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 unipile-linkedin-sdk-1776112102 技能

通过命令行安装

skillhub install unipile-linkedin-sdk-1776112102

下载

⬇ 下载 unipile-linkedin-sdk v1.5.0(免费)

文件大小: 13.07 KB | 发布时间: 2026-4-14 13:43

v1.5.0 最新 2026-4-14 13:43
Added optionalEnv declaration for UNIPILE_PERMISSIONS. Emphasized least-privilege (read-only) as recommended default. Added security section at top with permission guidance.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部