Node SDK
The @getdial/sdk package is a typed client for Node and TypeScript.
Install
Construct a client
Core operations
sendMessage and makeCall choose the from-number with exactly one of
fromNumber (a flexible reference β phone number ID, one of your numbers in
E.164, or a nickname) or fromNumberId (ID only).
Typing indicators
Show a typing indicator while composing. iMessage numbers display it; standard (SMS) numbers have no typing concept and silently ignore it, so the calls are safe unconditionally.
Delivering a message or reaction clears the indicator natively on the
recipientβs device. The session compensates: after each session.sendMessage
it automatically re-starts the indicator, so inside the block the bubble
persists β the only real stop is the scope exit (or an explicit
session.stop() when not using await using). With the bare primitives,
remember that a send clears it: call startTyping again to keep composing,
and stopTyping when you stop without sending. There is no keep-alive, so a
stale indicator may also clear on its own during a very long pause.
The client makes a single attempt per call β it never auto-retries. makeCall accepts an optional idempotencyKey: pass the same key on each retry and a request that actually succeeded returns the original call instead of dialing again. sendMessage has no idempotency key β wrapping it in a retry can send a duplicate. See Retries and idempotency.
Stream events
newEventsConnection() returns an opened, async-iterable connection. Iterate it for live events and close it when done.
On TypeScript 5.2+ you can also use await using conn = await dial.newEventsConnection(); to close it automatically.
The stream is presence-based, not at-least-once β missed events replay only if you reconnect within 2 minutes. For durable, off-machine delivery, register a webhook β signed and retried at-least-once.
Types
DialClient returns typed PhoneNumber, Message, and Call objects (and DialConfig, SendMessageParams, ReplyToMessageParams, MakeCallParams, TypingParams for inputs). See Core concepts for what each field means.