@dialstack/sdk-dev / server/src / DialStack
Class: DialStack
Defined in: sdk/server/src/index.ts:2406
Constructors
Constructor
new DialStack(apiKey, config?): DialStack;
Defined in: sdk/server/src/index.ts:2417
Parameters
apiKey
string | undefined
config?
Returns
DialStack
Properties
accounts
accounts: object;
Defined in: sdk/server/src/index.ts:2807
acceptTos
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
options?
Returns
Promise<Tos>
create
create: (params, options?) => Promise<Account>;
Parameters
params
options?
Returns
Promise<Account>
del
del: (accountId, options?) => Promise<void>;
Parameters
accountId
string
options?
Returns
Promise<void>
list
list: (params?, options?) => PaginatedList<Account>;
Parameters
params?
options?
Returns
retrieve
retrieve: (accountId, options?) => Promise<Account>;
Parameters
accountId
string
options?
Returns
Promise<Account>
retrievePricing
retrievePricing: (accountId, options?) => Promise<AccountPricing>;
Retrieve the agreed pricing singleton for an account.
Parameters
accountId
string
options?
Returns
Promise<AccountPricing>
retrieveTos
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
update: (accountId, params, options?) => Promise<Account>;
Parameters
accountId
string
params
options?
Returns
Promise<Account>
updatePricing
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
options?
Returns
Promise<AccountPricing>
accountSessions
accountSessions: object;
Defined in: sdk/server/src/index.ts:3106
create
create: (params, options?) => Promise<AccountSessionCreateResponse>;
Parameters
params
options?
Returns
Promise<AccountSessionCreateResponse>
admin
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
users: object;
users.list
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
users.retrieve
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
aiAgents: object;
Defined in: sdk/server/src/index.ts:4001
create
create: (params, options) => Promise<AIAgent>;
Parameters
params
options
RequestOptions & object
Returns
Promise<AIAgent>
del
del: (aiAgentId, options) => Promise<void>;
Parameters
aiAgentId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<AIAgent>;
Parameters
params
AIAgentListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (aiAgentId, options) => Promise<AIAgent>;
Parameters
aiAgentId
string
options
RequestOptions & object
Returns
Promise<AIAgent>
update
update: (aiAgentId, params, options) => Promise<AIAgent>;
Parameters
aiAgentId
string
params
options
RequestOptions & object
Returns
Promise<AIAgent>
buttonTemplates
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
create: (params, options) => Promise<ButtonTemplate>;
Parameters
params
options
RequestOptions & object
Returns
Promise<ButtonTemplate>
createButton
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
options
RequestOptions & object
Returns
Promise<TemplateButton>
del
del: (buttonTemplateId, options) => Promise<void>;
Parameters
buttonTemplateId
string
options
RequestOptions & object
Returns
Promise<void>
delButton
delButton: (buttonTemplateId, buttonId, options) => Promise<void>;
Parameters
buttonTemplateId
string
buttonId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<ButtonTemplate>;
Parameters
params
| ButtonTemplateListParams
| undefined
options
RequestOptions & object
Returns
listButtons
listButtons: (buttonTemplateId, params, options) => PaginatedList<TemplateButton>;
Parameters
buttonTemplateId
string
params
| TemplateButtonListParams
| undefined
options
RequestOptions & object
Returns
retrieve
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
update: (buttonTemplateId, params, options) => Promise<ButtonTemplate>;
Parameters
buttonTemplateId
string
params
options
RequestOptions & object
Returns
Promise<ButtonTemplate>
updateButton
updateButton: (buttonTemplateId, buttonId, params, options) => Promise<TemplateButton>;
Move a button. Position is the only updatable field.
Parameters
buttonTemplateId
string
buttonId
string
params
options
RequestOptions & object
Returns
Promise<TemplateButton>
calls
calls: object;
Defined in: sdk/server/src/index.ts:3124
create
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
options
RequestOptions & object
Returns
Promise<void>
createListener
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
options
RequestOptions & object
Returns
Promise<Listener>
delListener
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
list: (params, options) => PaginatedList<CallLog>;
Parameters
params
CallListParams | undefined
options
RequestOptions & object
Returns
listListeners
listListeners: (callId, params, options) => PaginatedList<Listener>;
Parameters
callId
string
params
ListenerListParams | undefined
options
RequestOptions & object
Returns
pauseRecording
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
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
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
retrieveListener: (callId, listenerId, options) => Promise<Listener>;
Parameters
callId
string
listenerId
string
options
RequestOptions & object
Returns
Promise<Listener>
retrieveRecording
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
retrieveTranscript: (callId, options) => Promise<Transcript>;
Parameters
callId
string
options
RequestOptions & object
Returns
Promise<Transcript>
update
update: (callId, params, options) => Promise<void>;
Parameters
callId
string
params
options
RequestOptions & object
Returns
Promise<void>
devices
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
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
options
RequestOptions & object
Returns
Promise<DeviceUserAssignment>
checkSync
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
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
options
RequestOptions & object
Returns
Promise<CreateDeviceResponse>
createButtonOverride
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
del: (deviceId, options) => Promise<void>;
Parameters
deviceId
string
options
RequestOptions & object
Returns
Promise<void>
delButtonOverride
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
list: (params, options) => PaginatedList<Device>;
Parameters
params
DeviceListParams | undefined
options
RequestOptions & object
Returns
listButtonOverrides
listButtonOverrides: (deviceId, params, options) => PaginatedList<DeviceButtonOverride>;
Parameters
deviceId
string
params
| DeviceButtonListParams
| undefined
options
RequestOptions & object
Returns
PaginatedList<DeviceButtonOverride>
listButtons
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
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
listUsers
listUsers: (deviceId, options) => Promise<ListResponse<DeviceUserAssignment>>;
Parameters
deviceId
string
options
RequestOptions & object
Returns
Promise<ListResponse<DeviceUserAssignment>>
removeUser
removeUser: (deviceId, userId, options) => Promise<void>;
Parameters
deviceId
string
userId
string
options
RequestOptions & object
Returns
Promise<void>
retrieve
retrieve: (deviceId, options) => Promise<Device>;
Parameters
deviceId
string
options
RequestOptions & object
Returns
Promise<Device>
update
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
options
RequestOptions & object
Returns
Promise<Device>
dialPlans
dialPlans: object;
Defined in: sdk/server/src/index.ts:4089
create
create: (params, options) => Promise<DialPlan>;
Parameters
params
options
RequestOptions & object
Returns
Promise<DialPlan>
list
list: (params, options) => PaginatedList<DialPlan>;
Parameters
params
DialPlanListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (dialPlanId, options) => Promise<DialPlan>;
Parameters
dialPlanId
string
options
RequestOptions & object
Returns
Promise<DialPlan>
extensions
extensions: object;
Defined in: sdk/server/src/index.ts:4125
create
create: (params, options) => Promise<Extension>;
Parameters
params
options
RequestOptions & object
Returns
Promise<Extension>
del
del: (number, options) => Promise<void>;
Parameters
number
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<Extension>;
Parameters
params
| ExtensionListParams
| undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (number, options) => Promise<Extension>;
Parameters
number
string
options
RequestOptions & object
Returns
Promise<Extension>
update
update: (number, params, options) => Promise<Extension>;
Parameters
number
string
params
options
RequestOptions & object
Returns
Promise<Extension>
faxes
faxes: object;
Defined in: sdk/server/src/index.ts:3399
del
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
list: (params, options) => PaginatedList<Fax>;
Parameters
params
FaxListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (faxId, options) => Promise<Fax>;
Parameters
faxId
string
options
RequestOptions & object
Returns
Promise<Fax>
send
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
options
RequestOptions & object
Returns
Promise<Fax>
update
update: (faxId, params, options) => Promise<Fax>;
Mark a received fax read or unread.
Parameters
faxId
string
params
options
RequestOptions & object
Returns
Promise<Fax>
hardwareOrders
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
create: (params, options) => Promise<HardwareOrder>;
Parameters
params
options
RequestOptions & object
Returns
Promise<HardwareOrder>
list
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
retrieve: (hardwareOrderId, options) => Promise<HardwareOrder>;
Parameters
hardwareOrderId
string
options
RequestOptions & object
Returns
Promise<HardwareOrder>
update
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
options
RequestOptions & object
Returns
Promise<HardwareOrder>
updateItem
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
options
RequestOptions & object
Returns
Promise<HardwareOrderItem>
phoneNumbers
phoneNumbers: object;
Defined in: sdk/server/src/index.ts:3085
list
list: (params, options) => PaginatedList<PhoneNumber>;
Parameters
params
| PhoneNumberListParams
| undefined
options
RequestOptions & object
Returns
presence
presence: object;
Defined in: sdk/server/src/index.ts:3045
list
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
options
RequestOptions & object
Returns
Promise<ListResponse<PresenceItem>>
subscribeParkSlots
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
options
RequestOptions & object & ParkSlotSubscriptionOptions
Returns
queues
queues: object;
Defined in: sdk/server/src/index.ts:4247
addMember
addMember: (queueId, params, options) => Promise<QueueMember>;
Parameters
queueId
string
params
options
RequestOptions & object
Returns
Promise<QueueMember>
create
create: (params, options) => Promise<Queue>;
Parameters
params
options
RequestOptions & object
Returns
Promise<Queue>
del
del: (queueId, options) => Promise<void>;
Parameters
queueId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<Queue>;
Parameters
params
QueueListParams | undefined
options
RequestOptions & object
Returns
listMembers
listMembers: (queueId, params, options) => PaginatedList<QueueMember>;
Parameters
queueId
string
params
| QueueListMembersParams
| undefined
options
RequestOptions & object
Returns
removeMember
removeMember: (queueId, memberId, options) => Promise<void>;
Parameters
queueId
string
memberId
string
options
RequestOptions & object
Returns
Promise<void>
retrieve
retrieve: (queueId, options) => Promise<Queue>;
Parameters
queueId
string
options
RequestOptions & object
Returns
Promise<Queue>
update
update: (queueId, params, options) => Promise<Queue>;
Parameters
queueId
string
params
options
RequestOptions & object
Returns
Promise<Queue>
ringGroups
ringGroups: object;
Defined in: sdk/server/src/index.ts:4175
addMember
addMember: (ringGroupId, params, options) => Promise<RingGroupMember>;
Parameters
ringGroupId
string
params
options
RequestOptions & object
Returns
Promise<RingGroupMember>
create
create: (params, options) => Promise<RingGroup>;
Parameters
params
options
RequestOptions & object
Returns
Promise<RingGroup>
del
del: (ringGroupId, options) => Promise<void>;
Parameters
ringGroupId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<RingGroup>;
Parameters
params
| RingGroupListParams
| undefined
options
RequestOptions & object
Returns
removeMember
removeMember: (ringGroupId, memberId, options) => Promise<void>;
Parameters
ringGroupId
string
memberId
string
options
RequestOptions & object
Returns
Promise<void>
retrieve
retrieve: (ringGroupId, options) => Promise<RingGroup>;
Parameters
ringGroupId
string
options
RequestOptions & object
Returns
Promise<RingGroup>
update
update: (ringGroupId, params, options) => Promise<RingGroup>;
Parameters
ringGroupId
string
params
options
RequestOptions & object
Returns
Promise<RingGroup>
schedules
schedules: object;
Defined in: sdk/server/src/index.ts:4055
create
create: (params, options) => Promise<Schedule>;
Parameters
params
options
RequestOptions & object
Returns
Promise<Schedule>
list
list: (params, options) => PaginatedList<Schedule>;
Parameters
params
ScheduleListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (scheduleId, options) => Promise<Schedule>;
Parameters
scheduleId
string
options
RequestOptions & object
Returns
Promise<Schedule>
testHelpers
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
calls: object;
calls.create
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
options
RequestOptions & object
Returns
Promise<TestCallResponse>
events
events: object;
events.create
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
options
RequestOptions & object
Returns
Promise<TestEventResponse>
users
users: object;
Defined in: sdk/server/src/index.ts:2945
create
create: (params, options) => Promise<User>;
Parameters
params
UserCreateParams | undefined
options
RequestOptions & object
Returns
Promise<User>
del
del: (userId, options) => Promise<void>;
Parameters
userId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<User>;
Parameters
params
UserListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (userId, options) => Promise<User>;
Parameters
userId
string
options
RequestOptions & object
Returns
Promise<User>
retrievePresence
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
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
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?
Returns
Promise<UserSessionsRevokeResponse>
update
update: (userId, params, options) => Promise<User>;
Parameters
userId
string
params
options
RequestOptions & object
Returns
Promise<User>
updateQueueAgent
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
options
RequestOptions & object
Returns
Promise<QueueAgent>
userSessions
userSessions: object;
Defined in: sdk/server/src/index.ts:3115
create
create: (params, options?) => Promise<UserSessionCreateResponse>;
Parameters
params
options?
Returns
Promise<UserSessionCreateResponse>
voiceApps
voiceApps: object;
Defined in: sdk/server/src/index.ts:3950
create
create: (params, options) => Promise<VoiceApp>;
Parameters
params
options
RequestOptions & object
Returns
Promise<VoiceApp>
del
del: (voiceAppId, options) => Promise<void>;
Parameters
voiceAppId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<VoiceApp>;
Parameters
params
VoiceAppListParams | undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (voiceAppId, options) => Promise<VoiceApp>;
Parameters
voiceAppId
string
options
RequestOptions & object
Returns
Promise<VoiceApp>
update
update: (voiceAppId, params, options) => Promise<VoiceApp>;
Parameters
voiceAppId
string
params
options
RequestOptions & object
Returns
Promise<VoiceApp>
voicemailGreetings
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
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
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
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
voicemails: object;
Defined in: sdk/server/src/index.ts:3285
del
del: (voicemailId, options) => Promise<void>;
Parameters
voicemailId
string
options
RequestOptions & object
Returns
Promise<void>
list
list: (params, options) => PaginatedList<Voicemail>;
Parameters
params
| VoicemailListParams
| undefined
options
RequestOptions & object
Returns
retrieve
retrieve: (voicemailId, options) => Promise<Voicemail>;
Parameters
voicemailId
string
options
RequestOptions & object
Returns
Promise<Voicemail>
retrieveTranscript
retrieveTranscript: (voicemailId, options) => Promise<VoicemailTranscript>;
Parameters
voicemailId
string
options
RequestOptions & object
Returns
Promise<VoicemailTranscript>
update
update: (voicemailId, params, options) => Promise<Voicemail>;
Mark a voicemail read or unread.
Parameters
voicemailId
string
params
options
RequestOptions & object
Returns
Promise<Voicemail>
webhookEndpoints
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
create: (params, options?) => Promise<WebhookEndpoint>;
Parameters
params
options?
Returns
Promise<WebhookEndpoint>
del
del: (webhookEndpointId, options?) => Promise<void>;
Parameters
webhookEndpointId
string
options?
Returns
Promise<void>
list
list: (params?, options?) => PaginatedList<WebhookEndpoint>;
Parameters
params?
options?
Returns
PaginatedList<WebhookEndpoint>
retrieve
retrieve: (webhookEndpointId, options?) => Promise<WebhookEndpoint>;
Parameters
webhookEndpointId
string
options?
Returns
Promise<WebhookEndpoint>
update
update: (webhookEndpointId, params, options?) => Promise<WebhookEndpoint>;
Parameters
webhookEndpointId
string
params
options?
Returns
Promise<WebhookEndpoint>
webhooks
static webhooks: object;
Defined in: sdk/server/src/index.ts:4365
Verify webhook signature and construct event
constructEvent
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
// 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()
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()
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
dialstack.on('request', (event) => {
console.log(`${event.method} ${event.path}`);
});
dialstack.on('response', (event) => {
console.log(`${event.statusCode} in ${event.elapsed}ms`);
});