ReachScore Docs

TypeScript / Node.js SDK

Official TypeScript SDK for ReachScore with full type definitions.

Installation

npm install @reachscore/sdk
# or
yarn add @reachscore/sdk
# or
pnpm add @reachscore/sdk

Quick Start

example.tstypescript
12345678910111213141516
import { ReachScore } from '@reachscore/sdk'; const client = new ReachScore({ apiKey: process.env.REACHSCORE_API_KEY, }); // Create a test const test = await client.tests.create({ fromAddress: 'hello@yourdomain.com', subject: 'Welcome to our platform', htmlBody: '<h1>Hello!</h1>', providers: ['gmail', 'outlook'], }); console.log('Test ID:', test.id); console.log('Score:', test.score);

Configuration Options

const client = new ReachScore({
  apiKey: process.env.REACHSCORE_API_KEY,

  // Optional: custom base URL for self-hosted
  baseUrl: 'https://api.reachscore.co/v1',

  // Optional: request timeout in milliseconds
  timeout: 30000,

  // Optional: number of retries for failed requests
  maxRetries: 3,
});

Available Resources

ResourceDescription
client.testsCreate and manage deliverability tests
client.domainsDomain verification and health checks
client.monitorsScheduled monitoring jobs
client.webhooksWebhook endpoint management
client.alertsAlert rules and notifications

Error Handling

import { ReachScore, ReachScoreError } from '@reachscore/sdk';

try {
  const test = await client.tests.create({ ... });
} catch (error) {
  if (error instanceof ReachScoreError) {
    console.error('API Error:', error.message);
    console.error('Error Code:', error.code);
    console.error('Request ID:', error.requestId);
  }
}

Resources