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

    @getdial/sdk - v0.38.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: "+14155557890", // Bay Area Plumbing
    fromNumberId: numbers[0].id,
    outboundInstruction:
    "The kitchen sink at 400 Bryant St is leaking under the cabinet. " +
    "Ask what they charge to fix it and when they can come out. " +
    "Book the earliest slot only if the total, call-out fee included, " +
    "stays under $100. Otherwise thank them and hang up.",
    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 (contact for one conversation, search by text)
    listContacts(params?) One page of the numbers your lines have talked to (numberId for one line's)
    listAllContacts(pageSize?) Every contact, following the cursor
    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