Skip to main content

@dialstack/sdk-dev / server/src / DialStack

Class: DialStack

Defined in: sdk/server/src/index.ts:2406

Constructors

Constructor

TypeScript
new DialStack(apiKey, config?): DialStack;

Defined in: sdk/server/src/index.ts:2417

Parameters

apiKey

string | undefined

config?

DialStackConfig

Returns

DialStack

Properties

accounts

TypeScript
accounts: object;

Defined in: sdk/server/src/index.ts:2807

acceptTos

TypeScript
acceptTos: (accountId, params, options?) => Promise<Tos>;

Record the account owner's acceptance of the agreement. Calling this with your secret key asserts that you presented the agreement to the owner and they accepted; the evidence (timestamp, IP, user agent) is derived from the request, never taken from the body.

version must match the current agreement (409 otherwise), and the account's pricing must already be set since the agreement embeds it (422 otherwise). Re-accepting the same version is idempotent.

Parameters
accountId

string

params

TosAcceptParams

options?

RequestOptions

Returns

Promise<Tos>

create

TypeScript
create: (params, options?) => Promise<Account>;
Parameters
params

AccountCreateParams

options?

RequestOptions

Returns

Promise<Account>

del

TypeScript
del: (accountId, options?) => Promise<void>;
Parameters
accountId

string

options?

RequestOptions

Returns

Promise<void>

list

TypeScript
list: (params?, options?) => PaginatedList<Account>;
Parameters
params?

AccountListParams

options?

RequestOptions

Returns

PaginatedList<Account>

retrieve

TypeScript
retrieve: (accountId, options?) => Promise<Account>;
Parameters
accountId

string

options?

RequestOptions

Returns

Promise<Account>

retrievePricing

TypeScript
retrievePricing: (accountId, options?) => Promise<AccountPricing>;

Retrieve the agreed pricing singleton for an account.

Parameters
accountId

string

options?

RequestOptions

Returns

Promise<AccountPricing>

retrieveTos

TypeScript
retrieveTos: (accountId, options?) => Promise<Tos>;

Retrieve the account's subscription agreement and its acceptance state. Pass expand: ['pricing'] to include the pricing the customer is accepting.

Parameters
accountId

string

options?

RequestOptions & object

Returns

Promise<Tos>

update

TypeScript
update: (accountId, params, options?) => Promise<Account>;
Parameters
accountId

string

params

AccountUpdateParams

options?

RequestOptions

Returns

Promise<Account>

updatePricing

TypeScript
updatePricing: (accountId, params, options?) => Promise<AccountPricing>;

Create or replace the agreed pricing for an account. All three rates are required, in cents per month.

Parameters
accountId

string

params

AccountPricingParams

options?

RequestOptions

Returns

Promise<AccountPricing>


accountSessions

TypeScript
accountSessions: object;

Defined in: sdk/server/src/index.ts:3106

create

TypeScript
create: (params, options?) => Promise<AccountSessionCreateResponse>;
Parameters
params

AccountSessionCreateParams

options?

RequestOptions

Returns

Promise<AccountSessionCreateResponse>


admin

TypeScript
admin: object;

Defined in: sdk/server/src/index.ts:3903

Admin portal resources.

Distinct from the voice platform resources above: these describe who can administer an account in the portal, not who has phone service. Read-only — roles are granted in the portal itself.

users

TypeScript
users: object;
users.list
TypeScript
list: (params, options) => PaginatedList<AdminUser>;

List the people who can administer this account.

This is not a subset of users.list() — it is a different population. Someone listed here may have no voice user at all (an account owner typically does not), and most voice users are not administrators. Read both collections to cover everyone on the account, and use each admin user's user field to link them rather than matching on email.

Only explicit grants on this account are listed; platform-wide access does not appear. A role can be granted before its invitation is accepted, so someone listed may not yet have signed in.

Pass expand: ['user'] to inline the full voice user.

Parameters
params

| AdminUserListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<AdminUser>

users.retrieve
TypeScript
retrieve: (adminUserId, params, options) => Promise<AdminUser>;

Retrieve one of this account's admin portal users.

Rejects with a 404 when no such person administers this account — including when they administer a different one.

Parameters
adminUserId

string

params

| AdminUserRetrieveParams | undefined

options

RequestOptions & object

Returns

