DEV Community

david3xu
david3xu

Posted on

How to Post to LinkedIn from Your OpenClaw Agent

OpenClaw can send messages on Telegram, Discord, Slack — but LinkedIn posting wasn't supported. I patched the extension to add image uploads and published it as a ClawHub skill.

This guide covers setup from scratch: LinkedIn app, verification, OAuth token, skill install, and your first post.

Prerequisites

  • OpenClaw running (any install method)
  • A LinkedIn account
  • 10 minutes

Step 1: Create a LinkedIn App

  1. Go to linkedin.com/developers/apps
  2. Click Create app
  3. Fill in:
    • App name: OpenClaw Poster (or anything)
    • LinkedIn Page: select your page (create one if needed)
    • Logo: any image
  4. Click Create app

Step 2: Verify Your App

LinkedIn requires your app to be linked to a Company Page:

  1. Under the Settings tab, find App verification
  2. Click Verify — this sends a request to the Page admin
  3. If it's your own page, approve it from your Page admin notifications

Without verification, API calls will fail with 403.

Step 3: Add Required Products

Under the Products tab, request these two:

  1. Share on LinkedIn — grants w_member_social (needed for posting)
  2. Sign In with LinkedIn using OpenID Connect — grants openid, profile (needed to get your person URN)

Both are approved instantly for verified apps.

Step 4: Get Your Access Token

Under the Auth tab:

  1. Copy your Client ID and Client Secret
  2. Generate a token using LinkedIn's OAuth Token Generator or the 3-legged OAuth flow
  3. Make sure the token includes scopes: w_member_social, openid, profile

Save the access token — you'll need it in Step 7.

Step 5: Get Your Person URN

Your person URN is your LinkedIn user ID. Get it with:

curl -s -H "Authorization: Bearer YOUR_TOKEN" \
  "https://api.linkedin.com/v2/userinfo" | jq '.sub'
Enter fullscreen mode Exit fullscreen mode

The result looks like: urn:li:person:Abc123

Step 6: Install the Skill

npm install -g clawhub
clawhub install linkedin-poster
Enter fullscreen mode Exit fullscreen mode

Or browse it at: clawhub.ai/david3xu/linkedin-poster

Step 7: Configure OpenClaw

Add your LinkedIn credentials to ~/.openclaw/openclaw.json under channels:

{
  "channels": {
    "linkedin": {
      "accessToken": "YOUR_ACCESS_TOKEN",
      "personUrn": "urn:li:person:YOUR_ID",
      "enabled": true
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Restart the gateway to pick up the new config.

Step 8: Post from Your Agent

Text post:

message send --channel linkedin --text "Hello from OpenClaw"
Enter fullscreen mode Exit fullscreen mode

Image post:

message send --channel linkedin --text "Check this out" --media /path/to/image.png
Enter fullscreen mode Exit fullscreen mode

The skill handles LinkedIn's 3-step image upload automatically: register → upload binary → create post.

Troubleshooting

Error Fix
401 Unauthorized Token expired — regenerate in LinkedIn Developer portal
403 Forbidden Missing w_member_social scope — check app permissions
Image upload 400 File too large (>10MB) — compress first

What's Different About This Skill

The existing LinkedIn skill on ClawHub uses browser session cookies — ClawHub's security scanner flagged it as risky. This skill uses LinkedIn's official UGC API. No cookies, no scraping, no paid third-party service.


Built by David Xu

Skill: clawhub.ai/david3xu/linkedin-poster

Top comments (0)