Official TypeScript/Node.js SDK for the HMS Sovereign Voice AI Platform. Zero dependencies, full type safety, and support for all API endpoints.Installation#
Requires Node.js 20 or later.Quick Start#
Resources#
All resources are available as properties on the client:| Resource | Description |
|---|
client.assistants | CRUD for AI voice assistants |
client.calls | List calls, make outbound calls, call control |
client.numbers | Phone number management |
client.campaigns | Outbound call campaigns with leads |
client.sipTrunks | SIP trunk configuration |
client.voices | List available TTS voices |
client.usage | Usage logs and billing |
client.byok | Bring Your Own Key management |
client.toolTemplates | Reusable tool/function templates |
client.analysisTemplates | Post-call analysis schemas |
client.domains | Custom domain configuration |
client.organizations | Organization management |
Outbound Calls#
Three configuration modes for outbound calls:Reference mode — use a saved assistant#
Transient mode — one-time assistant config#
Hybrid mode — saved assistant with overrides#
The metadata object is passed through to all webhook events at message.assistant.metadata.
Call Control#
Control active calls in real-time:
List endpoints return a Page with metadata:Iterate through all results automatically with listAll():Auto-pagination is available on client.calls.listAll() and client.usage.listAll().
Campaigns#
Run automated outbound call campaigns:
Webhook Verification#
The SDK provides built-in webhook signature verification. See Webhook Security for background.You must use express.raw() (or equivalent) to get the raw request body. Parsed JSON bodies will fail signature verification because the signature is computed over the original string.
Error Handling#
The SDK throws typed errors that you can catch with instanceof:All errors extend HmsSovereignError and include status, message, and code properties.
Configuration#
| Option | Default | Description |
|---|
apiKey | — | Your HMS Sovereign API key (required) |
baseUrl | https://api.hmsovereign.com/api/v1 | API base URL |
maxRetries | 2 | Automatic retries on 5xx and 429 responses |
timeout | 30000 | Request timeout in milliseconds |
debug | false | Log all HTTP requests and responses to console |
The SDK automatically retries failed requests with exponential backoff. On 429 responses, it respects the Retry-After header.
TypeScript#
The SDK is written in TypeScript and exports types for all resources. Import them directly:
Source & Issues#