Skip to Content
Dial v1 live 🎉
SdkAPI Reference

API Reference

Complete API reference for the Dial SDK.

DialClient

The main client for interacting with Dial.

Constructor

new DialClient(config: DialClientConfig)

Parameters:

  • config.apiKey (string, required) - Your Dial API key
  • config.walletAddress (string, optional) - Wallet address
  • config.network (‘mainnet’ | ‘testnet’, default: ‘mainnet’)
  • config.sessionToken (string, optional) - Existing session token

Example:

const dial = new DialClient({ apiKey: 'your-api-key', walletAddress: '0x...', network: 'mainnet' });

Methods

authenticate()

Authenticate with wallet signature.

await dial.authenticate(params: AuthParams): Promise<Session>

Parameters:

  • walletAddress (string) - Wallet address
  • signature (string) - Signed message
  • message (string) - Original message that was signed

Returns: Session object


Calls API

calls.start()

Start a new call.

await dial.calls.start(params: StartCallParams): Promise<Call>

Parameters:

  • to (string, required) - Recipient wallet address
  • type (‘audio’ | ‘video’, required) - Call type
  • video (VideoConfig, optional) - Video configuration

Returns: Call object

calls.answer()

Answer an incoming call.

await dial.calls.answer(callId: string): Promise<void>

calls.decline()

Decline an incoming call.

await dial.calls.decline(callId: string, options?: DeclineOptions): Promise<void>

Options:

  • reason (‘busy’ | ‘declined’ | string)

calls.end()

End an active call.

await dial.calls.end(callId: string): Promise<void>

calls.mute()

Mute microphone.

await dial.calls.mute(callId: string): Promise<void>

calls.unmute()

Unmute microphone.

await dial.calls.unmute(callId: string): Promise<void>

calls.toggleMute()

Toggle mute status.

await dial.calls.toggleMute(callId: string): Promise<boolean>

Returns: New mute status

calls.disableVideo()

Disable video stream.

await dial.calls.disableVideo(callId: string): Promise<void>

calls.enableVideo()

Enable video stream.

await dial.calls.enableVideo(callId: string): Promise<void>

calls.getHistory()

Get call history.

await dial.calls.getHistory(params?: HistoryParams): Promise<CallRecord[]>

Parameters:

  • limit (number, default: 50)
  • offset (number, default: 0)
  • status (‘completed’ | ‘missed’ | ‘declined’)
  • direction (‘incoming’ | ‘outgoing’)
  • with (string) - Filter by wallet address
  • from (Date) - Start date
  • to (Date) - End date

Messages API

messages.send()

Send a message.

await dial.messages.send(params: SendMessageParams): Promise<Message>

Parameters:

  • to (string, required) - Recipient wallet address
  • content (string, required) - Message content
  • type (‘text’ | ‘image’ | ‘video’ | ‘audio’, required)
  • media (MediaConfig, optional) - Media configuration

Returns: Message object

messages.getConversations()

Get all conversations.

await dial.messages.getConversations(): Promise<Conversation[]>

messages.getConversation()

Get conversation with specific wallet.

await dial.messages.getConversation(params: { with: string }): Promise<Conversation>

messages.getMessages()

Get message history.

await dial.messages.getMessages(params: MessageHistoryParams): Promise<Message[]>

Parameters:

  • with (string, required) - Wallet address
  • limit (number, default: 50)
  • offset (number, default: 0)
  • before (Date, optional)

messages.markAsRead()

Mark message as read.

await dial.messages.markAsRead(messageId: string): Promise<void>

messages.addReaction()

Add reaction to message.

await dial.messages.addReaction(params: { messageId: string; emoji: string; }): Promise<void>

messages.delete()

Delete a message.

await dial.messages.delete(messageId: string, options?: { forEveryone?: boolean; }): Promise<void>

Voicemail API

voicemail.record()

Record a voicemail.

await dial.voicemail.record(params: RecordParams): Promise<Voicemail>

Parameters:

  • to (string, required) - Recipient wallet address
  • maxDuration (number, default: 120) - Max duration in seconds

voicemail.getAll()

Get all voicemails.

await dial.voicemail.getAll(params?: { limit?: number; unreadOnly?: boolean; }): Promise<Voicemail[]>

voicemail.get()

Get specific voicemail.

await dial.voicemail.get(voicemailId: string): Promise<Voicemail>

voicemail.markAsRead()

Mark voicemail as read.

await dial.voicemail.markAsRead(voicemailId: string): Promise<void>

voicemail.delete()

Delete voicemail.

await dial.voicemail.delete(voicemailId: string): Promise<void>

voicemail.transcribe()

Get voicemail transcription.

await dial.voicemail.transcribe(voicemailId: string): Promise<Transcription>

Conference API

conference.create()

Create a conference room.

await dial.conference.create(params: CreateRoomParams): Promise<ConferenceRoom>

Parameters:

  • name (string, required)
  • maxParticipants (number, required)
  • video (boolean, default: true)
  • audio (boolean, default: true)
  • settings (RoomSettings, optional)

conference.join()

Join a conference room.

await dial.conference.join(params: JoinParams): Promise<void>

Parameters:

  • roomId (string, required)
  • video (boolean, default: true)
  • audio (boolean, default: true)
  • displayName (string, optional)

conference.leave()

Leave a conference room.

await dial.conference.leave(roomId: string): Promise<void>

conference.muteAudio()

Mute your audio.

