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

@openpromo/linkedin

v0.7.0

Published

Type-safe TypeScript SDK for LinkedIn organic publishing and OAuth

Readme

@openpromo/linkedin

Type-safe TypeScript SDK for LinkedIn organic publishing, OAuth, and the complete documented Marketing API operation surface.

LinkedIn does not currently publish a public OpenAPI/Swagger spec or public per-endpoint Rest.li restspec for the Marketing API surfaces this package wraps. This SDK is hand-authored against the official Microsoft Learn endpoint docs and LinkedIn's Rest.li protocol documentation. The low-level catalog is generated from all 11 public collections in LinkedIn's official Marketing Solutions Postman workspace. Postman collections describe operations rather than full response schemas, so generated inputs and outputs remain honest unknown boundaries while the curated publishing and analytics clients retain richer types.

The current snapshot emits all 285 callable requests. One additional "Get document content" placeholder is recorded as excluded because the provider source contains no URL. A public Postman collection does not grant API access: operations are tagged as community, marketing, partner, or restricted according to the LinkedIn product approval they require. The generator leaves scopes unknown when the collection does not declare them instead of guessing.

The default LinkedIn-Version is 202607. Callers can still supply apiVersion explicitly for a different supported monthly release.

Install

bun add @openpromo/linkedin
# or
npm install @openpromo/linkedin

Use

import { LinkedIn } from "@openpromo/linkedin";

const linkedin = LinkedIn.createClient({
  accessToken: process.env.LINKEDIN_ACCESS_TOKEN!,
});

const result = await linkedin.posts.createText({
  authorUrn: "urn:li:organization:123456",
  commentary: "New launch is live.",
});

console.log(result.postUrn);

Publish Media

const imageUrn = await linkedin.assets.uploadImageFromUrl(
  "urn:li:organization:123456",
  "https://cdn.example.com/photo.jpg",
);

await linkedin.posts.createImage({
  authorUrn: "urn:li:organization:123456",
  commentary: "Behind the scenes.",
  imageUrn,
  options: { altText: "A team photo" },
});

Video initialization supports LinkedIn's optional templateName and linkbackContext media attribution fields introduced in the 202602 API and available in the current 202607 release.

OAuth

const oauth = LinkedIn.OAuth.create({
  clientId: process.env.LINKEDIN_CLIENT_ID!,
  clientSecret: process.env.LINKEDIN_CLIENT_SECRET!,
  redirectUri: "https://app.example.com/oauth/linkedin/callback",
});

const url = oauth.getAuthorizationUrl({ state: "opaque-state" });

Low-level post analytics

const organizationStats = await linkedin.analytics.getOrganizationShareStatistics({
  organizationalEntity: "urn:li:organization:123456",
  shares: ["urn:li:share:7132564752928563200"],
});

const memberStats = await linkedin.analytics.getMemberPostAnalytics({
  entity: "urn:li:ugcPost:7132564752928563200",
  queryType: "IMPRESSION",
});

Complete generated API catalog

Use the generated catalog when a high-level helper does not yet cover an operation. Operations have stable, searchable IDs and preserve fixed finder/action query strings plus X-RestLi-Method semantics from the official collection.

import {
  createLinkedInGeneratedClient,
  LinkedInClient,
  linkedinOperations,
} from "@openpromo/linkedin";

const client = new LinkedInClient({ accessToken: process.env.LINKEDIN_ACCESS_TOKEN! });
const api = createLinkedInGeneratedClient(client);

const candidates = api.search("campaign analytics");
console.log(candidates.map(({ id, name }) => ({ id, name })));

await api.invoke(candidates[0]!.id, {
  variables: { sponsoredaccount_id: "123456" },
  query: { count: 100 },
});

LinkedInClient.request also accepts nested Rest.li query values, fixed Rest.li method headers, and opt-in or automatic query tunneling for oversized URLs.

Refreshing generated sources

bun run codegen:refresh # fetch and normalize the official public Postman collections
bun run codegen         # reproducible generation from the checked-in normalized snapshot
bun run codegen:check   # verify generated artifacts are current

The checked-in source manifest records included and intentionally excluded workspace entries at spec/postman-sources.json. Never hand-edit generated files under src/generated/.

Official References