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

brazebee-sdk

v0.1.3

Published

Official TypeScript SDK for Brazebee customer journey tracking

Readme

Brazebee SDK

Official TypeScript SDK for tracking customer journey events with Brazebee.

Installation

npm install brazebee-sdk

Quick Start

import { BrazebeeClient } from 'brazebee-sdk';

// Initialize the client
const client = new BrazebeeClient({
  apiKeyAuth: 'brzb_live_your_api_key_here',
  environment: 'https://api.brazebee.com'
});

// Track an event
await client.events.track({
  company: {
    id: 'acme_corp',
    name: 'Acme Corporation',
    paymentProvider: 'stripe',
    paymentProviderId: 'cus_abc123',
    crmProvider: 'salesforce',
    crmProviderId: '001500000ABCDEFGH'
  },
  user: {
    id: 'user_123',
    email: '[email protected]',
    name: 'John Doe'
  },
  eventKey: 'feature_used',
  data: {
    feature: 'export',
    format: 'csv'
  }
});

Usage

Track User Events

Track events with user context:

await client.events.track({
  company: {
    id: 'acme_corp',
    name: 'Acme Corporation'
  },
  user: {
    id: 'user_123',
    email: '[email protected]',
    name: 'John Doe'
  },
  eventKey: 'onboarding_completed',
  data: {
    steps_completed: 5,
    time_taken_seconds: 180
  }
});

Track System Events

Track company-level events without a specific user:

await client.events.track({
  company: {
    id: 'acme_corp',
    name: 'Acme Corporation'
  },
  eventKey: 'plan_upgraded',
  data: {
    from_plan: 'starter',
    to_plan: 'professional',
    mrr_change: 50
  }
});

Custom Fields

Both company and user objects support custom fields:

await client.events.track({
  company: {
    id: 'acme_corp',
    name: 'Acme Corporation',
    // Standard optional fields
    paymentProvider: 'stripe',
    paymentProviderId: 'cus_abc123',
    crmProvider: 'salesforce',
    crmProviderId: '001abc',
    // Custom fields in data
  },
  user: {
    id: 'user_123',
    email: '[email protected]',
    name: 'John Doe'
  },
  eventKey: 'feature_used',
  data: {
    // Custom event data
    industry: 'technology',
    size: 'enterprise',
    plan: 'professional',
    mrr: 500,
    role: 'admin'
  }
});

Configuration

const client = new BrazebeeClient({
  apiKeyAuth: 'brzb_live_your_api_key_here',  // Required: Your Brazebee API key
  environment: 'https://api.brazebee.com'      // Required: Your Brazebee API URL
});

Configuration Options

| Option | Type | Required | Description | |--------|------|----------|-------------| | apiKeyAuth | string | ✅ Yes | Your Brazebee API key | | environment | string | ✅ Yes | Your Brazebee API base URL |

Error Handling

import { BrazebeeClient } from 'brazebee-sdk';

const client = new BrazebeeClient({
  apiKeyAuth: 'your_api_key',
  environment: 'https://api.brazebee.com'
});

try {
  await client.events.track({
    company: { id: 'acme_corp', name: 'Acme' },
    eventKey: 'feature_used'
  });
} catch (error: any) {
  if (error.statusCode === 400) {
    console.error('Bad Request:', error.message);
  } else if (error.statusCode === 401) {
    console.error('Unauthorized - Invalid API key');
  } else if (error.statusCode === 404) {
    console.error('Not Found - Event key not configured');
  } else if (error.statusCode === 429) {
    console.error('Rate limit exceeded');
  } else {
    console.error('Error:', error.message);
  }
}

API Reference

Track Event Request

interface TrackEventRequest {
  company: CompanyInfo;      // Required: Company information
  user?: UserInfo;           // Optional: User information (omit for system events)
  eventKey: string;          // Required: Event key matching your configuration
  data?: Record<string, any>; // Optional: Custom event data
  timestamp?: Date;          // Optional: Event timestamp (defaults to now)
}

Company Info

interface CompanyInfo {
  id: string;                  // Required: Unique company identifier
  name: string;                // Required: Company name
  paymentProvider?: string;    // Optional: e.g., 'stripe', 'paddle'
  paymentProviderId?: string;  // Optional: Customer ID in payment system
  crmProvider?: string;        // Optional: e.g., 'salesforce', 'hubspot'
  crmProviderId?: string;      // Optional: Account ID in CRM
}

User Info

interface UserInfo {
  id: string;      // Required: Unique user identifier
  email: string;   // Required: User email
  name: string;    // Required: User name
}

Field Naming Convention

Important: The TypeScript SDK uses camelCase for all fields:

| Correct (camelCase) ✅ | Incorrect (snake_case) ❌ | |----------------------|--------------------------| | eventKey | event_key | | paymentProvider | payment_provider | | paymentProviderId | payment_provider_id | | crmProvider | crm_provider | | crmProviderId | crm_provider_id |

Complete Example

import { BrazebeeClient } from 'brazebee-sdk';

const client = new BrazebeeClient({
  apiKeyAuth: process.env.BRAZEBEE_API_KEY!,
  environment: process.env.BRAZEBEE_API_URL!
});

// Example: Track onboarding completion with full details
await client.events.track({
  company: {
    id: 'acme_corp',
    name: 'Acme Corporation',
    paymentProvider: 'stripe',
    paymentProviderId: 'cus_MYwpG9X4kW7ZKi',
    crmProvider: 'salesforce',
    crmProviderId: '001500000ABCDEFGH'
  },
  user: {
    id: 'user_12345',
    email: '[email protected]',
    name: 'John Doe'
  },
  eventKey: 'onboarding_completed',
  data: {
    steps_completed: 7,
    time_taken_seconds: 420,
    completion_rate: 100,
    plan: 'enterprise',
    user_role: 'admin'
  }
});

Support

  • Documentation: https://docs.brazebee.com
  • Dashboard: https://app.brazebee.com
  • Email: [email protected]
  • GitHub: https://github.com/brazebee/brazebee-sdk-typescript

License

Apache-2.0