npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@neonwatty/linkedin-cli

v1.0.2

Published

CLI tool for posting content and managing posts on LinkedIn

Readme

linkedin-cli

CLI tool for posting content and managing posts on LinkedIn via their Marketing API.

Prerequisites

  1. Create a LinkedIn Developer App at developer.linkedin.com
  2. Go to Products tab and request access to:
    • "Share on LinkedIn"
    • "Sign In with LinkedIn using OpenID Connect"
  3. Go to Auth tab and:
    • Copy your Client ID and Client Secret
    • Add redirect URL: http://localhost:3000/callback

Installation

npm install
npm run build
npm link  # Optional: makes linkedin-cli available globally

Usage

Authentication

First time setup:

linkedin-cli auth --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET

This opens your browser for LinkedIn authorization. After approval, your token is saved locally (valid for 60 days).

Check Status

# Show current user
linkedin-cli whoami

# Check token status
linkedin-cli status

Create Posts

# Text post
linkedin-cli post "Hello LinkedIn!"

# Post with image
linkedin-cli post "Check out this photo" --image photo.jpg

# Post with video
linkedin-cli post "Watch this" --video clip.mp4

# Connections only
linkedin-cli post "For my network" --visibility connections

Delete Posts

linkedin-cli delete <post-id>

Logout

linkedin-cli logout

CLI Options

COMMANDS:
  auth                    Authenticate with LinkedIn
  whoami                  Show current user info
  post <text>             Create a new post
  delete <post-id>        Delete a post
  status                  Show token status
  logout                  Clear saved tokens
  help                    Show help

POST OPTIONS:
  --image <path>          Attach an image (JPEG or PNG)
  --video <path>          Attach a video (MP4, MOV, AVI, WebM)
  --visibility <v>        public, connections, or logged_in (default: public)
  --image-title <title>   Title for the image
  --video-title <title>   Title for the video

Programmatic Usage

import { authenticate, createPost, getUserInfo } from "linkedin-cli";

// Authenticate (if not already)
await authenticate("client-id", "client-secret");

// Get user info
const profile = await getUserInfo();
console.log(profile.name, profile.urn);

// Create a text post
const post = await createPost({
  text: "Hello from the API!",
  visibility: "PUBLIC",
});
console.log(post.urn);

// Create post with image
const imagePost = await createPost({
  text: "Check this out!",
  imagePath: "/path/to/image.jpg",
});

Token Storage

Credentials and tokens are stored in ~/.linkedin-cli/:

  • credentials.json - Client ID/Secret
  • tokens.json - Access token and expiry

Tokens are valid for 60 days. Run linkedin-cli auth to re-authenticate when expired.

Rate Limits

LinkedIn rate limits are application-specific. The CLI implements:

  • Automatic error handling for 429 responses
  • Cached user URN to minimize API calls

Supported Media

Images: JPEG, PNG

Videos: MP4, MOV, AVI, WebM

License

MIT