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

    Class DialClient

    Index
    • dial policy allow <id> <numbers…> — add callers without resending the list.

      Parameters

      Returns Promise<Policy>

    • dial group create — create a WhatsApp group from one of your lines, which becomes its admin.

      Resolves once the group exists; its id works as groupId on sendMessage right away. A participant who couldn't be added comes back in notAdded rather than failing the call — privacy_restricted means their settings only let contacts add them.

      A 504 means the group wasn't confirmed in time and may still exist: check listGroups before trying again, or you may create it twice.

      Parameters

      Returns Promise<CreateGroupResult>

    • dial policy create — create an allow list for inbound calls. Callers not on it are declined before the call connects; a number's own list replaces the account-wide one.

      Parameters

      Returns Promise<Policy>

    • dial policy delete <id> — numbers it covered fall back to the account-wide list, if any.

      Parameters

      • policyId: string

      Returns Promise<void>

    • dial billing — wallet balance, subscription, per-number mode, recent credits, and payment methods.

      Returns Promise<Billing>

    • dial call get <id> — fetch a single call by id.

      Parameters

      • callId: string

      Returns Promise<Call>

    • dial policy get <id> — one allow list, with its callers.

      Parameters

      • policyId: string

      Returns Promise<Policy>

    • Every contact, following the cursor until the API reports no more.

      "Who have I talked to" is not answered by a first page, so this is usually the method you want. The page walk is bounded (25 pages of 1000) so a hasMore that never goes false cannot loop forever.

      Parameters

      Returns Promise<Contact[]>

    • dial call list — list calls, optionally filtered.

      Parameters

      Returns Promise<Call[]>

    • dial contacts — one page of the numbers your lines have talked to, newest activity first.

      A contact is derived from message and call history, not stored: a number appears the moment it first exchanges anything with one of your lines, and there is no address book to add anyone to. Counts span every line on the account, so one person who reached two of your numbers is one contact — pass numberId for one line's contacts and counts instead. Groups are not contacts — see listGroups.

      Most accounts come back in one page. listAllContacts follows the cursor when they don't.

      Parameters

      Returns Promise<ContactsPage>

    • dial group list — the group conversations your lines are in.

      A group is a conversation that isn't a phone number, so it carries an id of its own: pass it as groupId to sendMessage or listMessages. Groups exist on WhatsApp lines and iMessage numbers.

      A group's name may be null — it's read live from the line holding the conversation, so an unreachable line yields a null name rather than hiding the group. There's no join event: list again to see a group your line was just added to.

      Returns Promise<Group[]>

    • dial message list — list messages, optionally filtered.

      Unfiltered this is the newest 100 messages ACROSS every conversation. Pass contact to read one person's conversation as itself, groupId for one group's, or search to find a message by its text anywhere in your history.

      Parameters

      Returns Promise<Message[]>

    • dial number list — list the account's phone numbers.

      Returns Promise<PhoneNumber[]>

    • dial policy list — the account's allow lists (each with entryCount, no entries).

      Returns Promise<Policy[]>

    • dial lookup — what channels a phone number can receive on.

      Works on ANY number in the world: it needn't be one of yours, and you needn't have messaged it before. Use it to pick a channel before spending a send.

      A lookup Dial couldn't complete REJECTS (502) rather than resolving with a negative verdict, so a false always means the number genuinely isn't reachable on that channel — never that we couldn't find out. The two are worth treating differently: only one is worth retrying.

      Parameters

      • number: string

      Returns Promise<NumberLookup>

    • Open a long-lived connection to the account's event stream.

      This is the SDK equivalent of dial wait-for: rather than returning a single event, it yields every message.received / message.status_changed / call.status_changed / call.ended / call.transcribed / number.status_changed event on the account channel. Iterate it and filter in your own loop:

      const conn = await client.newEventsConnection();
      try {
      for await (const event of conn) {
      if (event.type === "message.received") handle(event);
      }
      } finally {
      await conn.close();
      }

      The PubNub token is re-minted automatically before it expires.

      Returns Promise<EventsConnection>

    • dial policy disallow <id> <numbers…> — remove callers; ones not on the list are ignored.

      Parameters

      • policyId: string
      • numbers: string[]

      Returns Promise<Policy>

    • dial typing start — show a typing indicator to the recipient, as if composing a message from your number. iMessage numbers display it; standard (SMS) numbers have no typing concept and silently ignore it, so calling this unconditionally is safe. Fire-and-forget and free. Delivering a message or reaction clears the indicator natively on the recipient's device — start again after a send to keep composing, and pair with stopTyping when you stop without sending (or use typing, whose session renews it after each send and stops it on dispose).

      Parameters

      Returns Promise<void>

    • dial call stop <id> — end a call that hasn't finished. A queued or ringing call is cancelled before it connects; an in-progress one is hung up. Resolves once the stop is accepted, with status.cancelPending set — the call reaches Terminated a moment later, so wait for call.ended to confirm. Throws (400) if the call had already ended.

      Parameters

      • callId: string

      Returns Promise<Call>

    • dial typing stop — clear a typing indicator previously shown with startTyping.

      Parameters

      Returns Promise<void>

    • Scope a typing indicator to a block: starts immediately, stops on disposal.

      await using session = client.typing({ toNumber, fromNumber });
      await session.sendMessage({ body: "…" }); // to/from prefilled

      Returns synchronously with the start request in flight; a start failure surfaces at the next interaction with the session. Without await using (TypeScript 5.2+ / Node 24+), call session.stop() yourself.

      Parameters

      Returns TypingSession

    • dial policy update <id> — change any subset of fields; entries replaces the whole list.

      Parameters

      Returns Promise<Policy>