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/ad-platforms

v0.8.0

Published

Unified type-safe TypeScript SDK for Meta (Facebook, Instagram, Threads), TikTok, LinkedIn, X, YouTube, and future ad platforms — single install, single namespace

Downloads

1,078

Readme

@openpromo/ad-platforms

Type-safe TypeScript SDKs for every ad platform. One install. AI-agent ready.

Powering openpromo.app — the AI-native social media workspace.

npm CI License


What

One umbrella package for Meta (Facebook, Instagram, Threads), TikTok, LinkedIn, X, YouTube, and Google Ads. Fully typed, generated from official specs where available, with high-level clients for publishing, messaging, ad management, and typed GAQL queries — plus AI SDK tools ready to drop into any agent.

Install

bun add @openpromo/ad-platforms
# or
npm install @openpromo/ad-platforms

Agent-native operations

The operation catalog is the stable layer for code-writing agents, MCP hosts, and applications that want consistent cross-platform semantics. Provider SDKs remain available as the raw layer.

Configure existing platform clients once and use the normalized direct API:

import { Meta, TikTok } from "@openpromo/ad-platforms";
import { createAdPlatforms } from "@openpromo/ad-platforms/operations";
import { YouTube } from "@openpromo/ad-platforms/youtube";

const meta = Meta.createClient({ accessToken: process.env.META_TOKEN! });
const instagram = Meta.Instagram.createClient({ api: meta, igAccountId: "ig_123" });
const tiktok = TikTok.createClient({
  accessToken: process.env.TIKTOK_TOKEN!,
  businessId: "business_123",
});
const youtube = YouTube.createClient({ accessToken: process.env.YOUTUBE_TOKEN! });

const ads = createAdPlatforms({
  connections: { instagram, tiktok, youtube },
});

const metrics = await ads.instagram.posts.getMetrics({
  postId: "media_123",
  metrics: ["views", "reach", "likes"],
});

// Common metrics are portable; provider retains the native response.
console.log(metrics.common.views, metrics.provider);

The same invocation and schemas power discovery and generic execution:

const matches = ads.operations.search("YouTube video statistics");
const docs = ads.operations.describe("youtube.posts.metrics.get");
const result = await ads.operations.invoke("youtube.posts.metrics.get", {
  postId: "video_123",
});

AI SDK

import { toAiSdkTools } from "@openpromo/ad-platforms/operations/ai";

const tools = toAiSdkTools(ads.operations, { platform: ["instagram", "youtube"] });

Cloudflare Code Mode

The Code Mode adapter has no Cloudflare runtime dependency. It returns a structural connector definition whose tools can be returned directly from a CodemodeConnector.tools() implementation.

import { toCodemodeConnector } from "@openpromo/ad-platforms/operations/codemode";

const instagram = toCodemodeConnector(ads.operations, { platform: "instagram" });

// In a CodemodeConnector subclass:
// name() { return instagram.name }
// instructions() { return instagram.instructions }
// tools() { return instagram.tools }

Each definition includes input and output JSON Schema, read/write effect metadata, approval policy, replay behavior, and optional rollback support derived from the canonical operation definition.

MCP and CLI hosts

@openpromo/ad-platforms-cli/mcp exports registerOperationCatalog(). The companion @openpromo/ad-platforms-cli/operations entry exports registerOperationCatalogCommands() for adding operations list, search, describe, and invoke commands to a Commander program.

The initial catalog intentionally contains read-only posts.getMetrics operations for Instagram, Facebook, Threads, TikTok, LinkedIn, X, and YouTube. Generated and provider-native APIs remain available through each SDK for capabilities that have not yet been promoted into the canonical operation layer.

Use

import { Meta, TikTok, LinkedIn, Google } from "@openpromo/ad-platforms";
import { X } from "@openpromo/ad-platforms/x";
import { YouTube } from "@openpromo/ad-platforms/youtube";
import { createAllTools } from "@openpromo/ad-platforms/ai";
import { generateText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";

// Meta (Facebook, Instagram, Threads)
const meta = Meta.createClient({ accessToken: process.env.META_TOKEN! });
const ig = Meta.Instagram.createClient({ api: meta, igAccountId: "ig_123" });
await ig.media.publishVideo({
  videoUrl: "https://cdn.example.com/reel.mp4",
  caption: "New drop 🔥",
});

// TikTok
const tiktok = TikTok.createClient({
  accessToken: process.env.TIKTOK_TOKEN!,
  businessId: "biz_456",
});

// LinkedIn organic publishing
const linkedin = LinkedIn.createClient({
  accessToken: process.env.LINKEDIN_TOKEN!,
});
await linkedin.posts.createText({
  authorUrn: "urn:li:organization:123456",
  commentary: "New launch is live.",
});

// X organic publishing
const x = X.createClient({
  token: process.env.X_TOKEN!,
});
await x.tweets.createPosts({
  text: "New launch is live.",
});

// YouTube publishing
const youtube = YouTube.createClient({
  accessToken: process.env.YOUTUBE_TOKEN!,
});
await youtube.resources.channels.list({
  part: ["snippet"],
  mine: true,
});

// Google Ads — customer-bound ergonomic flows + typed GAQL
const google = Google.createClient({
  getAccessToken: async () => process.env.GOOGLE_ADS_TOKEN!,
  developerToken: process.env.GOOGLE_ADS_DEV_TOKEN!,
});
const customer = Google.Ads.customer(google, "9999999999");
const { rows } = await customer.gaql
  .from("campaign")
  .select("campaign.id", "campaign.name", "metrics.clicks")
  .where("campaign.status = 'ENABLED'")
  .limit(100)
  .execute();

// Give an AI agent access to every platform
const tools = createAllTools({
  meta: { api: meta, igAccountId: "ig_123", pageId: "p_456", pageAccessToken: "..." },
  tiktok: { accessToken: "...", businessId: "biz_456" },
});

await generateText({
  model: anthropic("claude-sonnet-4-20250514"),
  tools,
  maxSteps: 10,
  prompt: "Post this photo to Instagram and TikTok, then reply to recent comments",
});

Features

  • Meta — 994 typed Graph API objects, field-level narrowing via Pick<>, IG/FB/Threads publishing, inbox, OAuth, rate limiting, batch API
  • TikTok — OAuth, content publishing, comments, webhooks
  • LinkedIn — OAuth, organization lookup, organic text/image/multi-image/video posts, comments, media upload helpers
  • X — Fern-generated X API v2 client for posts, users, and media upload from the official OpenAPI spec
  • YouTube — Discovery-generated YouTube Data API v3 client plus resumable video upload helper
  • Google Ads — 184 resource types, 111 services, customer-bound factory, typed GAQL builder with row-level narrowing
  • AI SDK tools — filterable, middleware-ready, two-stage routing
  • Runtime agnostic — native fetch, no axios, works in Bun, Node, Deno, edge
  • Retry + rate limiting — automatic recovery, pluggable throttling

Individual packages

| Package | Description | |---------|-------------| | @openpromo/meta | Meta only (Facebook, Instagram, Threads) | | @openpromo/tiktok | TikTok only | | @openpromo/linkedin | LinkedIn only | | @openpromo/x | X only | | @openpromo/youtube | YouTube only | | @openpromo/google-ads | Google Ads only |

License

MIT © OpenPromo