Promise<AdminUser>


aiAgents

TypeScript
aiAgents: object;

Defined in: sdk/server/src/index.ts:4001

create

TypeScript
create: (params, options) => Promise<AIAgent>;
Parameters
params

AIAgentCreateParams

options

RequestOptions & object

Returns

Promise<AIAgent>

del

TypeScript
del: (aiAgentId, options) => Promise<void>;
Parameters
aiAgentId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<AIAgent>;
Parameters
params

AIAgentListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<AIAgent>

retrieve

TypeScript
retrieve: (aiAgentId, options) => Promise<AIAgent>;
Parameters
aiAgentId

string

options

RequestOptions & object

Returns

Promise<AIAgent>

update

TypeScript
update: (aiAgentId, params, options) => Promise<AIAgent>;
Parameters
aiAgentId

string

params

AIAgentUpdateParams

options

RequestOptions & object

Returns

Promise<AIAgent>


buttonTemplates

TypeScript
buttonTemplates: object;

Defined in: sdk/server/src/index.ts:3466

Reusable sets of programmable buttons for desk phones. A template is assigned to devices; per-device deviations live in the device's button overrides.

create

TypeScript
create: (params, options) => Promise<ButtonTemplate>;
Parameters
params

CreateButtonTemplateRequest

options

RequestOptions & object

Returns

Promise<ButtonTemplate>

createButton

TypeScript
createButton: (buttonTemplateId, params, options) => Promise<TemplateButton>;

Add a button to a template. type narrows the required target shape, so a mismatched payload is a compile-time error.

Parameters
buttonTemplateId

string

params

CreateTemplateButtonRequest

options

RequestOptions & object

Returns

Promise<TemplateButton>

del

TypeScript
del: (buttonTemplateId, options) => Promise<void>;
Parameters
buttonTemplateId

string

options

RequestOptions & object

Returns

Promise<void>

delButton

TypeScript
delButton: (buttonTemplateId, buttonId, options) => Promise<void>;
Parameters
buttonTemplateId

string

buttonId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<ButtonTemplate>;
Parameters
params

| ButtonTemplateListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<ButtonTemplate>

listButtons

TypeScript
listButtons: (buttonTemplateId, params, options) => PaginatedList<TemplateButton>;
Parameters
buttonTemplateId

string

params

| TemplateButtonListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<TemplateButton>

retrieve

TypeScript
retrieve: (buttonTemplateId, options) => Promise<ButtonTemplateWithDetails>;

Retrieve a template. Pass expand: ['buttons'] to embed its buttons, and for_device to have the response carry a compatibility summary for that device's vendor, model, and position range.

Parameters
buttonTemplateId

string

options

RequestOptions & object & ButtonTemplateRetrieveOptions

Returns

Promise<ButtonTemplateWithDetails>

update

TypeScript
update: (buttonTemplateId, params, options) => Promise<ButtonTemplate>;
Parameters
buttonTemplateId

string

params

UpdateButtonTemplateRequest

options

RequestOptions & object

Returns

Promise<ButtonTemplate>

updateButton

TypeScript
updateButton: (buttonTemplateId, buttonId, params, options) => Promise<TemplateButton>;

Move a button. Position is the only updatable field.

Parameters
buttonTemplateId

string

buttonId

string

params

UpdateTemplateButtonRequest

options

RequestOptions & object

Returns

Promise<TemplateButton>


calls

TypeScript
calls: object;

Defined in: sdk/server/src/index.ts:3124

create

TypeScript
create: (params, options) => Promise<void>;

Place an outbound call. The user's endpoints ring first; when the user answers, dial_string is dialed. Accepted asynchronously — the call progresses over webhooks, so there is no response body.

Parameters
params

CallCreateParams

options

RequestOptions & object

Returns

Promise<void>

createListener

TypeScript
createListener: (callId, params, options) => Promise<Listener>;

Start streaming live audio from an active call to your WebSocket server. Neither party is aware of the listener.

Parameters
callId

string

params

ListenerCreateParams

options

RequestOptions & object

Returns

Promise<Listener>

delListener

TypeScript
delListener: (callId, listenerId, options) => Promise<void>;

Stop a listener and close its WebSocket.

Parameters
callId

string

listenerId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<CallLog>;
Parameters
params

CallListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<CallLog>

