@signalhouse-sms/sdk 1.14.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/SignalHouseSDK.js +6 -0
- package/src/domains/Auth.js +3 -2
- package/src/domains/Brands.js +1 -1
- package/src/domains/Compliance.js +324 -0
- package/src/domains/Groups.js +68 -0
- package/src/domains/Messages.js +1 -1
- package/src/domains/Subgroups.js +51 -0
- package/src/domains/Vetting.js +159 -0
- package/src/domains/Voice.js +3 -0
- package/src/domains/voice/CallFlows.js +243 -0
- package/src/domains/voice/NumberRoutes.js +2 -1
- package/src/domains/voice/ProgrammableVoiceProfiles.js +4 -2
- package/types/SignalHouseSDK.d.ts +4 -0
- package/types/domains/Auth.d.ts +3 -1
- package/types/domains/Brands.d.ts +1 -1
- package/types/domains/Compliance.d.ts +325 -0
- package/types/domains/Groups.d.ts +64 -0
- package/types/domains/Messages.d.ts +1 -1
- package/types/domains/Subgroups.d.ts +51 -0
- package/types/domains/Vetting.d.ts +163 -0
- package/types/domains/Voice.d.ts +3 -0
- package/types/domains/voice/CallFlows.d.ts +319 -0
- package/types/domains/voice/NumberRoutes.d.ts +8 -3
- package/types/domains/voice/ProgrammableVoiceProfiles.d.ts +16 -6
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Vetting domain: the staff-only brand vetting engine for branded calling. A case runs a brand through automated checks, a
|
|
9
|
+
* rules engine decides it, and staff work only the exception queue. Every method lives under the admin namespace, present
|
|
10
|
+
* only when the SDK is created with `enableAdmin: true`. JS SDK only by design.
|
|
11
|
+
*/
|
|
12
|
+
export class Vetting {
|
|
13
|
+
constructor(client, enableAdmin) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
this.enableAdmin = enableAdmin;
|
|
16
|
+
|
|
17
|
+
// Hidden Admin namespace INSIDE the domain
|
|
18
|
+
if (enableAdmin) {
|
|
19
|
+
this.admin = {
|
|
20
|
+
/**
|
|
21
|
+
* Start vetting a brand. The case runs in the background; read it with getVettingCase. Staff-only.
|
|
22
|
+
* @async
|
|
23
|
+
* @roles signalhouse
|
|
24
|
+
* @param {Object} params
|
|
25
|
+
* @param {Object} params.subject - The brand: `{ legalName, entityType?, displayName?, ein?, website?, sector?,
|
|
26
|
+
* authorizer?: { name?, email?, phone? }, billingContact?: { name?, email?, phone? },
|
|
27
|
+
* billingAddress?: { street?, city?, state?, postalCode?, country? }, groupId?, brandId? }`. Only `legalName` is
|
|
28
|
+
* required to start; a case missing any field the checks need is rejected with a cure listing them.
|
|
29
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
30
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
31
|
+
* @returns {Promise<SdkResponse<any>>} - `{ caseId, tenantId, status }`, accepted with HTTP 202
|
|
32
|
+
*/
|
|
33
|
+
startVettingCase: async ({ subject, tenantId, options = {} }) => {
|
|
34
|
+
this.client._require({ subject });
|
|
35
|
+
return this.client("/vetting/cases", { method: "POST", body: { subject, ...(tenantId !== undefined ? { tenantId } : {}) }, ...options });
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* List vetting cases, newest first. Staff-only.
|
|
40
|
+
* @async
|
|
41
|
+
* @roles signalhouse
|
|
42
|
+
* @param {Object} [params]
|
|
43
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
44
|
+
* @param {("RUNNING"|"DECIDING"|"VERIFIED"|"REJECTED"|"FALLBACK"|"EXCEPTION"|"HUMAN_SIGNOFF")} [params.status] - Only cases in this status
|
|
45
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
46
|
+
* @param {number} [params.limit] - Cases per page (default 25, max 100)
|
|
47
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
48
|
+
* @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`
|
|
49
|
+
*/
|
|
50
|
+
getVettingCases: async ({ tenantId, status, page, limit, options = {} } = {}) => {
|
|
51
|
+
const queryString = this.client._getQueryString({ tenantId, status, page, limit });
|
|
52
|
+
return this.client(`/vetting/cases${queryString}`, { method: "GET", ...options });
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get one vetting case with its steps, decision and history. Staff-only.
|
|
57
|
+
* @async
|
|
58
|
+
* @roles signalhouse
|
|
59
|
+
* @param {Object} params
|
|
60
|
+
* @param {string} params.caseId - The case ID
|
|
61
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
62
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
63
|
+
* @returns {Promise<SdkResponse<any>>} - The case
|
|
64
|
+
*/
|
|
65
|
+
getVettingCase: async ({ caseId, tenantId, options = {} }) => {
|
|
66
|
+
this.client._require({ caseId });
|
|
67
|
+
const queryString = this.client._getQueryString({ tenantId });
|
|
68
|
+
return this.client(`/vetting/cases/${encodeURIComponent(caseId)}${queryString}`, { method: "GET", ...options });
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Export every evidence item for a case, oldest first, each with its payload's SHA-256. Staff-only.
|
|
73
|
+
* @async
|
|
74
|
+
* @roles signalhouse
|
|
75
|
+
* @param {Object} params
|
|
76
|
+
* @param {string} params.caseId - The case ID
|
|
77
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
78
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
79
|
+
* @returns {Promise<SdkResponse<any>>} - `{ caseId, tenantId, status, decision, exportedAt, evidence }`
|
|
80
|
+
*/
|
|
81
|
+
getVettingEvidence: async ({ caseId, tenantId, options = {} }) => {
|
|
82
|
+
this.client._require({ caseId });
|
|
83
|
+
const queryString = this.client._getQueryString({ tenantId });
|
|
84
|
+
return this.client(`/vetting/cases/${encodeURIComponent(caseId)}/evidence${queryString}`, { method: "GET", ...options });
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* List the vetting exception queue, oldest first. Staff-only.
|
|
89
|
+
* @async
|
|
90
|
+
* @roles signalhouse
|
|
91
|
+
* @param {Object} [params]
|
|
92
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
93
|
+
* @param {("OPEN"|"CLAIMED"|"RESOLVED")} [params.status] - Only items in this status
|
|
94
|
+
* @param {("EXCEPTION"|"HUMAN_SIGNOFF"|"QA_SAMPLE")} [params.kind] - Only items of this kind
|
|
95
|
+
* @param {string} [params.reasonCode] - Only items with this reason
|
|
96
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
97
|
+
* @param {number} [params.limit] - Items per page (default 25, max 100)
|
|
98
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
99
|
+
* @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`
|
|
100
|
+
*/
|
|
101
|
+
getVettingExceptions: async ({ tenantId, status, kind, reasonCode, page, limit, options = {} } = {}) => {
|
|
102
|
+
const queryString = this.client._getQueryString({ tenantId, status, kind, reasonCode, page, limit });
|
|
103
|
+
return this.client(`/vetting/exceptions${queryString}`, { method: "GET", ...options });
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Claim an open exception queue item, or take over one whose holder is no longer a Compliance Admin. Only one staff
|
|
108
|
+
* member can hold an item. Compliance Admins only, and never on a case the caller started.
|
|
109
|
+
* @async
|
|
110
|
+
* @roles signalhouse_user holding the COMPLIANCE_ADMIN staff permission (never signalhouse_admin)
|
|
111
|
+
* @param {Object} params
|
|
112
|
+
* @param {string} params.exceptionId - The queue item ID
|
|
113
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
114
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
115
|
+
* @returns {Promise<SdkResponse<any>>} - The claimed item
|
|
116
|
+
*/
|
|
117
|
+
claimVettingException: async ({ exceptionId, tenantId, options = {} }) => {
|
|
118
|
+
this.client._require({ exceptionId });
|
|
119
|
+
return this.client(`/vetting/exceptions/${encodeURIComponent(exceptionId)}/claim`, { method: "POST", body: { ...(tenantId !== undefined ? { tenantId } : {}) }, ...options });
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Resolve a claimed exception queue item and set the case's result by hand. On a QA sample, VERIFY confirms the
|
|
124
|
+
* auto-approval and REJECT overturns it. Compliance Admins only: the one holding the item.
|
|
125
|
+
* @async
|
|
126
|
+
* @roles signalhouse_user holding the COMPLIANCE_ADMIN staff permission (never signalhouse_admin)
|
|
127
|
+
* @param {Object} params
|
|
128
|
+
* @param {string} params.exceptionId - The queue item ID
|
|
129
|
+
* @param {("VERIFY"|"REJECT")} params.outcome - The result
|
|
130
|
+
* @param {string} params.note - Why, kept with the case's evidence
|
|
131
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
132
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
133
|
+
* @returns {Promise<SdkResponse<any>>} - `{ exception, case: { caseId, tenantId, status, decision } }`; read the full case with getVettingCase
|
|
134
|
+
*/
|
|
135
|
+
resolveVettingException: async ({ exceptionId, outcome, note, tenantId, options = {} }) => {
|
|
136
|
+
this.client._require({ exceptionId, outcome, note });
|
|
137
|
+
return this.client(`/vetting/exceptions/${encodeURIComponent(exceptionId)}/resolve`, { method: "POST", body: { outcome, note, ...(tenantId !== undefined ? { tenantId } : {}) }, ...options });
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Report vetting outcomes over a period (the last 30 days by default): counts by status, the straight-through rate,
|
|
142
|
+
* and the exception reasons. Staff-only.
|
|
143
|
+
* @async
|
|
144
|
+
* @roles signalhouse
|
|
145
|
+
* @param {Object} [params]
|
|
146
|
+
* @param {string} [params.tenantId] - The vetting tenant (default "signalhouse")
|
|
147
|
+
* @param {string} [params.from] - Start of the period (ISO date)
|
|
148
|
+
* @param {string} [params.to] - End of the period (ISO date)
|
|
149
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
150
|
+
* @returns {Promise<SdkResponse<any>>} - `{ tenantId, from, to, cases: { total, decided, byStatus }, straightThrough: { count, rate }, exceptionReasons }`
|
|
151
|
+
*/
|
|
152
|
+
getVettingReport: async ({ tenantId, from, to, options = {} } = {}) => {
|
|
153
|
+
const queryString = this.client._getQueryString({ tenantId, from, to });
|
|
154
|
+
return this.client(`/vetting/report${queryString}`, { method: "GET", ...options });
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
package/src/domains/Voice.js
CHANGED
|
@@ -8,6 +8,7 @@ import { GlobalVoiceSettings } from "./voice/GlobalVoiceSettings.js";
|
|
|
8
8
|
import { Tokens } from "./voice/Tokens.js";
|
|
9
9
|
import { Analytics } from "./voice/Analytics.js";
|
|
10
10
|
import { OutboundVoice } from "./voice/OutboundVoice.js";
|
|
11
|
+
import { CallFlows } from "./voice/CallFlows.js";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Voice domain — wraps the Voice service (mounted under /voice on the
|
|
@@ -19,6 +20,7 @@ import { OutboundVoice } from "./voice/OutboundVoice.js";
|
|
|
19
20
|
* - `sdk.voice.sipProfiles` — SIP profile / endpoint (single registerable UA).
|
|
20
21
|
* - `sdk.voice.programmableVoiceProfiles` — Programmable Voice Profile (route a set of numbers through Signal House).
|
|
21
22
|
* - `sdk.voice.numberRoutes` — Per-number inbound route (overrides the profile and subgroup settings).
|
|
23
|
+
* - `sdk.voice.callFlows` — Call flows: customer-built call trees a number or profile can run.
|
|
22
24
|
* - `sdk.voice.calls` — Twilio-compat programmatic call control (create/hangup/etc.).
|
|
23
25
|
* - `sdk.voice.callLogs` — Account-scoped call history: list/get + presigned recording.
|
|
24
26
|
* - `sdk.voice.globalVoiceSettings` — Account-wide voice defaults (accepted regions, max spend, E911).
|
|
@@ -39,5 +41,6 @@ export class Voice {
|
|
|
39
41
|
this.tokens = new Tokens(client, enableAdmin);
|
|
40
42
|
this.analytics = new Analytics(client, enableAdmin);
|
|
41
43
|
this.outboundVoice = new OutboundVoice(client, enableAdmin);
|
|
44
|
+
this.callFlows = new CallFlows(client, enableAdmin);
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} CallFlowListFilters
|
|
9
|
+
* @property {number} [page] - Page number, from 1 (default 1).
|
|
10
|
+
* @property {number} [limit] - Page size, 1-100 (default 20).
|
|
11
|
+
* @property {string} [q] - Match against the flow name.
|
|
12
|
+
* @property {string} [subgroupId] - Only flows in this subgroup.
|
|
13
|
+
* @property {boolean} [includeDeleted] - Include deleted flows (default false).
|
|
14
|
+
* @property {"createdAt"|"updatedAt"|"name"} [sortBy] - Sort field (default "createdAt").
|
|
15
|
+
* @property {"asc"|"desc"} [sortOrder] - Sort direction (default "desc").
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} CreateCallFlowData
|
|
20
|
+
* @property {string} name - Flow name, unique within its subgroup.
|
|
21
|
+
* @property {string} subgroupId - The subgroup the flow belongs to. Fixed once created; only numbers and Programmable Voice Profiles in this subgroup can run the flow.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {Object} UpdateCallFlowData
|
|
26
|
+
* @property {string} [name] - New name, unique within the flow's subgroup.
|
|
27
|
+
* @property {"ACTIVE"|"DISABLED"} [status] - A disabled flow does not run; numbers routed to it fall through to their next routing layer.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {Object} CallFlowStep
|
|
32
|
+
* @property {string} id - A UUID you generate. It is kept as the step's id, so it stays stable across saves.
|
|
33
|
+
* @property {"inbound"|"answer"|"play"|"sms"|"ivr"|"fwd_phone"|"voicemail"|"hangup"} type - The step kind. `catalog()` lists the kinds this service can run.
|
|
34
|
+
* @property {string} name - Display name.
|
|
35
|
+
* @property {Object} [config] - The step's settings, which depend on its type.
|
|
36
|
+
* @property {number} [positionX] - Canvas x position, for a visual builder.
|
|
37
|
+
* @property {number} [positionY] - Canvas y position, for a visual builder.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} CallFlowConnection
|
|
42
|
+
* @property {string} id - A UUID you generate.
|
|
43
|
+
* @property {string} fromNodeId - The step the connection leaves.
|
|
44
|
+
* @property {string} toNodeId - The step it leads to.
|
|
45
|
+
* @property {string} port - The outcome of the source step it leaves from, e.g. "next", "success", "no_input" or "opt_<optionId>".
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {Object} CallFlowDraft
|
|
50
|
+
* @property {CallFlowStep[]} nodes - Every step in the flow, including exactly one "inbound" step.
|
|
51
|
+
* @property {CallFlowConnection[]} edges - Every connection between steps.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Call Flows — customer-built call trees (greeting, menu, forward, voicemail, hang up)
|
|
56
|
+
* that run when a number's route, or its Programmable Voice Profile, names the flow
|
|
57
|
+
* with `routeAction: "CALL_FLOW"`.
|
|
58
|
+
*
|
|
59
|
+
* Each flow has one working draft you edit with `saveDraft`, and published versions.
|
|
60
|
+
* `publish` validates the draft and makes it the version calls run; the draft stays
|
|
61
|
+
* editable without affecting calls until you publish again.
|
|
62
|
+
*
|
|
63
|
+
* Calls the Voice service mounted under /voice. Accessed via `sdk.voice.callFlows`.
|
|
64
|
+
*/
|
|
65
|
+
export class CallFlows {
|
|
66
|
+
constructor(client, enableAdmin) {
|
|
67
|
+
this.client = client;
|
|
68
|
+
this.enableAdmin = enableAdmin;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* List the account's call flows, newest first by default.
|
|
73
|
+
* @async
|
|
74
|
+
* @roles api, admin, developer, billing, user
|
|
75
|
+
* @param {Object} [params] - Request parameters.
|
|
76
|
+
* @param {CallFlowListFilters} [params.filters] - Paging, search, subgroup and sort.
|
|
77
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
78
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: [...], meta: { total, page, limit, totalPages } }`.
|
|
79
|
+
*/
|
|
80
|
+
async list({ filters = {}, options = {} } = {}) {
|
|
81
|
+
const query = new URLSearchParams();
|
|
82
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
83
|
+
if (v !== undefined && v !== null && v !== "") query.set(k, String(v));
|
|
84
|
+
}
|
|
85
|
+
const qs = query.toString();
|
|
86
|
+
return this.client(`/voice/api/v1/call-flows${qs ? `?${qs}` : ""}`, { method: "GET", ...options });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* List the step types this service can run, with the outcomes each one offers.
|
|
91
|
+
* @async
|
|
92
|
+
* @roles api, admin, developer, billing, user
|
|
93
|
+
* @param {Object} [params] - Request parameters.
|
|
94
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
95
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { nodeTypes: [{ type, ports, configurable }] } }`.
|
|
96
|
+
*/
|
|
97
|
+
async catalog({ options = {} } = {}) {
|
|
98
|
+
return this.client(`/voice/api/v1/call-flows/catalog`, { method: "GET", ...options });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get a call flow with its working draft and the issues that stop the draft being published.
|
|
103
|
+
* @async
|
|
104
|
+
* @roles api, admin, developer, billing, user
|
|
105
|
+
* @param {Object} params - Request parameters.
|
|
106
|
+
* @param {string} params.id - The call flow UUID.
|
|
107
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
108
|
+
* @throws {Error} If id is missing.
|
|
109
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { ...flow, draft: { versionId, nodes, edges, issues } } }`.
|
|
110
|
+
*/
|
|
111
|
+
async get({ id, options = {} }) {
|
|
112
|
+
this.client._require({ id });
|
|
113
|
+
const safeId = encodeURIComponent(id);
|
|
114
|
+
return this.client(`/voice/api/v1/call-flows/${safeId}`, { method: "GET", ...options });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create a call flow, with its working draft and the Inbound Call step every flow starts from.
|
|
119
|
+
* @async
|
|
120
|
+
* @roles api, admin, developer
|
|
121
|
+
* @param {Object} params - Request parameters.
|
|
122
|
+
* @param {CreateCallFlowData} params.flowData - The flow to create.
|
|
123
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
124
|
+
* @throws {Error} If flowData is missing.
|
|
125
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { ...flow, draft } }`.
|
|
126
|
+
*/
|
|
127
|
+
async create({ flowData, options = {} }) {
|
|
128
|
+
this.client._require({ flowData });
|
|
129
|
+
return this.client(`/voice/api/v1/call-flows`, { method: "POST", body: flowData, ...options });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Rename a call flow, or enable or disable it (partial update).
|
|
134
|
+
* @async
|
|
135
|
+
* @roles api, admin, developer
|
|
136
|
+
* @param {Object} params - Request parameters.
|
|
137
|
+
* @param {string} params.id - The call flow UUID.
|
|
138
|
+
* @param {UpdateCallFlowData} params.updateData - Fields to update.
|
|
139
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
140
|
+
* @throws {Error} If id or updateData is missing.
|
|
141
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { ...flow, draft } }`.
|
|
142
|
+
*/
|
|
143
|
+
async update({ id, updateData, options = {} }) {
|
|
144
|
+
this.client._require({ id, updateData });
|
|
145
|
+
const safeId = encodeURIComponent(id);
|
|
146
|
+
return this.client(`/voice/api/v1/call-flows/${safeId}`, { method: "PATCH", body: updateData, ...options });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Delete a call flow. Reversible with `restore`: while deleted, numbers and profiles
|
|
151
|
+
* routed to it fall through to their next routing layer.
|
|
152
|
+
* @async
|
|
153
|
+
* @roles api, admin, developer
|
|
154
|
+
* @param {Object} params - Request parameters.
|
|
155
|
+
* @param {string} params.id - The call flow UUID.
|
|
156
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
157
|
+
* @throws {Error} If id is missing.
|
|
158
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { ...flow } }`.
|
|
159
|
+
*/
|
|
160
|
+
async delete({ id, options = {} }) {
|
|
161
|
+
this.client._require({ id });
|
|
162
|
+
const safeId = encodeURIComponent(id);
|
|
163
|
+
return this.client(`/voice/api/v1/call-flows/${safeId}`, { method: "DELETE", ...options });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Restore a deleted call flow.
|
|
168
|
+
*
|
|
169
|
+
* Sends an empty JSON body: the SDK always declares JSON, and the Voice service
|
|
170
|
+
* rejects a JSON request with no body at all.
|
|
171
|
+
* @async
|
|
172
|
+
* @roles api, admin, developer
|
|
173
|
+
* @param {Object} params - Request parameters.
|
|
174
|
+
* @param {string} params.id - The call flow UUID.
|
|
175
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
176
|
+
* @throws {Error} If id is missing.
|
|
177
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { ...flow, draft } }`.
|
|
178
|
+
*/
|
|
179
|
+
async restore({ id, options = {} }) {
|
|
180
|
+
this.client._require({ id });
|
|
181
|
+
const safeId = encodeURIComponent(id);
|
|
182
|
+
return this.client(`/voice/api/v1/call-flows/${safeId}/restore`, { method: "POST", body: {}, ...options });
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Copy a call flow and its working draft into a new flow in the same subgroup. The copy is not published.
|
|
187
|
+
* @async
|
|
188
|
+
* @roles api, admin, developer
|
|
189
|
+
* @param {Object} params - Request parameters.
|
|
190
|
+
* @param {string} params.id - The call flow UUID to copy.
|
|
191
|
+
* @param {string} [params.name] - Name for the copy (default "<name> (copy)").
|
|
192
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
193
|
+
* @throws {Error} If id is missing.
|
|
194
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { ...flow, draft } }`.
|
|
195
|
+
*/
|
|
196
|
+
async duplicate({ id, name, options = {} }) {
|
|
197
|
+
this.client._require({ id });
|
|
198
|
+
const safeId = encodeURIComponent(id);
|
|
199
|
+
return this.client(`/voice/api/v1/call-flows/${safeId}/duplicate`, {
|
|
200
|
+
method: "POST",
|
|
201
|
+
body: name ? { name } : {},
|
|
202
|
+
...options,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Replace the working draft. The whole draft is saved, even when it is not finished;
|
|
208
|
+
* the issues that would stop it being published come back in the response.
|
|
209
|
+
* @async
|
|
210
|
+
* @roles api, admin, developer
|
|
211
|
+
* @param {Object} params - Request parameters.
|
|
212
|
+
* @param {string} params.id - The call flow UUID.
|
|
213
|
+
* @param {CallFlowDraft} params.draft - Every step and connection.
|
|
214
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
215
|
+
* @throws {Error} If id or draft is missing.
|
|
216
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { nodes, edges, issues } }`.
|
|
217
|
+
*/
|
|
218
|
+
async saveDraft({ id, draft, options = {} }) {
|
|
219
|
+
this.client._require({ id, draft });
|
|
220
|
+
const safeId = encodeURIComponent(id);
|
|
221
|
+
return this.client(`/voice/api/v1/call-flows/${safeId}/draft`, { method: "PUT", body: draft, ...options });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Publish the working draft, making it the version calls run. A draft that is not
|
|
226
|
+
* ready returns 400 with `error.issues` listing each step that needs attention.
|
|
227
|
+
*
|
|
228
|
+
* Sends an empty JSON body: the SDK always declares JSON, and the Voice service
|
|
229
|
+
* rejects a JSON request with no body at all.
|
|
230
|
+
* @async
|
|
231
|
+
* @roles api, admin, developer
|
|
232
|
+
* @param {Object} params - Request parameters.
|
|
233
|
+
* @param {string} params.id - The call flow UUID.
|
|
234
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
235
|
+
* @throws {Error} If id is missing.
|
|
236
|
+
* @returns {Promise<SdkResponse<any>>} `{ data: { id, versionNumber, status, publishedAt } }`.
|
|
237
|
+
*/
|
|
238
|
+
async publish({ id, options = {} }) {
|
|
239
|
+
this.client._require({ id });
|
|
240
|
+
const safeId = encodeURIComponent(id);
|
|
241
|
+
return this.client(`/voice/api/v1/call-flows/${safeId}/publish`, { method: "POST", body: {}, ...options });
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {Object} NumberRouteData
|
|
9
|
-
* @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"|"VOICEMAIL"} routeAction - How inbound calls to the number are handled.
|
|
9
|
+
* @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"|"VOICEMAIL"|"CALL_FLOW"} routeAction - How inbound calls to the number are handled. CALL_FLOW runs a call flow (see `sdk.voice.callFlows`).
|
|
10
10
|
* @property {string|null} [forwardToE164] - FORWARD destination (required for FORWARD), or the WEBRTC no-answer destination when noAnswerAction is FORWARD.
|
|
11
11
|
* @property {"VOICEMAIL"|"FORWARD"|"KEEP_RINGING"|null} [noAnswerAction] - WEBRTC only: what happens when nobody answers (default VOICEMAIL).
|
|
12
12
|
* @property {number|null} [noAnswerSeconds] - WEBRTC only: seconds to ring before the no-answer action, 5-120 (default 20).
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* @property {string|null} [routeSipProfileId] - SIP endpoint to ring (required for SIP_PROFILE).
|
|
15
15
|
* @property {string|null} [webhookUrl] - SHML program URL (required for CALL_CONTROL).
|
|
16
16
|
* @property {string|null} [routeAgentProfileId] - AI agent profile id, AGP… (required for AI).
|
|
17
|
+
* @property {string|null} [routeCallFlowId] - Call flow to run (required for CALL_FLOW). Must be in the number's subgroup. It need not be published yet: until it is, calls fall through to the number's profile or subgroup settings, which `effective` shows.
|
|
17
18
|
* @property {boolean} [recordingEnabled] - Record calls handled by this route.
|
|
18
19
|
*/
|
|
19
20
|
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
* @property {string} name - Profile name (required).
|
|
10
10
|
* @property {string[]} subgroupIds - Subgroups this profile spans (required, at least one).
|
|
11
11
|
* @property {string} [region] - Region/POP label.
|
|
12
|
-
* @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"} [routeAction] - Inbound call action (default "FORWARD"). Deliver the call to a PSTN number (FORWARD), ring the profile's subgroup registered softphones (WEBRTC), send to a SIP trunk (SIP_TRUNK), ring a registered SIP endpoint (SIP_PROFILE), hand the call to your programmable call-control webhook that returns SHML (CALL_CONTROL),
|
|
12
|
+
* @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"|"CALL_FLOW"} [routeAction] - Inbound call action (default "FORWARD"). Deliver the call to a PSTN number (FORWARD), ring the profile's subgroup registered softphones (WEBRTC), send to a SIP trunk (SIP_TRUNK), ring a registered SIP endpoint (SIP_PROFILE), hand the call to your programmable call-control webhook that returns SHML (CALL_CONTROL), answer it with an AI agent (AI), or run a call flow (CALL_FLOW).
|
|
13
13
|
* @property {string} [forwardToE164] - Destination number, required when routeAction is "FORWARD".
|
|
14
14
|
* @property {number} [forwardAfterSeconds] - Ring seconds before the action fires.
|
|
15
15
|
* @property {string} [routeSipTrunkId] - SIP trunk id, required when routeAction is "SIP_TRUNK".
|
|
16
16
|
* @property {string} [routeSipProfileId] - SIP endpoint id, required when routeAction is "SIP_PROFILE".
|
|
17
17
|
* @property {string} [webhookUrl] - Your inbound voice webhook (SHML program URL), required when routeAction is "CALL_CONTROL". Inbound calls to this profile's numbers are driven by the SHML your webhook returns.
|
|
18
18
|
* @property {string} [routeAgentProfileId] - AI agent profile id (AGP…), required when routeAction is "AI". The agent's prompt, voice, model and tools are read when the call lands, so editing the agent takes effect on the next call with nothing to re-save here.
|
|
19
|
+
* @property {string} [routeCallFlowId] - Call flow to run, required when routeAction is "CALL_FLOW". Must be in one of the profile's subgroups.
|
|
19
20
|
* @property {boolean} [recordingEnabled] - Record calls on this profile.
|
|
20
21
|
* @property {boolean} [enabled] - Active state (default true).
|
|
21
22
|
*/
|
|
@@ -25,13 +26,14 @@
|
|
|
25
26
|
* @property {string} [name] - Profile name.
|
|
26
27
|
* @property {string[]} [subgroupIds] - Subgroups this profile spans.
|
|
27
28
|
* @property {string|null} [region] - Region/POP label.
|
|
28
|
-
* @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"} [routeAction] - Inbound call action (FORWARD | WEBRTC | SIP_TRUNK | SIP_PROFILE | CALL_CONTROL | AI).
|
|
29
|
+
* @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"|"CALL_FLOW"} [routeAction] - Inbound call action (FORWARD | WEBRTC | SIP_TRUNK | SIP_PROFILE | CALL_CONTROL | AI | CALL_FLOW).
|
|
29
30
|
* @property {string|null} [forwardToE164] - FORWARD destination.
|
|
30
31
|
* @property {number|null} [forwardAfterSeconds] - Ring seconds before the action fires.
|
|
31
32
|
* @property {string|null} [routeSipTrunkId] - SIP trunk id (required when routeAction is "SIP_TRUNK").
|
|
32
33
|
* @property {string|null} [routeSipProfileId] - SIP endpoint id (required when routeAction is "SIP_PROFILE").
|
|
33
34
|
* @property {string|null} [webhookUrl] - Inbound voice webhook / SHML program URL (required when routeAction is "CALL_CONTROL"). Pass null to clear.
|
|
34
35
|
* @property {string|null} [routeAgentProfileId] - AI agent profile id (AGP…), required when routeAction is "AI". Pass null to clear.
|
|
36
|
+
* @property {string|null} [routeCallFlowId] - Call flow to run, required when routeAction is "CALL_FLOW". Must be in one of the profile's subgroups; narrowing subgroupIds away from it is refused. Pass null to clear.
|
|
35
37
|
* @property {boolean} [recordingEnabled] - Record calls on this profile.
|
|
36
38
|
* @property {boolean} [enabled] - Active state.
|
|
37
39
|
*/
|
|
@@ -33,6 +33,8 @@ export class SignalHouseSDK {
|
|
|
33
33
|
audit: Audit;
|
|
34
34
|
contracts: Contracts;
|
|
35
35
|
verify: Verify;
|
|
36
|
+
compliance: Compliance;
|
|
37
|
+
vetting: Vetting;
|
|
36
38
|
/**
|
|
37
39
|
* Client for API requests
|
|
38
40
|
* @private
|
|
@@ -121,3 +123,5 @@ import { Agents } from "./domains/Agents.js";
|
|
|
121
123
|
import { Audit } from "./domains/Audit.js";
|
|
122
124
|
import { Contracts } from "./domains/Contracts.js";
|
|
123
125
|
import { Verify } from "./domains/Verify.js";
|
|
126
|
+
import { Compliance } from "./domains/Compliance.js";
|
|
127
|
+
import { Vetting } from "./domains/Vetting.js";
|
package/types/domains/Auth.d.ts
CHANGED
|
@@ -81,10 +81,11 @@ export class Auth {
|
|
|
81
81
|
* @param {string} [params.attribution.shLanding] - Marketing-site landing page passed on the register link (sh_landing)
|
|
82
82
|
* @param {string} [params.attribution.shCta] - Marketing-site CTA that sent the visitor (sh_cta)
|
|
83
83
|
* @param {string} [params.attribution.shGuide] - Marketing-site guide the CTA was on (sh_guide)
|
|
84
|
+
* @param {string} [params.captchaToken] - A Cloudflare Turnstile token from the Signal House sign-up page. Required for a password sign-up when the API has Turnstile turned on
|
|
84
85
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
85
86
|
* @returns {Promise<SdkResponse<any>>} The response from the server (contains the JWT token)
|
|
86
87
|
*/
|
|
87
|
-
register({ businessName, fullName, email, password, oauthTicket, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, options }: {
|
|
88
|
+
register({ businessName, fullName, email, password, oauthTicket, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, captchaToken, options }: {
|
|
88
89
|
businessName: string;
|
|
89
90
|
fullName: string;
|
|
90
91
|
email: string;
|
|
@@ -106,6 +107,7 @@ export class Auth {
|
|
|
106
107
|
shCta?: string;
|
|
107
108
|
shGuide?: string;
|
|
108
109
|
};
|
|
110
|
+
captchaToken?: string;
|
|
109
111
|
options?: RequestOptions;
|
|
110
112
|
}): Promise<SdkResponse<any>>;
|
|
111
113
|
/**
|
|
@@ -508,7 +508,7 @@ export class Brands {
|
|
|
508
508
|
* @param {File|Blob} params.file - The supporting document file
|
|
509
509
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
510
510
|
* @throws {Error} Throws an error if required parameters are missing
|
|
511
|
-
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
511
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server. When TCR refuses the appeal itself (a 4xx, e.g. code 592 for a brand older than 45 days), the error body is { error: "TCR refused the appeal: <reason>", details: { code, message } } with TCR's own code and message. Don't retry it unchanged; it will be refused again.
|
|
512
512
|
*/
|
|
513
513
|
submitAppeal({ brandId, appealCategories, explanation, file, options }: {
|
|
514
514
|
brandId: BrandLookupId;
|