await dial.conference.muteAudio(roomId: string): Promise<void>

conference.startScreenShare()

Start screen sharing.

await dial.conference.startScreenShare(roomId: string): Promise<void>

Gated Rooms API

gatedRooms.create()

Create a gated room.

await dial.gatedRooms.create(params: CreateGatedRoomParams): Promise<GatedRoom>

Parameters:

  • name (string, required)
  • maxParticipants (number, required)
  • gateType (‘nft’ | ‘token’ | ‘dao’ | ‘multi’)
  • gate (GateConfig, required)

gatedRooms.checkAccess()

Check if wallet has access.

await dial.gatedRooms.checkAccess(params: { roomId: string; walletAddress: string; }): Promise<AccessResult>

Returns:

interface AccessResult { allowed: boolean; reason?: string; requirementsMet?: string[]; missingRequirements?: string[]; }

Streaming API

streaming.create()

Create a live stream.

await dial.streaming.create(params: CreateStreamParams): Promise<LiveStream>

Parameters:

  • title (string, required)
  • description (string, optional)
  • isPublic (boolean, default: true)
  • gate (GateConfig, optional)

streaming.start()

Start broadcasting.

await dial.streaming.start(params: StartStreamParams): Promise<void>

Parameters:

  • streamId (string, required)
  • video (boolean, default: true)
  • audio (boolean, default: true)
  • quality (‘720p’ | ‘1080p’ | ‘4k’, default: ‘1080p’)

streaming.end()

End the stream.

await dial.streaming.end(streamId: string): Promise<void>

Notifications API

notifications.requestPermissions()

Request notification permissions.

await dial.notifications.requestPermissions(): Promise<boolean>

notifications.register()

Register for push notifications.

await dial.notifications.register(): Promise<void>

notifications.setPreferences()

Set notification preferences.

await dial.notifications.setPreferences(prefs: NotificationPreferences): Promise<void>

Parameters:

interface NotificationPreferences { calls?: boolean; messages?: boolean; voicemails?: boolean; conferenceInvites?: boolean; }

Events

Subscribe to real-time events using the on() method.

Call Events

dial.on('call:incoming', (call: Call) => void) dial.on('call:answered', (call: Call) => void) dial.on('call:ended', (call: Call) => void) dial.on('call:declined', (call: Call) => void) dial.on('call:missed', (call: Call) => void)

Message Events

dial.on('message:received', (message: Message) => void) dial.on('message:read', (message: Message) => void) dial.on('typing:start', (data: { from: string }) => void) dial.on('typing:stop', (data: { from: string }) => void)

Voicemail Events

dial.on('voicemail:received', (voicemail: Voicemail) => void)

Conference Events

dial.on('conference:participant:joined', (participant: Participant) => void) dial.on('conference:participant:left', (participant: Participant) => void) dial.on('conference:screenshare:started', (data: { participantId: string }) => void)

Stream Events

dial.on('stream:viewer:joined', (data: { viewer: Viewer }) => void) dial.on('stream:viewer:left', (data: { viewer: Viewer }) => void) dial.on('stream:viewer:count', (data: { count: number }) => void) dial.on('stream:chat:message', (data: { message: Message, sender: Sender }) => void)

Unsubscribe

// Remove specific listener dial.off('call:incoming', handler); // Remove all listeners for event dial.off('call:incoming');

Type Definitions

Call

interface Call { id: string; from: string; to: string; type: 'audio' | 'video'; status: 'ringing' | 'active' | 'ended' | 'missed' | 'declined'; direction: 'incoming' | 'outgoing'; startedAt?: Date; endedAt?: Date; duration?: number; }

Message

interface Message { id: string; from: string; to: string; content: string; type: 'text' | 'image' | 'video' | 'audio'; media?: MediaInfo; timestamp: Date; status: 'sending' | 'sent' | 'delivered' | 'read' | 'failed'; reactions?: Reaction[]; }

Voicemail

interface Voicemail { id: string; from: string; to: string; audioUrl: string; duration: number; timestamp: Date; isRead: boolean; transcription?: string; }

ConferenceRoom

interface ConferenceRoom { id: string; name: string; host: string; participants: Participant[]; maxParticipants: number; createdAt: Date; url: string; status: 'waiting' | 'active' | 'ended'; }

LiveStream

interface LiveStream { id: string; title: string; description: string; host: string; streamKey: string; url: string; playbackUrl: string; status: 'idle' | 'live' | 'ended'; viewerCount: number; startedAt?: Date; endedAt?: Date; }

Error Handling

All SDK methods can throw errors. Wrap calls in try-catch blocks:

try { const call = await dial.calls.start({ to: '0x...', type: 'audio' }); } catch (error) { if (error.code === 'INVALID_ADDRESS') { console.error('Invalid wallet address'); } else if (error.code === 'PERMISSION_DENIED') { console.error('Microphone permission denied'); } else { console.error('Error starting call:', error.message); } }

Common Error Codes

  • INVALID_ADDRESS - Invalid wallet address
  • PERMISSION_DENIED - Missing permissions (camera/microphone)
  • NETWORK_ERROR - Network connectivity issue
  • AUTHENTICATION_REQUIRED - Not authenticated
  • ACCESS_DENIED - Access to gated content denied
  • RATE_LIMIT_EXCEEDED - Too many requests
  • INSUFFICIENT_BALANCE - Insufficient balance for paid feature

Next Steps

Last updated on