listListeners

TypeScript
listListeners: (callId, params, options) => PaginatedList<Listener>;
Parameters
callId

string

params

ListenerListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<Listener>

pauseRecording

TypeScript
pauseRecording: (callId, options) => Promise<void>;

Pause recording on an active call — e.g. while an agent collects a customer's payment card number so the sensitive audio is never captured. Recording stays paused until resumeRecording or the call ends; both parties hear a short confirmation tone.

Parameters
callId

string

options

RequestOptions & object

Returns

Promise<void>

resumeRecording

TypeScript
resumeRecording: (callId, options) => Promise<void>;

Resume a recording previously paused with pauseRecording. Both parties hear a short confirmation tone.

Parameters
callId

string

options

RequestOptions & object

Returns

Promise<void>

retrieve

TypeScript
retrieve: (callId, options) => Promise<CallLog>;

Retrieve a call log. Safe to call while the call is still live, in which case the completion-only fields are null — see CallLog.

Parameters
callId

string

options

RequestOptions & object

Returns

Promise<CallLog>

retrieveListener

TypeScript
retrieveListener: (callId, listenerId, options) => Promise<Listener>;
Parameters
callId

string

listenerId

string

options

RequestOptions & object

Returns

Promise<Listener>

retrieveRecording

TypeScript
retrieveRecording: (callId, options) => Promise<Recording>;

Retrieve recording metadata with a signed download URL. The URL expires after 10 minutes, so fetch it when you are ready to download.

Parameters
callId

string

options

RequestOptions & object

Returns

Promise<Recording>

retrieveTranscript

TypeScript
retrieveTranscript: (callId, options) => Promise<Transcript>;
Parameters
callId

string

options

RequestOptions & object

Returns

Promise<Transcript>

update

TypeScript
update: (callId, params, options) => Promise<void>;
Parameters
callId

string

params

CallUpdateParams

options

RequestOptions & object

Returns

Promise<void>


devices

TypeScript
devices: object;

Defined in: sdk/server/src/index.ts:3599

Deskphones, DECT bases, and DECT handsets. This is the unified device surface — prefer it over the per-kind endpoints.

assignUser

TypeScript
assignUser: (deviceId, params, options) => Promise<DeviceUserAssignment>;

Assign a user to the device. This provisions the endpoint's SIP credentials and the device line/extension server-side. Throws with a DeviceUserConflictResponse body on 409.

Parameters
deviceId

string

params

DeviceAssignUserParams

options

RequestOptions & object

Returns

Promise<DeviceUserAssignment>

checkSync

TypeScript
checkSync: (deviceId, params, options) => Promise<DeviceCheckSyncResponse>;

Tell the device to fetch and apply its latest configuration. On a DECT system one request reaches every handset paired with the base.

Call this when configuration actually changed, not on every admin interaction. With reboot: true the device drops active calls and goes offline for roughly 30–90 seconds.

Parameters
deviceId

string

params

| DeviceCheckSyncParams | undefined

options

RequestOptions & object

Returns

Promise<DeviceCheckSyncResponse>

create

TypeScript
create: (params, options) => Promise<CreateDeviceResponse>;

Register a device. type is optional for MAC-addressable devices: omit it and the kind is detected from mac_address via the vendor catalog. Returns only the new id and type — call retrieve for the rest.

Parameters
params

DeviceCreateParams

options

RequestOptions & object

Returns

Promise<CreateDeviceResponse>

createButtonOverride

TypeScript
createButtonOverride: (deviceId, params, options) => Promise<DeviceButtonOverride>;

Override one position on this device: either suppress the template's button there, or replace it with a different one.

Parameters
deviceId

string

params

CreateDeviceButtonOverrideRequest

options

RequestOptions & object

Returns

Promise<DeviceButtonOverride>

del

TypeScript
del: (deviceId, options) => Promise<void>;
Parameters
deviceId

string

options

RequestOptions & object

Returns

Promise<void>

delButtonOverride

TypeScript
delButtonOverride: (deviceId, overrideId, options) => Promise<void>;

Drop an override, restoring the template's button at that position.

Parameters
deviceId

string

overrideId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<Device>;
Parameters
params

DeviceListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<Device>

listButtonOverrides

