LinkedIn Posting
Overview
Post text and images to LinkedIn via the message tool using the linkedin channel. Supports text-only posts, image posts (local files or URLs), and #BuildInPublic updates.
Prerequisites
The linkedin channel must be configured in channels.linkedin with:
- -
accessToken: OAuth 2.0 token with w_member_social scope - INLINECODE4 : Your LinkedIn person URN (e.g.
urn:li:person:Abc123)
Posting Text
Use the message tool to send a text post:
CODEBLOCK0
The post goes to the authenticated user's LinkedIn feed as a public post.
Posting with Images
Two-step process:
- 1. Create the image — generate or locate the image file (PNG/JPG/GIF/WebP)
- Post with image — use
message send with the --media flag:
CODEBLOCK1
Supported image sources:
- - Local file paths: INLINECODE9
- INLINECODE10 URLs: INLINECODE11
- Remote URLs: INLINECODE12
Image Upload Flow (internals)
The extension handles a 3-step LinkedIn UGC API flow automatically:
- 1. Register upload → gets
uploadUrl + asset URN - PUT binary to INLINECODE15
- Create UGC post with
asset reference
You don't need to manage this — just provide the image path.
Best Practices
- - Always confirm post content with the owner before posting
- Keep posts concise — LinkedIn favors 150-300 word posts
- Add hashtags at the end, not inline (3-5 max)
- For #BuildInPublic: include what you built, what you learned, a visual
- Image sizing: 1200x627px for link previews, 1080x1080 for square posts
- Never post without explicit owner approval
Post Templates
#BuildInPublic Update
CODEBLOCK2
Project Milestone
CODEBLOCK3
Technical Deep-Dive
CODEBLOCK4
Troubleshooting
| Error | Cause | Fix |
|---|
| 401 Unauthorized | Token expired | Re-authenticate, update INLINECODE17 |
| 403 Forbidden |
Missing
w_member_social scope | Re-create OAuth app with correct scopes |
| Image upload 400 | File too large (>10MB) | Compress image before uploading |
| Empty postUrn | API didn't return ID | Post likely succeeded — check LinkedIn feed |
LinkedIn 发帖
概述
通过 linkedin 频道使用 message 工具向 LinkedIn 发送文本和图片。支持纯文本帖子、图片帖子(本地文件或 URL)以及 #BuildInPublic 更新。
前提条件
必须在 channels.linkedin 中配置 linkedin 频道,包含:
- - accessToken:具有 wmembersocial 范围的 OAuth 2.0 令牌
- personUrn:您的 LinkedIn 个人 URN(例如 urn:li:person:Abc123)
发送文本
使用 message 工具发送文本帖子:
message send --channel linkedin --text 您的帖子内容
该帖子将以公开帖子的形式发布到已认证用户的 LinkedIn 动态。
发送带图片的帖子
两步流程:
- 1. 创建图片 — 生成或定位图片文件(PNG/JPG/GIF/WebP)
- 发送带图片的帖子 — 使用带 --media 标志的 message send:
message send --channel linkedin --text 帖子标题 --media /path/to/image.png
支持的图片来源:
- - 本地文件路径:/Users/david/image.png
- file:// URL:file:///Users/david/image.png
- 远程 URL:https://example.com/image.png
图片上传流程(内部机制)
扩展程序会自动处理 LinkedIn UGC API 的三步流程:
- 1. 注册上传 → 获取 uploadUrl + asset URN
- 将二进制数据 PUT 到 uploadUrl
- 使用 asset 引用创建 UGC 帖子
您无需管理此流程 — 只需提供图片路径即可。
最佳实践
- - 始终确认 在发布前与所有者确认帖子内容
- 保持帖子简洁 — LinkedIn 偏好 150-300 字的帖子
- 在末尾添加话题标签,不要内嵌(最多 3-5 个)
- 对于 #BuildInPublic:包含您构建的内容、学到的经验、视觉元素
- 图片尺寸:链接预览 1200x627px,方形帖子 1080x1080px
- 未经明确所有者批准 绝不发布
帖子模板
#BuildInPublic 更新
🚀 [今天构建的内容]
[2-3 句话说明其功能及重要性]
技术栈:[列表]
[截图或图表]
#BuildInPublic #[主题] #[技术]
项目里程碑
✅ [达成的里程碑]
[简要背景 — 什么、为什么、如何实现]
关键收获:
→ [收获 1]
→ [收获 2]
→ [收获 3]
下一步:[即将推出的内容]
#[项目] #[主题]
技术深度解析
💡 今日所学:[学到的东西]
[2-3 段解释]
[相关代码片段或图表]
#TIL #[主题] #[技术]
故障排除
| 错误 | 原因 | 修复方法 |
|---|
| 401 未授权 | 令牌过期 | 重新认证,更新 channels.linkedin.accessToken |
| 403 禁止访问 |
缺少 w
membersocial 范围 | 使用正确的范围重新创建 OAuth 应用 |
| 图片上传 400 | 文件过大(>10MB) | 上传前压缩图片 |
| 空 postUrn | API 未返回 ID | 帖子可能已成功发布 — 检查 LinkedIn 动态 |