Skip to main content

Use a maintained internal client wrapper today.

Until an official package is published, implement a shared internal client module and version it in your platform repo.
  • Base URL and auth header injection.
  • Structured error parsing (error_code, request_id).
  • Retry policy for transient failures.
  • Request timeout and telemetry hooks.
export async function callaro(path, init = {}) {
  const response = await fetch(`https://api.callaro.ai${path}`, {
    ...init,
    headers: {
      'X-Api-Key': process.env.CALLARO_API_KEY,
      'Content-Type': 'application/json',
      ...(init.headers ?? {})
    }
  });
  const payload = await response.json();
  if (!response.ok) throw new Error(`${payload.error_code}: ${payload.error}`);
  return payload;
}

Usage pattern

  1. Keep one client instance per service.
  2. Wrap endpoint calls in feature-specific modules (campaigns.ts, contacts.ts).
  3. Log request_id for failed calls.
  4. Add contract tests for critical workflows.

Maintained downloads guidance

  • Keep starter wrapper and examples in your internal template repo.
  • Pin required Node runtime in project tooling.
  • Update wrapper alongside API contract changes from changelog.