TypeScript
listButtonOverrides: (deviceId, params, options) => PaginatedList<DeviceButtonOverride>;
Parameters
deviceId

string

params

| DeviceButtonListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<DeviceButtonOverride>

listButtons

TypeScript
listButtons: (deviceId, options) => Promise<ListResponse<MaterializedButton>>;

The device's effective buttons — the bound template's buttons with this device's overrides applied, plus any model defaults. Not paginated.

Parameters
deviceId

string

options

RequestOptions & object

Returns

Promise<ListResponse<MaterializedButton>>

listCompatibleButtonTemplates

TypeScript
listCompatibleButtonTemplates: (deviceId, params, options) => PaginatedList<ButtonTemplate>;

Button templates whose buttons all fit this device's vendor and model.

Parameters
deviceId

string

params

| ButtonTemplateListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<ButtonTemplate>

listUsers

TypeScript
listUsers: (deviceId, options) => Promise<ListResponse<DeviceUserAssignment>>;
Parameters
deviceId

string

options

RequestOptions & object

Returns

Promise<ListResponse<DeviceUserAssignment>>

removeUser

TypeScript
removeUser: (deviceId, userId, options) => Promise<void>;
Parameters
deviceId

string

userId

string

options

RequestOptions & object

Returns

Promise<void>

retrieve

TypeScript
retrieve: (deviceId, options) => Promise<Device>;
Parameters
deviceId

string

options

RequestOptions & object

Returns

Promise<Device>

update

TypeScript
update: (deviceId, params, options) => Promise<Device>;

Update a device. name, location, base, and button_template are tri-state: omit to leave unchanged, pass a string to set, or pass null to clear. Throws with a DeviceUserConflictResponse body on 409.

Parameters
deviceId

string

params

DeviceUpdateParams

options

RequestOptions & object

Returns

Promise<Device>


dialPlans

TypeScript
dialPlans: object;

Defined in: sdk/server/src/index.ts:4089

create

TypeScript
create: (params, options) => Promise<DialPlan>;
Parameters
params

DialPlanCreateParams

options

RequestOptions & object

Returns

Promise<DialPlan>

list

TypeScript
list: (params, options) => PaginatedList<DialPlan>;
Parameters
params

DialPlanListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<DialPlan>

retrieve

TypeScript
retrieve: (dialPlanId, options) => Promise<DialPlan>;
Parameters
dialPlanId

string

options

RequestOptions & object

Returns

Promise<DialPlan>


extensions

TypeScript
extensions: object;

Defined in: sdk/server/src/index.ts:4125

create

TypeScript
create: (params, options) => Promise<Extension>;
Parameters
params

ExtensionCreateParams

options

RequestOptions & object

Returns

Promise<Extension>

del

TypeScript
del: (number, options) => Promise<void>;
Parameters
number

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<Extension>;
Parameters
params

| ExtensionListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<Extension>

retrieve

TypeScript
retrieve: (number, options) => Promise<Extension>;
Parameters
number

string

options

RequestOptions & object

Returns

Promise<Extension>

update

TypeScript
update: (number, params, options) => Promise<Extension>;
Parameters
number

string

params

ExtensionUpdateParams

options

RequestOptions & object

Returns

Promise<Extension>


faxes

TypeScript
faxes: object;

Defined in: sdk/server/src/index.ts:3399

del

TypeScript
del: (faxId, options) => Promise<void>;

Delete the fax record. The referenced file keeps its own lifecycle.

Parameters
faxId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<Fax>;
Parameters
params

FaxListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<Fax>

retrieve

TypeScript
retrieve: (faxId, options) => Promise<Fax>;
Parameters
faxId

string

options

RequestOptions & object

Returns

Promise<Fax>

send

TypeScript
send: (params, options) => Promise<Fax>;

