JSPM

@promobase/ad-platforms

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q96645F
  • License MIT

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

Package Exports

  • @promobase/ad-platforms
  • @promobase/ad-platforms/ai

Readme

openpromo

@promobase/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, and Google Ads. Fully typed, generated from official specs, 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 @promobase/ad-platforms
# or
npm install @promobase/ad-platforms

Use

import { Meta, TikTok, Google } from "@promobase/ad-platforms";
import { createAllTools } from "@promobase/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",
});

// 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
  • 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
@promobase/meta-business-sdk-ts Meta only (Facebook, Instagram, Threads)
@promobase/tiktok-business-sdk TikTok only
@promobase/google-ads-sdk Google Ads only

License

MIT © Promobase