customerio-sdk-patterns

Featured

Apply production-ready Customer.io SDK patterns. Use when implementing typed clients, retry logic, event batching, or singleton management for customerio-node. Trigger: "customer.io best practices", "customer.io patterns", "production customer.io", "customer.io architecture", "customer.io singleton".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Customer.io SDK Patterns ## Overview Production-ready patterns for `customerio-node`: type-safe wrappers with enum-constrained events, retry with exponential backoff, event batching for high-volume scenarios, and singleton lifecycle management. ## Prerequisites - `customerio-node` installed - TypeScript project (recommended for type-safe patterns) - Understanding of your event taxonomy ## Instructions ### Pattern 1: Type-Safe Client Wrapper ```typescript // lib/customerio-typed.ts import { TrackClient, RegionUS, RegionEU } from "customerio-node"; // Define your event taxonomy as a union type type CioEvent = | { name: "signed_up"; data: { method: string; source?: string } } | { name: "plan_changed"; data: { from: string; to: string; mrr: number } } | { name: "feature_used"; data: { feature: string; duration_ms?: number } } | { name: "checkout_completed"; data: { order_id: string; total: number; items: number } } | { name: "subscription_cancelled"; data: { reason: string; feedback?: string } }; // Define user attributes with strict types interface CioUserAttributes { email: string; first_name?: string; last_name?: string; plan?: "free" | "starter" | "pro" | "enterprise"; company?: string; created_at?: number; // Unix seconds last_seen_at?: number; // Unix seconds [key: string]: unknown; // Allow additional attributes } export class TypedCioClient { private client: TrackClient; constructor(siteId: string, apiKey: string, re...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category