@mattman240/portfolio-sdk
v0.1.1
Published
Server-side SDK for sending MM Labs portfolio events.
Readme
@mattman240/portfolio-sdk
Tiny server-side SDK for sending MM Labs portfolio events from your apps.
Install
npm install @mattman240/portfolio-sdkUsage
import { createPortfolioClient } from "@mattman240/portfolio-sdk";
const portfolio = createPortfolioClient({
ingestKey: process.env.PORTFOLIO_INGEST_KEY!,
businessSlug: process.env.PORTFOLIO_BUSINESS_SLUG!,
});
await portfolio.trackUserCreated({
userId: "user_123",
email: "[email protected]",
occurredAt: Date.now(),
});Methods
sendEvent(event)trackUserCreated(input)trackSubscriptionStarted(input)trackSubscriptionCanceled(input)trackRevenueRecorded(input)
Notes
- Use this server-side only.
- MM Labs currently prefers direct Stripe sync for billing truth.
- The SDK is best for app-originated events like account creation.
- By default, the SDK sends events to the MM Labs production ingest endpoint. You only need to pass
ingestUrlif you want to override it for another environment.
