@getdial/sdk - v0.21.0
    Preparing search index...

    @getdial/sdk - v0.21.0

    @getdial/sdk

    Official Node.js SDK for Dial — phone numbers, SMS, WhatsApp, and AI voice calls for AI agents.

    npm install @getdial/sdk
    
    import { DialClient } from "@getdial/sdk";

    const client = new DialClient({
    apiKey: "sk_live_...",
    });
    const numbers = await client.listNumbers();
    console.log(numbers);
    const number = await client.purchaseNumber({ areaCode: "415" });
    
    await client.sendMessage({
    to: "+1234567890",
    fromNumberId: numbers[0].id,
    body: "Hello from Dial!",
    channel: "sms", // or "whatsapp"
    });
    await client.makeCall({
    to: "+1234567890",
    fromNumberId: numbers[0].id,
    outboundInstruction: "You are a helpful assistant.",
    language: "en",
    });
    const conn = await client.newEventsConnection();
    for await (const event of conn) {
    if (event.type === "message.received") {
    console.log(`Received: ${event.data.body}`);
    break;
    }
    }
    const messages = await client.listMessages();
    const calls = await client.listCalls();
    const call = await client.getCall(calls[0].id);
    Field Type Required Description
    apiKey string Your Dial API key
    baseUrl string Override the API URL
    Method Description
    listNumbers() List available phone numbers
    purchaseNumber(params) Provision (buy) a new phone number
    setInboundInstruction(...) Set the inbound agent prompt for a number
    sendMessage(params) Send SMS or WhatsApp message
    replyToMessage(messageId, params) Reply or react to a message
    listMessages(filters?) List recent messages
    makeCall(params) Initiate an AI voice call
    listCalls(filters?) List recent calls
    getCall(callId) Fetch a single call by id
    newEventsConnection() Open a live event stream (async iterator)

    MIT