JavaScript SDK
The official JavaScript SDK for DialStack lets you embed voice capabilities directly into your application with ready-to-use components for call logs, voicemails, and more.
Packages
The SDK ships as four packages. Install the ones your app needs:
| Package | Use Case |
|---|---|
@dialstack/sdk-js | Core client, types, and the Web Components. Required by @dialstack/sdk-react |
@dialstack/sdk-react | React components and hooks |
@dialstack/sdk-webrtc | Headless calling client for building a softphone. Standalone |
@dialstack/sdk-server | Node.js backend for session creation and API calls |
For vanilla JavaScript and Web Components, use @dialstack/sdk-js — importing it registers the custom elements for you. @dialstack/sdk-js/pure is the side-effect-free alternative for server-side rendering and tests, where you register the elements yourself.
Each React component has its own import path, so your app only pulls in what it uses. The @dialstack/sdk-react root provides the shared provider and hooks.
Installation
Bash
npm install @dialstack/sdk-react @dialstack/sdk-js
Quick Example
TypeScript
import { initialize } from '@dialstack/sdk-js';
import { DialstackComponentsProvider } from '@dialstack/sdk-react';
import { CallLogs } from '@dialstack/sdk-react/call-logs';
const dialstack = initialize({
publishableKey: 'pk_live_YOUR_KEY',
});
function App() {
return (
<DialstackComponentsProvider dialstack={dialstack} clientSecret={clientSecret}>
<CallLogs />
</DialstackComponentsProvider>
);
}
What's Included
Embedded Components
- CallHistory - Display recent call history in a compact format
- CallLogs - Display call history with filtering, pagination, and formatting
- Voicemails - List voicemails with audio playback and transcription
Server SDK
- Accounts - Create and manage customer accounts
- Users - Manage users within accounts
- Sessions - Create secure session tokens for embedded components
Next Steps
- Installation - Detailed installation instructions
- Authentication - Learn about session-based authentication
- React Components - Get started with React
- Web Components - Use with vanilla JavaScript
- Server SDK - Backend API integration