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

b2brilliant-sdk

v0.1.4

Published

The Official Typescript SDK for the B2Brilliant Campaign Agent API

Readme

B2B Campaign Agent TypeScript SDK

A TypeScript client for the B2B Campaign Agent API that helps you generate personalized B2B campaigns by analyzing business websites and social media profiles.

Want to Join The Beta?

Visit here to register for beta access!

Installation

npm install b2brilliant-sdk

Basic Usage

import { B2BrilliantAgent } from 'b2brilliant-sdk';
// or: import B2BrilliantAgent from 'b2brilliant-sdk';

// Initialize with your API key
const agent = new B2BrilliantAgent({
  apiKey: 'your-api-key',
});

async function run(): Promise<void> {
  try {
    // Discover information about your business
    const userBusiness = await agent.user.discover([
      'https://yourbusiness.com'
    ]);

    // Discover information about a target business
    const targetBusiness = await agent.business.discover([
      'https://targetbusiness.com'
    ]);

    // Generate campaigns (email, DM, SMS)
    const campaigns = await agent.campaigns.create(
      userBusiness,
      targetBusiness,
      ['email', 'dm', 'sms']
    );

    // Use the generated campaigns
    console.log(campaigns);
  } catch (error) {
    console.error('Error:', error);
  }
}

run();

API Reference

Initialization

import { B2BrilliantAgent } from 'b2brilliant-sdk';

const agent = new B2BrilliantAgent({
  apiKey: 'your-api-key'             // Required 
});

User Business Methods

Discover User Business Information

import type { BusinessObject, BusinessDiscoveryOptions } from 'b2brilliant-sdk';

const options: BusinessDiscoveryOptions = {
  findCompetitors: true,
  findBranding: true,
  deepSearch: false
};

const userBusiness: BusinessObject = await agent.user.discover(
  ['https://yourbusiness.com', 'https://yourbusiness.com/about'],
  options
);

Refine User Business Information

const refinedBusiness: BusinessObject = await agent.user.refine(
  userBusiness, 
  "We recently launched a new service called 'Advanced Analytics'"
);

Target Business Methods

Discover Target Business Information

const targetBusiness: BusinessObject = await agent.business.discover(
  ['https://targetbusiness.com'],
  { findBranding: true }
);

Refine Target Business Information

const refinedTarget: BusinessObject = await agent.business.refine(
  targetBusiness,
  "They recently announced a Series B funding round"
);

Assess Business Compatibility

import type { BusinessCompatibilityScore } from 'b2brilliant-sdk';

const compatibility: BusinessCompatibilityScore = await agent.business.compatibility(
  userBusiness,
  targetBusiness
);

console.log(`Compatibility score: ${compatibility.score}`);
console.log('Positives:', compatibility.reasoning.positives);
console.log('Negatives:', compatibility.reasoning.negatives);
console.log('Recommendations:', compatibility.reasoning.recommendations);

Campaign Methods

Create Campaign

import type { CampaignObject, CampaignType } from 'b2brilliant-sdk';

// Generate all campaign types
const allCampaigns: CampaignObject = await agent.campaigns.create(
  userBusiness,
  targetBusiness
);

// Generate only specific campaign types
const campaignTypes: CampaignType[] = ['email', 'dm'];
const specificCampaigns: CampaignObject = await agent.campaigns.create(
  userBusiness,
  targetBusiness,
  campaignTypes
);

Refine Campaign

const refinedCampaigns: CampaignObject = await agent.campaigns.refine(
  userBusiness,
  targetBusiness,
  allCampaigns,
  "Make the tone more professional and focus on their recent funding"
);

Error Handling

The SDK throws typed errors that can be caught and handled:

import { ApiError, ValidationError } from 'b2brilliant-sdk';

try {
  const campaigns = await agent.campaigns.create(userBusiness, targetBusiness);
} catch (error) {
  if (error instanceof ApiError) {
    console.error(`API error (${error.status}):`, error.message);
    console.error('Error data:', error.data);
  } else if (error instanceof ValidationError) {
    console.error('Validation error:', error.validationErrors);
  } else {
    console.error('Unexpected error:', error);
  }
}

TypeScript Interfaces

The SDK provides full TypeScript support with the following key interfaces:

BusinessObject

interface BusinessObject {
  profile: {
    name: string;
    summary: string;
    services: string[];
    currentEvents: string;
    targetAudience: string;
    industry: string;
  };
  contacts: {
    pointOfContact?: {
      name: string;
      position: string;
    };
    social: BusinessChannels[];
    email: string;
    phone: string;
  };
  branding: {
    voice: string;
    tone: string;
    style: string;
    phrases: string[];
  };
  competitors?: Competitor[];
  confidence: {
    score: number; // 0-10
    reasoning: string;
  };
}

CampaignObject

interface CampaignObject {
  targetBusiness: string;
  userBusiness: string;
  campaigns: Campaign[];
}

interface Campaign {
  type: 'dm' | 'email' | 'sms';
  content: string;
  rating: number;
  feedback: {
    strengths: string[];
    weaknesses: string[];
    suggestions: string[];
  };
}

BusinessCompatibilityScore

interface BusinessCompatibilityScore {
  targetBusiness: string;
  userBusiness: string;
  score: number;
  reasoning: {
    positives: string[];
    negatives: string[];
    recommendations: string[];
  };
}

Configuration Options

interface BusinessDiscoveryOptions {
  findCompetitors?: boolean;
  findBranding?: boolean;
  deepSearch?: boolean;
  pointOfContact?: {
    name: string;
    position: string;
  };
}

License

This software is licensed under the Business Source License 1.1 (BSL).