Installation
Install the DialStack SDK using your preferred package manager.
Package Managers
# npm
npm install @dialstack/sdk
# yarn
yarn add @dialstack/sdk
# pnpm
pnpm add @dialstack/sdk
CDN (Vanilla JavaScript)
For non-bundled applications, use the UMD build via CDN:
<script src="https://unpkg.com/@dialstack/sdk"></script>
<script>
const dialstack = DialStack.initialize({
publishableKey: 'pk_live_YOUR_KEY',
});
</script>
Import Patterns
React Applications
// Full SDK with React components
import { initialize, DialstackComponentsProvider, CallLogs, Voicemails } from '@dialstack/sdk';
// Types
import type { DialStackInstance, CallLog, AppearanceOptions } from '@dialstack/sdk';
Vanilla JavaScript / Web Components
// Pure Web Components (no React dependency)
import { loadDialstackAndInitialize } from '@dialstack/sdk/pure';
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
}
}
For older TypeScript configurations using "moduleResolution": "node", you may need to use explicit subpath imports:
import { DialStack } from '@dialstack/sdk/server';
Peer Dependencies
The main SDK (@dialstack/sdk) requires React as a peer dependency:
{
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
}
If you're not using React, use the pure Web Components build:
import { loadDialstackAndInitialize } from '@dialstack/sdk/pure';
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
warning
Internet Explorer is not supported.
Next Steps
- Authentication - Set up session-based authentication
- React Components - Start building with React
- Web Components - Use without React