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

@tritonium/api-client

v2.1.1

Published

Official TypeScript/JavaScript SDK for the Tritonium API - Customer feedback analytics platform

Readme

@tritonium/api-client

Official TypeScript/JavaScript SDK for the Tritonium API - Customer feedback analytics platform.

Installation

npm install @tritonium/api-client

Quick Start

Using API Key Authentication

import { configureApiKey, AppsService } from '@tritonium/api-client';

// Configure authentication
configureApiKey('trtn_live_your_key_here');

// Make API calls
const apps = await AppsService.getApps();
console.log(apps);

Using Bearer Token (JWT)

import { configureBearerToken, AppsService } from '@tritonium/api-client';

// Configure with Cognito JWT token
configureBearerToken('your_jwt_token');

// Make API calls
const apps = await AppsService.getApps();

Authentication

The SDK supports two authentication methods:

API Key Authentication

Best for server-side applications and integrations.

import { configureApiKey } from '@tritonium/api-client/auth';

configureApiKey('trtn_live_abc123...');

// Or with a custom base URL
configureApiKey('trtn_test_abc123...', 'https://staging-api.tritonium.com');

Bearer Token Authentication

Best for applications with existing Cognito authentication.

import { configureBearerToken } from '@tritonium/api-client/auth';

configureBearerToken('eyJhbGciOiJSUzI1NiIs...');

Advanced Configuration

import { configure, getConfiguration, clearAuth } from '@tritonium/api-client/auth';

// Configure with multiple options
configure({
  apiKey: 'trtn_live_abc123...',
  baseUrl: 'https://staging-api.tritonium.com',
  headers: { 'X-Custom-Header': 'value' },
});

// Check current configuration
const config = getConfiguration();
console.log(config.hasApiKey); // true

// Clear authentication
clearAuth();

Webhook Verification

Verify incoming webhooks from Tritonium to ensure they're authentic.

import express from 'express';
import {
  verifyWebhook,
  WebhookVerificationError,
  EventTypes,
} from '@tritonium/api-client/webhooks';

const app = express();
const WEBHOOK_SECRET = 'whsec_your_secret';

app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  try {
    const event = verifyWebhook({
      payload: req.body,
      signature: req.headers['x-tritonium-signature'] as string,
      timestamp: req.headers['x-tritonium-timestamp'] as string,
      secret: WEBHOOK_SECRET,
    });

    switch (event.eventType) {
      case EventTypes.REVIEW_RECEIVED:
        console.log('New review:', event.data);
        break;
      case EventTypes.ALERT_TRIGGERED:
        console.log('Alert:', event.data);
        break;
      case EventTypes.CRISIS_DETECTED:
        console.log('Crisis detected:', event.data);
        break;
    }

    res.json({ status: 'ok' });
  } catch (e) {
    if (e instanceof WebhookVerificationError) {
      console.error('Webhook verification failed:', e.message);
      res.status(401).json({ error: e.message });
    } else {
      throw e;
    }
  }
});

Webhook Event Types

| Event Type | Description | |------------|-------------| | review.received | New review was received | | alert.triggered | Alert rule was triggered | | crisis.detected | Crisis event was detected | | insight.generated | New insight was generated | | analysis.completed | Analysis job completed | | test.ping | Test webhook (manual trigger) |

Typed Event Data

import type {
  ReviewReceivedData,
  AlertTriggeredData,
  CrisisDetectedData,
} from '@tritonium/api-client/webhooks';

// Type-safe event handling
const event = verifyWebhook<ReviewReceivedData>({ ... });
console.log(event.data.review_id);
console.log(event.data.rating);

Available Services

| Service | Description | |---------|-------------| | AppsService | Manage connected apps and platforms | | ReviewsService | Access and manage reviews | | AlertsService | Configure and manage alerts | | InsightsService | Access generated insights | | IntegrationsService | Manage integrations (Slack, etc.) | | RatingsService | Access ratings and analytics | | PredictionsService | ML predictions and forecasting | | BillingService | Subscription and billing | | CredentialsService | Manage API credentials (Admin) | | WorkflowsService | Workflow automation | | UsersService | User management | | HealthService | API health checks |

Service Examples

Managing Apps:

import { AppsService } from '@tritonium/api-client';

// List all connected apps
const apps = await AppsService.getApps();

// Connect a new app
const newApp = await AppsService.connectApp({
  platform: 'app_store',
  external_app_id: '123456789',
  credential_id: 'cred-abc'
});

// Trigger review sync
await AppsService.syncReviews({ app_uuid: 'app-123' });

Working with Reviews:

import { ReviewsService } from '@tritonium/api-client';

// Get reviews with filters
const reviews = await ReviewsService.getReviews({
  app_uuid: 'app-123',
  rating_min: 1,
  rating_max: 3,
  limit: 50
});

// Generate AI reply suggestion
const reply = await ReviewsService.generateReply({
  app_uuid: 'app-123',
  review_id: 'review-456'
});

// Post reply to store
await ReviewsService.postReply({
  app_uuid: 'app-123',
  review_id: 'review-456',
  text: reply.suggested_text
});

Predictions & Forecasting:

import { PredictionsService } from '@tritonium/api-client';

// Get rating forecast
const forecast = await PredictionsService.getRatingForecast({
  app_uuid: 'app-123',
  horizon: 30
});
console.log(`Predicted rating: ${forecast.forecasted_rating}`);

// Estimate feature impact
const impact = await PredictionsService.estimateFeatureImpact({
  app_uuid: 'app-123',
  feature_type: 'bug_fix',
  affected_topics: ['crashes', 'performance']
});

Managing Credentials (Admin only):

import { CredentialsService } from '@tritonium/api-client';

// List credentials
const credentials = await CredentialsService.listCredentials();

// Create new credential
await CredentialsService.createCredential({
  name: 'App Store Connect',
  platform: 'app_store',
  credentials: {
    key_id: 'ABC123',
    issuer_id: 'xxx-yyy-zzz',
    private_key: '-----BEGIN PRIVATE KEY-----...'
  }
});

Workflow Automation:

import { WorkflowsService } from '@tritonium/api-client';

// List workflow templates
const templates = await WorkflowsService.listTemplates();

// Create workflow from template
const workflow = await WorkflowsService.createFromTemplate({
  name: 'Daily Digest',
  template_id: 'weekly-digest',
  config: {
    schedule: '0 9 * * *',
    channels: ['slack']
  }
});

// Pause a workflow
await WorkflowsService.pauseWorkflow({ workflow_id: workflow.id });

Error Handling

import { ApiError } from '@tritonium/api-client';

try {
  const apps = await AppsService.getApps();
} catch (error) {
  if (error instanceof ApiError) {
    console.error(`API Error ${error.status}: ${error.message}`);
    console.error('Response body:', error.body);
  } else {
    throw error;
  }
}

TypeScript Support

This SDK is written in TypeScript and includes full type definitions. All models and services are fully typed.

import type { AppSummary, ReviewSummary, Alert } from '@tritonium/api-client';

Requirements

  • Node.js >= 18.0.0
  • TypeScript >= 5.0 (for TypeScript users)

License

MIT