Send an outbound fax. Upload the document first to the dedicated files host (POST https://files.dialstack.ai/v1/files, purpose fax_source), then reference the resulting file id here. The fax is created pending and progresses to delivered or failed; sends are rate-limited per account over a rolling hour.

Parameters
params

FaxSendParams

options

RequestOptions & object

Returns

Promise<Fax>

update

TypeScript
update: (faxId, params, options) => Promise<Fax>;

Mark a received fax read or unread.

Parameters
faxId

string

params

FaxUpdateParams

options

RequestOptions & object

Returns

Promise<Fax>


hardwareOrders

TypeScript
hardwareOrders: object;

Defined in: sdk/server/src/index.ts:3792

Orders for physical hardware. An order is placed with quantities and comes back as one item per unit, each of which can be pre-assigned to a user, location, or base before it is fulfilled into a device.

create

TypeScript
create: (params, options) => Promise<HardwareOrder>;
Parameters
params

HardwareOrderParams

options

RequestOptions & object

Returns

Promise<HardwareOrder>

list

TypeScript
list: (params, options) => Promise<ListResponse<HardwareOrder>>;

List the account's orders with their items embedded.

Not paginated: the API returns every order in one envelope with no page URLs, so this is a plain ListResponse rather than a PaginatedList.

Parameters
params

| HardwareOrderListParams | undefined

options

RequestOptions & object

Returns

Promise<ListResponse<HardwareOrder>>

retrieve

TypeScript
retrieve: (hardwareOrderId, options) => Promise<HardwareOrder>;
Parameters
hardwareOrderId

string

options

RequestOptions & object

Returns

Promise<HardwareOrder>

update

TypeScript
update: (hardwareOrderId, params, options) => Promise<HardwareOrder>;

Replace the order's line items.

Only a draft order can be changed; anything else returns 409. Note that orders are currently created as submitted and no endpoint moves one back to draft, so this returns 409 in practice until the editable-cart flow exists. Bound here because the endpoint is published, not because it is usable yet.

Parameters
hardwareOrderId

string

params

HardwareOrderParams

options

RequestOptions & object

Returns

Promise<HardwareOrder>

updateItem

TypeScript
updateItem: (hardwareOrderId, itemId, params, options) => Promise<HardwareOrderItem>;

Set or clear a single unit's user, location, or base pre-assignment.

Parameters
hardwareOrderId

string

itemId

string

params

HardwareOrderItemUpdateParams

options

RequestOptions & object

Returns

Promise<HardwareOrderItem>


phoneNumbers

TypeScript
phoneNumbers: object;

Defined in: sdk/server/src/index.ts:3085

list

TypeScript
list: (params, options) => PaginatedList<PhoneNumber>;
Parameters
params

| PhoneNumberListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<PhoneNumber>


presence

TypeScript
presence: object;

Defined in: sdk/server/src/index.ts:3045

list

TypeScript
list: (params, options) => Promise<ListResponse<PresenceItem>>;

Read presence for an explicit, bounded set of users in one request — the candidate set a caller already has in hand. A filtered list by id, not a paginated collection: results come back in request order in the standard list envelope (next_page_url/previous_page_url are always null). The set is capped per request; if any user cannot be resolved or read, the whole request fails rather than returning a partial result.

Parameters
params

PresenceListParams

options

RequestOptions & object

Returns

Promise<ListResponse<PresenceItem>>

subscribeParkSlots

TypeScript
subscribeParkSlots: (handlers, options) => ParkSlotSubscription;

Subscribe to the account's park slots.

Every slot's current state arrives immediately via onSnapshot, then one onSlot call per change. Frames carry state, not transitions: a slot being freed arrives as parked_call: null. A frame always says what the slot is now, so there is no log of parks and unparks to reconcile.

Reconnects automatically, and every reconnect delivers a fresh snapshot — a complete resync, so there is no sequence number to track. If the server can no longer verify slot state it ends the subscription rather than let it drift silently; onTerminated reports why, and the reconnect that follows repairs it.

Users cannot be subscribed to — read their presence with list instead.

Parameters
handlers

ParkSlotSubscriptionHandlers

options

RequestOptions & object & ParkSlotSubscriptionOptions

Returns

ParkSlotSubscription


queues

TypeScript
queues: object;

Defined in: sdk/server/src/index.ts:4247

addMember

TypeScript
addMember: (queueId, params, options) => Promise<QueueMember>;
Parameters
queueId

string

params

QueueAddMemberParams

options

RequestOptions & object

Returns

Promise<QueueMember>

create

TypeScript
create: (params, options) => Promise<Queue>;
Parameters
params

QueueCreateParams

options

RequestOptions & object

Returns

Promise<Queue>

del

TypeScript
del: (queueId, options) => Promise<void>;
Parameters
queueId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<Queue>;
Parameters
params

QueueListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<Queue>

listMembers

TypeScript
listMembers: (queueId, params, options) => PaginatedList<QueueMember>;
Parameters
queueId

string

params

| QueueListMembersParams | undefined

options

RequestOptions & object

Returns

PaginatedList<QueueMember>

removeMember

TypeScript
removeMember: (queueId, memberId, options) => Promise<void>;
Parameters
queueId

string

memberId

string

options

RequestOptions & object

Returns

Promise<void>

retrieve

TypeScript
retrieve: (queueId, options) => Promise<Queue>;
Parameters
queueId

string

options

RequestOptions & object

Returns

Promise<Queue>

update

TypeScript
update: (queueId, params, options) => Promise<Queue>;
Parameters
queueId

string

params

QueueUpdateParams

options

RequestOptions & object

Returns

Promise<Queue>


ringGroups

TypeScript
ringGroups: object;

Defined in: sdk/server/src/index.ts:4175

addMember

TypeScript
addMember: (ringGroupId, params, options) => Promise<RingGroupMember>;
Parameters
ringGroupId

string

params

RingGroupAddMemberParams

options

RequestOptions & object

Returns

Promise<RingGroupMember>

create

TypeScript
create: (params, options) => Promise<RingGroup>;
Parameters
params

RingGroupCreateParams

options

RequestOptions & object

Returns

Promise<RingGroup>

del

TypeScript
del: (ringGroupId, options) => Promise<void>;
Parameters
ringGroupId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<RingGroup>;
Parameters
params

| RingGroupListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<RingGroup>

removeMember

TypeScript
removeMember: (ringGroupId, memberId, options) => Promise<void>;
Parameters
ringGroupId

string

memberId

string

options

RequestOptions & object

Returns

Promise<void>

retrieve

TypeScript
retrieve: (ringGroupId, options) => Promise<RingGroup>;
Parameters
ringGroupId

string

options

RequestOptions & object

Returns

Promise<RingGroup>

update

TypeScript
update: (ringGroupId, params, options) => Promise<RingGroup>;
Parameters
ringGroupId

string

params

RingGroupUpdateParams

options

RequestOptions & object

Returns

Promise<RingGroup>


schedules

TypeScript
schedules: object;

Defined in: sdk/server/src/index.ts:4055

create

TypeScript
create: (params, options) => Promise<Schedule>;
Parameters
params

ScheduleCreateParams

options

RequestOptions & object

Returns

Promise<Schedule>

list

TypeScript
list: (params, options) => PaginatedList<Schedule>;
Parameters
params

ScheduleListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<Schedule>

retrieve

TypeScript
retrieve: (scheduleId, options) => Promise<Schedule>;
Parameters
scheduleId

string

options

RequestOptions & object

Returns

Promise<Schedule>


testHelpers

TypeScript
testHelpers: object;

Defined in: sdk/server/src/index.ts:3867

Test-mode helpers (sandbox only). Trigger simulated calls and emit canned webhook events to exercise your integration end to end without real telephony. Requires a test key (sk_test_...); a live key receives a 400. See the "Testing your integration" guide.

calls

TypeScript
calls: object;
calls.create
TypeScript
create: (params, options) => Promise<TestCallResponse>;

Trigger a simulated call. For inbound (screen pop) and custom-scenario simulations a dialed number cannot select. Returns the started call's id + scenario so a test can assert on it.

Parameters
params

TestCallCreateParams

options

RequestOptions & object

Returns

Promise<TestCallResponse>

events

TypeScript
events: object;
events.create
TypeScript
create: (params, options) => Promise<TestEventResponse>;

Emit a single canned webhook event (fax., queue., recording.failed, call.mobile_push_wakeup) for events the call simulator does not drive behaviorally.

Parameters
params

TestEventCreateParams

options

RequestOptions & object

Returns

Promise<TestEventResponse>


users

TypeScript
users: object;

Defined in: sdk/server/src/index.ts:2945

create

TypeScript
create: (params, options) => Promise<User>;
Parameters
params

UserCreateParams | undefined

options

RequestOptions & object

Returns

Promise<User>

del

TypeScript
del: (userId, options) => Promise<void>;
Parameters
userId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<User>;
Parameters
params

UserListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<User>

retrieve

TypeScript
retrieve: (userId, options) => Promise<User>;
Parameters
userId

string

options

RequestOptions & object

Returns

Promise<User>

retrievePresence

TypeScript
retrievePresence: (userId, options) => Promise<UserPresence>;

Retrieve a user's live presence — reachable / on a call right now. The value is always freshly verified; a read that cannot be confirmed fails with 503 rather than returning a stale or guessed value (no unknown).

Parameters
userId

string

options

RequestOptions & object

Returns

Promise<UserPresence>

retrieveQueueAgent

TypeScript
retrieveQueueAgent: (userId, options) => Promise<QueueAgent>;

Retrieve the queue-agent singleton for a user. Throws on 404 when no queue-agent state has ever been written for the user.

Parameters
userId

string

options

RequestOptions & object

Returns

Promise<QueueAgent>

revokeSessions

TypeScript
revokeSessions: (userId, options?) => Promise<UserSessionsRevokeResponse>;

Revoke every outstanding user-session token for a user and tear down their active WebRTC sessions (server-side kill switch). Platform-level, like userSessions.create() — no account header.

Parameters
userId

string

options?

RequestOptions

Returns

Promise<UserSessionsRevokeResponse>

update

TypeScript
update: (userId, params, options) => Promise<User>;
Parameters
userId

string

params

UserUpdateParams

options

RequestOptions & object

Returns

Promise<User>

updateQueueAgent

TypeScript
updateQueueAgent: (userId, params, options) => Promise<QueueAgent>;

Update the queue-agent singleton for a user. Idempotent — re-sending the current status is a no-op. reason is only meaningful when status === "paused".

Parameters
userId

string

params

QueueAgentUpdateParams

options

RequestOptions & object

Returns

Promise<QueueAgent>


userSessions

TypeScript
userSessions: object;

Defined in: sdk/server/src/index.ts:3115

create

TypeScript
create: (params, options?) => Promise<UserSessionCreateResponse>;
Parameters
params

UserSessionCreateParams

options?

RequestOptions

Returns

Promise<UserSessionCreateResponse>


voiceApps

TypeScript
voiceApps: object;

Defined in: sdk/server/src/index.ts:3950

create

TypeScript
create: (params, options) => Promise<VoiceApp>;
Parameters
params

VoiceAppCreateParams

options

RequestOptions & object

Returns

Promise<VoiceApp>

del

TypeScript
del: (voiceAppId, options) => Promise<void>;
Parameters
voiceAppId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<VoiceApp>;
Parameters
params

VoiceAppListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<VoiceApp>

retrieve

TypeScript
retrieve: (voiceAppId, options) => Promise<VoiceApp>;
Parameters
voiceAppId

string

options

RequestOptions & object

Returns

Promise<VoiceApp>

update

TypeScript
update: (voiceAppId, params, options) => Promise<VoiceApp>;
Parameters
voiceAppId

string

params

VoiceAppUpdateParams

options

RequestOptions & object

Returns

Promise<VoiceApp>


voicemailGreetings

TypeScript
voicemailGreetings: object;

Defined in: sdk/server/src/index.ts:3344

Custom greetings that replace the system-default prompts for a user mailbox or a shared voicemail box, keyed by owner and greeting type.

del

TypeScript
del: (owner, greetingType, options) => Promise<void>;

Remove the custom greeting, reverting the mailbox to the system-default prompts. Idempotent — succeeds whether or not a greeting was set.

Parameters
owner

string

greetingType

"unavailable"

options

RequestOptions & object

Returns

Promise<void>

retrieve

TypeScript
retrieve: (owner, greetingType, options) => Promise<VoicemailGreeting>;

Throws 404 when no custom greeting is set for this owner and type.

Parameters
owner

string

greetingType

"unavailable"

options

RequestOptions & object

Returns

Promise<VoicemailGreeting>

upload

TypeScript
upload: (owner, greetingType, file, options) => Promise<VoicemailGreeting>;

Upload (or replace) the greeting for an owner. Audio is validated and transcoded server-side to mono µ-law 8 kHz WAV. Limits: 5 MB and 90 seconds; accepts WAV (PCM s16 / µ-law / A-law), MP3, AAC, Ogg Vorbis, and Opus. Re-uploading overwrites.

Parameters
owner

string

greetingType

"unavailable"

file

Blob

options

RequestOptions & object

Returns

Promise<VoicemailGreeting>


voicemails

TypeScript
voicemails: object;

Defined in: sdk/server/src/index.ts:3285

del

TypeScript
del: (voicemailId, options) => Promise<void>;
Parameters
voicemailId

string

options

RequestOptions & object

Returns

Promise<void>

list

TypeScript
list: (params, options) => PaginatedList<Voicemail>;
Parameters
params

| VoicemailListParams | undefined

options

RequestOptions & object

Returns

PaginatedList<Voicemail>

retrieve

TypeScript
retrieve: (voicemailId, options) => Promise<Voicemail>;
Parameters
voicemailId

string

options

RequestOptions & object

Returns

Promise<Voicemail>

retrieveTranscript

TypeScript
retrieveTranscript: (voicemailId, options) => Promise<VoicemailTranscript>;
Parameters
voicemailId

string

options

RequestOptions & object

Returns

Promise<VoicemailTranscript>

update

TypeScript
update: (voicemailId, params, options) => Promise<Voicemail>;

Mark a voicemail read or unread.

Parameters
voicemailId

string

params

VoicemailUpdateParams

options

RequestOptions & object

Returns

Promise<Voicemail>


webhookEndpoints

TypeScript
webhookEndpoints: object;

Defined in: sdk/server/src/index.ts:2897

Manage webhook endpoints. The mode of the endpoint (live vs sandbox) is determined by the API key used — a test key creates and lists sandbox endpoints, a live key creates and lists live endpoints.

create

TypeScript
create: (params, options?) => Promise<WebhookEndpoint>;
Parameters
params

WebhookEndpointCreateParams

options?

RequestOptions

Returns

Promise<WebhookEndpoint>

del

TypeScript
del: (webhookEndpointId, options?) => Promise<void>;
Parameters
webhookEndpointId

string

options?

RequestOptions

Returns

Promise<void>

list

TypeScript
list: (params?, options?) => PaginatedList<WebhookEndpoint>;
Parameters
params?

WebhookEndpointListParams

options?

RequestOptions

Returns

PaginatedList<WebhookEndpoint>

retrieve

TypeScript
retrieve: (webhookEndpointId, options?) => Promise<WebhookEndpoint>;
Parameters
webhookEndpointId

string

options?

RequestOptions

Returns

Promise<WebhookEndpoint>

update

TypeScript
update: (webhookEndpointId, params, options?) => Promise<WebhookEndpoint>;
Parameters
webhookEndpointId

string

params

WebhookEndpointUpdateParams

options?

RequestOptions

Returns

Promise<WebhookEndpoint>


webhooks

TypeScript
static webhooks: object;

Defined in: sdk/server/src/index.ts:4365

Verify webhook signature and construct event

constructEvent

TypeScript
constructEvent: <T>(payload, signature, secret, tolerance) => T;
Type Parameters
T

T = WebhookEvent

Parameters
payload

string | Buffer<ArrayBufferLike>

signature

string

secret

string

tolerance?

number = 300

Returns

T

Example

TypeScript
// For call webhooks
const event = DialStack.webhooks.constructEvent(
req.body,
req.headers['x-dialstack-signature'],
process.env.DIALSTACK_WEBHOOK_SECRET
);

// For appointments webhooks (with type parameter)
const event = DialStack.webhooks.constructEvent<AvailabilitySearchWebhook>(
req.body,
req.headers['x-dialstack-signature'],
process.env.DIALSTACK_WEBHOOK_SECRET
);

Methods

off()

TypeScript
off<E>(event, callback): void;

Defined in: sdk/server/src/index.ts:2465

Unsubscribe from SDK events

Type Parameters

E

E extends EventType

Parameters

event

E

callback

EventCallback<E extends "request" ? RequestEvent : ResponseEvent>

Returns

void


on()

TypeScript
on<E>(event, callback): void;

Defined in: sdk/server/src/index.ts:2451

Subscribe to SDK events

Type Parameters

E

E extends EventType

Parameters

event

E

callback

EventCallback<E extends "request" ? RequestEvent : ResponseEvent>

Returns

void

Example

TypeScript
dialstack.on('request', (event) => {
console.log(`${event.method} ${event.path}`);
});

dialstack.on('response', (event) => {
console.log(`${event.statusCode} in ${event.elapsed}ms`);
});