Installation
Install the DialStack SDK packages your app needs, using your preferred package manager.
Package Managers
For a React app:
# npm
npm install @dialstack/sdk-react @dialstack/sdk-js
# yarn
yarn add @dialstack/sdk-react @dialstack/sdk-js
# pnpm
pnpm add @dialstack/sdk-react @dialstack/sdk-js
@dialstack/sdk-js is required alongside @dialstack/sdk-react — it provides the core client, and importing it is what registers the underlying components.
For a Node.js backend, install @dialstack/sdk-server. To build a softphone without React, install @dialstack/sdk-webrtc. See the SDK overview for what each package covers.
CDN (Vanilla JavaScript)
For non-bundled applications, use the UMD build via CDN:
<script src="https://unpkg.com/@dialstack/sdk-js"></script>
<script>
const dialstack = DialStack.initialize({
publishableKey: 'pk_live_YOUR_KEY',
});
</script>
Import Patterns
React Applications
// Core client and types
import { initialize } from '@dialstack/sdk-js';
// The shared provider and hooks
import { DialstackComponentsProvider } from '@dialstack/sdk-react';
// Each component has its own import path
import { CallLogs } from '@dialstack/sdk-react/call-logs';
import { Voicemails } from '@dialstack/sdk-react/voicemails';
// Types
import type { DialStackInstance, CallLog, AppearanceOptions } from '@dialstack/sdk-js';
Vanilla JavaScript / Web Components
// Web Components, no React dependency. Importing this registers the custom elements
import { loadDialstackAndInitialize } from '@dialstack/sdk-js';
const dialstack = await loadDialstackAndInitialize({
publishableKey: 'pk_live_YOUR_KEY',
});
Server-Side (Node.js)
// Server SDK for API calls
import { DialStack } from '@dialstack/sdk-server';
const dialstack = new DialStack(process.env.DIALSTACK_API_KEY);
TypeScript Configuration
The SDK includes full TypeScript support. Ensure your tsconfig.json includes:
{
"compilerOptions": {
"moduleResolution": "bundler",
"esModuleInterop": true
}
}
Each package declares its own type entry points, so subpath imports such as @dialstack/sdk-react/call-logs resolve under "moduleResolution": "bundler" or "node16", and also under the legacy "moduleResolution": "node".
Peer Dependencies
@dialstack/sdk-js, @dialstack/sdk-webrtc, and @dialstack/sdk-server have no peer dependencies.
@dialstack/sdk-react expects these to be installed alongside it:
@dialstack/sdk-js, at the matching major version@xyflow/reactreactandreact-dom
Your package manager will report the exact ranges it expects if any are missing. Check @dialstack/sdk-react's peerDependencies for the versions a given release supports.
If you're not using React, use the Web Components in @dialstack/sdk-js instead:
import { loadDialstackAndInitialize } from '@dialstack/sdk-js';
Browser Compatibility
| Browser | Minimum Version |
|---|---|
| Chrome | 80+ |
| Firefox | 75+ |
| Safari | 13.1+ |
| Edge | 80+ |
Requirements:
- ES2015+ (ES6) support
- Web Components v1 (Custom Elements, Shadow DOM)
- Fetch API
Internet Explorer is not supported.
Next Steps
- Authentication - Set up session-based authentication
- React Components - Start building with React
- Web Components - Use without React