@getdial/sdk
v0.1.2
Published
Official Dial SDK — phone numbers, SMS, WhatsApp, and voice calls for AI agents
Readme
@getdial/sdk
Official Node.js SDK for Dial — phone numbers, SMS, WhatsApp, and AI voice calls for AI agents.
Installation
npm install @getdial/sdkUsage
import { DialClient } from "@getdial/sdk";
const client = new DialClient({
apiKey: "sk_live_...",
});Examples
List phone numbers
const numbers = await client.listNumbers();
console.log(numbers);Send an SMS
await client.sendMessage({
to: "+1234567890",
fromNumberId: numbers[0].id,
body: "Hello from Dial!",
channel: "sms", // or "whatsapp"
});Make an AI voice call
await client.makeCall({
to: "+1234567890",
fromNumberId: numbers[0].id,
systemPrompt: "You are a helpful assistant.",
language: "en",
});Wait for an inbound message
const message = await client.waitForMessage(numbers[0].id, 30);
console.log(`Received: ${message.body}`);List messages & calls
const messages = await client.listMessages();
const calls = await client.listCalls();API Reference
new DialClient(config)
| Field | Type | Required | Description |
|-----------|----------|----------|----------------------|
| apiKey | string | ✅ | Your Dial API key |
| baseUrl | string | ❌ | Override the API URL |
Methods
| Method | Description |
|---------------------------------------------|------------------------------------|
| listNumbers() | List available phone numbers |
| sendMessage(params) | Send SMS or WhatsApp message |
| makeCall(params) | Initiate an AI voice call |
| listMessages() | List recent messages |
| listCalls() | List recent calls |
| waitForMessage(phoneNumberId, timeout?) | Wait for an inbound message |
License
MIT
