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 🙏

© 2026 – Pkg Stats / Ryan Hefner

linkedin-lib

v1.5.5

Published

LinkedIn Auth & Posting SDK

Readme

linkedin-lib

LinkedIn Auth & Posting SDK. OAuth2, feed posts, images (single & multi), video, reactions. Uses LinkedIn Posts API (/rest/posts).

Install

npm i linkedin-lib

Setup

LINKEDIN_CLIENT_ID=your_client_id
LINKEDIN_CLIENT_SECRET=your_client_secret

Usage

const {
  getAuthorizationUrl,
  getAccessToken,
  getUserInfo,
  createPost,
  deletePost,
  reactToPost,
  unlikePost,
} = require('linkedin-lib');

Authorization

const url = getAuthorizationUrl('http://localhost:3456/callback');
// Open in browser → user authorizes → LinkedIn redirects back with ?code=

For company page posting, request w_organization_social scope:

const url = getAuthorizationUrl('http://localhost:3456/callback', 'openid profile email w_organization_social');

Exchange code for token

const token = await getAccessToken(code, 'http://localhost:3456/callback');

Get user profile

const user = await getUserInfo(token.access_token);
const authorUrn = `urn:li:person:${user.sub}`;

Create a text post

await createPost(token.access_token, 'urn:li:person:12345', 'Hello LinkedIn!');

Create a post with one image

const fs = require('fs');
await createPost(token.access_token, authorUrn, 'My photo', {
  image: { buffer: fs.readFileSync('./photo.png'), mimeType: 'image/png' }
});

Create a post with multiple images (up to 20)

const fs = require('fs');
await createPost(token.access_token, authorUrn, 'Gallery', {
  images: [
    { buffer: fs.readFileSync('./img1.png'), mimeType: 'image/png' },
    { buffer: fs.readFileSync('./img2.png'), mimeType: 'image/png' },
    { buffer: fs.readFileSync('./img3.png'), mimeType: 'image/png' },
  ]
});

Create a post with video

const fs = require('fs');
await createPost(token.access_token, authorUrn, 'My video', {
  video: { buffer: fs.readFileSync('./video.mp4'), mimeType: 'video/mp4' }
});

Delete a post

await deletePost(token.access_token, post.id);

React to a post

await reactToPost(token.access_token, post.urn, 'LIKE');
// Types: LIKE, PRAISE (Celebrate), EMPATHY (Love), INTEREST (Insightful),
//        APPRECIATION (Support), ENTERTAINMENT (Funny)

Requires w_member_social_feed scope.

Warning: w_member_social_feed is a partner-only scope. Most regular LinkedIn apps cannot request it. Check your app in LinkedIn Developer Portal to see if this scope is available.

Remove reaction

await unlikePost(token.access_token, post.urn);

API

| Method | Description | |---|---| | getAuthorizationUrl(redirectUri, scope?, state?) | Build OAuth2 authorization URL | | getAccessToken(code, redirectUri) | Exchange auth code for access token | | refreshAccessToken(refreshToken) | Refresh an expired access token | | getUserInfo(accessToken) | Get authenticated user's profile | | createPost(accessToken, authorUrn, commentary, options?) | Create a post. Options: image, images[], video, article | | deletePost(accessToken, postIdOrUrn) | Delete a post | | reactToPost(accessToken, postUrn, reactionType?) | React to a post (default: LIKE) | | unlikePost(accessToken, postUrn) | Remove your reaction |

The authorUrn can be urn:li:person:{id} or urn:li:organization:{id}. Company posting requires w_organization_social scope and appropriate page role.

Tests

npm test

Author

Andrii Chekh

GitHub: https://github.com/acvid3