| name | linkedin-msg |
| description | LinkedIn messaging from the terminal — view conversations, read messages, search contacts, and send messages. No browser needed after initial auth. |
linkedin-msg
LinkedIn messaging from the terminal — view conversations, read messages, search contacts, and send messages. No browser needed after initial auth.
Prerequisites
- Node.js 22+ (uses built-in
fetch and crypto)
- Chrome with remote debugging enabled (only for
auth step)
- chrome-cdp skill (only for
auth step)
Setup
One-time authentication — extracts session cookies from an open LinkedIn tab in Chrome:
node scripts/linkedin-msg.mjs auth
This saves your LinkedIn session to disk. After auth, Chrome is no longer needed.
Usage
List conversations (inbox)
node scripts/linkedin-msg.mjs inbox
node scripts/linkedin-msg.mjs inbox --count=50
node scripts/linkedin-msg.mjs inbox --category=INMAIL
Output shows participant names, timestamps, unread counts, message previews, and conversation URNs. Results are cached for use with messages and send.
View messages in a conversation
node scripts/linkedin-msg.mjs messages urn:li:msg_conversation:...
node scripts/linkedin-msg.mjs messages 1
Search contacts
node scripts/linkedin-msg.mjs search "John"
node scripts/linkedin-msg.mjs search "Anıl Seyrek"
Shows matching conversations with participant names, profile URNs, and conversation URNs.
Send a message
node scripts/linkedin-msg.mjs send https://linkedin.com/in/emrahyalaz "Hello!"
node scripts/linkedin-msg.mjs send emrahyalaz "Hello from CLI"
node scripts/linkedin-msg.mjs send "Anıl Seyrek" "Hello!"
node scripts/linkedin-msg.mjs send urn:li:fsd_profile:ACoAAAB0OpgBZOZ1m040shN_2CxvGsj7uzP70Dc "Hello!"
node scripts/linkedin-msg.mjs send ACoAAAB0OpgBZOZ1m040shN_2CxvGsj7uzP70Dc "Hello!"
node scripts/linkedin-msg.mjs send urn:li:msg_conversation:... "Thanks!"
The send command resolves recipients in this order:
- Direct URN or conversation URN (if provided)
- Vanity name → profile API lookup
- Fallback: searches existing conversations by name (handles profiles where the API returns 403)
Show help
node scripts/linkedin-msg.mjs
How it works
-
auth — Connects to Chrome via CDP, extracts all LinkedIn cookies (including httpOnly li_at) using Network.getCookies, fetches your own profile URN via the /me API, and saves everything locally.
-
inbox — Calls the voyagerMessagingGraphQL conversations endpoint to list conversations with participant names, timestamps, unread counts, and message previews.
-
messages — Calls the voyagerMessagingGraphQL messages endpoint to fetch all messages in a conversation with sender names and timestamps.
-
search — Fetches conversations and filters by participant name (case-insensitive partial match). Shows profile URNs for matching participants.
-
send — Resolves the recipient's profile URN (via profile API or conversation search fallback), then POSTs to voyagerMessagingDashMessengerMessages?action=createMessage.
Data storage
All data is stored in:
~/.local/share/showrun/data/linkedin-msg/
├── session.json # Auth cookies, CSRF token, your profile URN
├── profiles.json # Cached vanity name → URN mappings
└── cache/
├── conversations.json # Last inbox fetch
└── messages_*.json # Cached message threads
session.json contains your LinkedIn session cookies. LinkedIn sessions typically last ~1 year. Re-run auth if you get 401/403 errors.
profiles.json caches profile URN lookups so repeated messages to the same person skip the resolve step.
cache/ stores conversation and message data from recent API calls.
Session expiry
If you see Failed (HTTP 401) or Failed (HTTP 403), your session has expired. Open LinkedIn in Chrome and re-run:
node scripts/linkedin-msg.mjs auth