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

@billdog.io/notifications

v1.1.1-beta.4

Published

BillDog Notifications Module - Schedule and manage in-app notifications

Readme

@billdog.io/notifications

Comprehensive notifications SDK for BillDog with advanced analytics, campaign management, A/B testing, and third-party integrations.

Features

Core Notifications

  • ✅ Push notifications (iOS, Android, Web, Huawei)
  • ✅ In-app messages
  • ✅ Permission management
  • ✅ Device registration
  • ✅ User tagging and segmentation

Advanced Analytics & Reporting

  • ✅ Comprehensive metrics (delivery, open, click, conversion rates)
  • ✅ Platform-specific analytics
  • ✅ Time-series data
  • ✅ Time-to-conversion analysis
  • ✅ Campaign performance tracking
  • ✅ A/B test results with statistical significance
  • ✅ Export to CSV/JSON

Campaign Management

  • ✅ Create and manage campaigns
  • ✅ Immediate, scheduled, and recurring campaigns
  • ✅ Frequency capping
  • ✅ Advanced targeting and segmentation
  • ✅ Campaign pause/resume
  • ✅ Campaign analytics

Segmentation & Targeting

  • ✅ User segmentation with complex criteria
  • ✅ Dynamic segment evaluation
  • ✅ Segment testing
  • ✅ Behavioral targeting
  • ✅ Attribute-based targeting

Batch Operations

  • ✅ Send bulk notifications efficiently
  • ✅ Priority queuing (high/normal/low)
  • ✅ Scheduled batch sends
  • ✅ Deduplication
  • ✅ Batch status tracking

Integration Layer

  • ✅ OneSignal integration
  • ✅ Firebase Cloud Messaging
  • ✅ Airship (Urban Airship)
  • ✅ Custom provider support
  • ✅ Device sync from external providers

Server-authoritative audience

Campaign audience, segment membership, channel eligibility, consent, and targeting rules are resolved by BillDog server-side delivery endpoints. The Notifications SDK handles device registration, display, and lifecycle events; it does not import or evaluate @billdog.io/segments or @billdog.io/targeting at runtime.

Installation

npm install @billdog.io/notifications @billdog.io/core

Quick Start

import { notifications } from '@billdog.io/notifications';

// Configure SDK
notifications.configure({
  apiKey: 'your-api-key',
  projectUrl: 'https://your-project.supabase.co',
  enableLogging: true
});

// Request permission
const status = await notifications.requestPermission();

// Register device
await notifications.registerDevice(pushToken, 'ios');

// Set user ID
await notifications.setExternalUserId('user_123');

Advanced Usage

Analytics & Reporting

// Get comprehensive analytics
const analytics = await notifications.getAnalytics(
  new Date('2024-01-01'),
  new Date('2024-01-31'),
  {
    platform: 'ios',
    campaignId: 'campaign_123'
  }
);

console.log('Conversion rate:', analytics.conversion_rate);
console.log('Total revenue:', analytics.total_revenue);

// Get campaign stats
const campaignStats = await notifications.getCampaignStats('campaign_123');

// Get A/B test results
const abResults = await notifications.getABTestResults('test_123');
console.log('Winner:', abResults.winner);
console.log('Confidence:', abResults.confidence_level);

// Export data
const csvBlob = await notifications.exportAnalytics(
  new Date('2024-01-01'),
  new Date('2024-01-31'),
  'csv'
);

Campaign Management

// Create campaign
const campaignId = await notifications.createCampaign({
  name: 'Weekend Sale',
  content: {
    title: '50% Off This Weekend!',
    body: 'Shop now and save big',
    data: { promo_code: 'WEEKEND50' }
  },
  targeting: {
    conditions: [
      { field: 'subscription_status', operator: 'eq', value: 'active' },
      { field: 'last_purchase_days', operator: 'gte', value: 30 }
    ],
    operator: 'AND'
  },
  schedule: {
    type: 'scheduled',
    startDate: new Date('2024-02-10T09:00:00Z'),
    endDate: new Date('2024-02-12T23:59:59Z')
  },
  frequencyCap: {
    maxSends: 1,
    periodHours: 24
  }
});

// Pause campaign
await notifications.toggleCampaign(campaignId, false);

Segmentation

// Create segment
const segmentId = await notifications.createSegment({
  name: 'High-Value Churned Users',
  description: 'Users with high LTV who haven\'t purchased in 60 days',
  criteria: {
    conditions: [
      { field: 'lifetime_value', operator: 'gte', value: 1000 },
      { field: 'last_purchase_days', operator: 'gte', value: 60 }
    ],
    operator: 'AND'
  }
});

// Get users in segment
const users = await notifications.getSegmentUsers(segmentId);

Batch Operations

// Send batch notifications
const result = await notifications.sendBatch({
  notifications: [
    {
      user_id: 'user_1',
      payload: { title: 'Welcome!', body: 'Thanks for signing up' }
    },
    // ... more notifications
  ],
  priority: 'high'
});

console.log('Batch ID:', result.batch_id);

Third-Party Integrations

// Connect OneSignal
await notifications.connectProvider({
  type: 'onesignal',
  credentials: {
    app_id: 'your-onesignal-app-id',
    api_key: 'your-onesignal-api-key'
  }
});

// Sync devices
const syncResult = await notifications.syncWithProvider('onesignal');

Event Handlers

// Handle received notifications
notifications.setNotificationReceivedHandler((payload) => {
  console.log('Notification received:', payload);
});

// Handle opened notifications
notifications.setNotificationOpenedHandler((payload, actionId) => {
  console.log('Notification opened:', payload, actionId);
});

// Handle in-app message clicks
notifications.setInAppMessageClickedHandler((message, actionId) => {
  console.log('In-app message clicked:', message, actionId);
});

Edge Functions

The SDK uses the following edge functions:

  • notification-analytics - Fetch comprehensive analytics
  • notification-batch-send - Send bulk notifications
  • notification-export - Export data to CSV/JSON
  • notification-integration-sync - Sync with third-party providers
  • send-push-notification - Send individual notifications
  • ingest-events - Track opens / conversions / engagement analytics (canonical)
  • fcm-delivery-webhook / apns-delivery-callback / email-webhook / sms-webhook - Channel-specific delivery state callbacks
  • email-click-tracker - Email click attribution
  • register-push-device - Register device tokens

License

MIT