@signalhouse-sms/sdk 1.14.0 → 1.15.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 +3 -0
- package/src/domains/Brands.js +1 -1
- package/src/domains/Compliance.js +324 -0
- package/src/domains/Subgroups.js +51 -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 +2 -0
- package/types/domains/Brands.d.ts +1 -1
- package/types/domains/Compliance.d.ts +325 -0
- package/types/domains/Subgroups.d.ts +51 -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,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"|"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,7 @@ export class SignalHouseSDK {
|
|
|
33
33
|
audit: Audit;
|
|
34
34
|
contracts: Contracts;
|
|
35
35
|
verify: Verify;
|
|
36
|
+
compliance: Compliance;
|
|
36
37
|
/**
|
|
37
38
|
* Client for API requests
|
|
38
39
|
* @private
|
|
@@ -121,3 +122,4 @@ import { Agents } from "./domains/Agents.js";
|
|
|
121
122
|
import { Audit } from "./domains/Audit.js";
|
|
122
123
|
import { Contracts } from "./domains/Contracts.js";
|
|
123
124
|
import { Verify } from "./domains/Verify.js";
|
|
125
|
+
import { Compliance } from "./domains/Compliance.js";
|
|
@@ -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;
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Compliance cases under /compliance. Signal House opens a case when a carrier suspends one of your objects, a carrier
|
|
8
|
+
* escalates a message, or Signal House needs something from you. You read your cases, answer their requirements and
|
|
9
|
+
* upload files; only Signal House opens, works and closes them. Staff methods are under `admin` (enableAdmin).
|
|
10
|
+
*/
|
|
11
|
+
export class Compliance {
|
|
12
|
+
/**
|
|
13
|
+
* Keep the JSON and multipart clients every compliance request goes through.
|
|
14
|
+
* @param {any} client - The JSON request client
|
|
15
|
+
* @param {any} multipartClient - The multipart request client, for file uploads
|
|
16
|
+
* @param {boolean} [enableAdmin] - Whether the staff methods under `admin` are available
|
|
17
|
+
*/
|
|
18
|
+
constructor(client: any, multipartClient: any, enableAdmin?: boolean);
|
|
19
|
+
client: any;
|
|
20
|
+
multipartClient: any;
|
|
21
|
+
enableAdmin: boolean;
|
|
22
|
+
admin: {
|
|
23
|
+
/**
|
|
24
|
+
* Log an alert by hand: a reading, a notice or a block. Blocks (and a Sev-0 carrier ticket) need signalhouse_admin.
|
|
25
|
+
* @async
|
|
26
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
27
|
+
* @param {Object} params - The alert
|
|
28
|
+
* @param {Object} params.data - `{ form, type, subject: { kind, id }, ... }`: the intake input without a raw payload
|
|
29
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
30
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ logged, recovered, updated, unmatched, duplicate }`
|
|
31
|
+
*/
|
|
32
|
+
logAlert: ({ data, options }: {
|
|
33
|
+
data: any;
|
|
34
|
+
options?: RequestOptions;
|
|
35
|
+
}) => Promise<SdkResponse<any>>;
|
|
36
|
+
/**
|
|
37
|
+
* Lift a block by hand. signalhouse_admin only.
|
|
38
|
+
* @async
|
|
39
|
+
* @roles signalhouse_admin
|
|
40
|
+
* @param {Object} params - The lift
|
|
41
|
+
* @param {string} params.alertId - The block alert (ALR-…)
|
|
42
|
+
* @param {string} [params.note] - Why it lifted
|
|
43
|
+
* @param {string} [params.occurredAt] - When the source says it lifted (ISO 8601)
|
|
44
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
45
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ alertId, recoveredAt, caseId, caseClosed, closeReason }`
|
|
46
|
+
*/
|
|
47
|
+
liftBlock: ({ alertId, note, occurredAt, options }: {
|
|
48
|
+
alertId: string;
|
|
49
|
+
note?: string;
|
|
50
|
+
occurredAt?: string;
|
|
51
|
+
options?: RequestOptions;
|
|
52
|
+
}) => Promise<SdkResponse<any>>;
|
|
53
|
+
/**
|
|
54
|
+
* List alerts, with the inbox counts.
|
|
55
|
+
* @async
|
|
56
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
57
|
+
* @param {Object} [params] - Filters: type, form, severity, channel, source, subjectKind, subjectId, number, groupId, subgroupId, campaignId, caseId, inbox, open, blocks, slackPending, from, to, page, limit
|
|
58
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
59
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ data, total, page, limit, totalPages, counts: { inCase, inbox, noted } }`
|
|
60
|
+
*/
|
|
61
|
+
getAlerts: ({ options, ...filters }?: {
|
|
62
|
+
options?: RequestOptions;
|
|
63
|
+
}) => Promise<SdkResponse<any>>;
|
|
64
|
+
/**
|
|
65
|
+
* Get one alert with its raw payload, escalation chain, case summary and timeline.
|
|
66
|
+
* @async
|
|
67
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
68
|
+
* @param {Object} params - The lookup
|
|
69
|
+
* @param {string} params.alertId - The alert (ALR-…)
|
|
70
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
71
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the alert with `chain`, `case` and `timeline`
|
|
72
|
+
*/
|
|
73
|
+
getAlert: ({ alertId, options }: {
|
|
74
|
+
alertId: string;
|
|
75
|
+
options?: RequestOptions;
|
|
76
|
+
}) => Promise<SdkResponse<any>>;
|
|
77
|
+
/**
|
|
78
|
+
* Work an inbox alert: `{ action: "assign", caseId }`, `{ action: "assign", object: { objectType, objectId } }` or `{ action: "note", note }`.
|
|
79
|
+
* @async
|
|
80
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
81
|
+
* @param {Object} params - The action
|
|
82
|
+
* @param {string} params.alertId - The inbox alert (ALR-…)
|
|
83
|
+
* @param {Object} params.data - The action body
|
|
84
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
85
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the alert after the action
|
|
86
|
+
*/
|
|
87
|
+
triageAlert: ({ alertId, data, options }: {
|
|
88
|
+
alertId: string;
|
|
89
|
+
data: any;
|
|
90
|
+
options?: RequestOptions;
|
|
91
|
+
}) => Promise<SdkResponse<any>>;
|
|
92
|
+
/**
|
|
93
|
+
* Open a case by hand to send the customer a notice; its requirements go out at once. 409 when the object already has an open case.
|
|
94
|
+
* @async
|
|
95
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
96
|
+
* @param {Object} params - The case
|
|
97
|
+
* @param {Object} params.data - `{ objectType, objectId, reasonTemplate, reason?, customerNote?, requirements: [{ kind, text }], fixByDays? }`
|
|
98
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
99
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the staff view of the case
|
|
100
|
+
*/
|
|
101
|
+
openCase: ({ data, options }: {
|
|
102
|
+
data: any;
|
|
103
|
+
options?: RequestOptions;
|
|
104
|
+
}) => Promise<SdkResponse<any>>;
|
|
105
|
+
/**
|
|
106
|
+
* Take, give or release ownership (assigneeUserId, null to release), and edit reasonTemplate, reason and customerNote.
|
|
107
|
+
* @async
|
|
108
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
109
|
+
* @param {Object} params - The change
|
|
110
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
111
|
+
* @param {Object} params.data - `{ assigneeUserId?, reasonTemplate?, reason?, customerNote? }`
|
|
112
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
113
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the staff view of the case
|
|
114
|
+
*/
|
|
115
|
+
updateCase: ({ caseId, data, options }: {
|
|
116
|
+
caseId: string;
|
|
117
|
+
data: any;
|
|
118
|
+
options?: RequestOptions;
|
|
119
|
+
}) => Promise<SdkResponse<any>>;
|
|
120
|
+
/**
|
|
121
|
+
* Send requirements the first time, or add more; either hands the case to the customer.
|
|
122
|
+
* @async
|
|
123
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
124
|
+
* @param {Object} params - The requirements
|
|
125
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
126
|
+
* @param {Array<{kind: string, text: string}>} params.requirements - RECORDS, CAMPAIGN_EDIT, NUMBER_ACTION or CONFIRM, with the text
|
|
127
|
+
* @param {number} [params.fixByDays] - Days until they are due, 1-14 (default 5)
|
|
128
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
129
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the staff view of the case
|
|
130
|
+
*/
|
|
131
|
+
sendRequirements: ({ caseId, requirements, fixByDays, options }: {
|
|
132
|
+
caseId: string;
|
|
133
|
+
requirements: Array<{
|
|
134
|
+
kind: string;
|
|
135
|
+
text: string;
|
|
136
|
+
}>;
|
|
137
|
+
fixByDays?: number;
|
|
138
|
+
options?: RequestOptions;
|
|
139
|
+
}) => Promise<SdkResponse<any>>;
|
|
140
|
+
/**
|
|
141
|
+
* Record that the lift request went upstream. The case must hold an open carrier suspension or provider pause.
|
|
142
|
+
* @async
|
|
143
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
144
|
+
* @param {Object} params - The request
|
|
145
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
146
|
+
* @param {string} [params.note] - What was sent
|
|
147
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
148
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the staff view of the case
|
|
149
|
+
*/
|
|
150
|
+
requestLift: ({ caseId, note, options }: {
|
|
151
|
+
caseId: string;
|
|
152
|
+
note?: string;
|
|
153
|
+
options?: RequestOptions;
|
|
154
|
+
}) => Promise<SdkResponse<any>>;
|
|
155
|
+
/**
|
|
156
|
+
* Close a case. Lift its open blocks first.
|
|
157
|
+
* @async
|
|
158
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
159
|
+
* @param {Object} params - The close
|
|
160
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
161
|
+
* @param {string} params.closeReason - CUSTOMER_REMEDIATED, SUSPENDED_BY_CARRIER, LIFTED, LABEL_REMOVED, TRACEBACK_ANSWERED, FALSE_POSITIVE or CLEARED
|
|
162
|
+
* @param {string} [params.closeNote] - Why
|
|
163
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
164
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the staff view of the closed case
|
|
165
|
+
*/
|
|
166
|
+
closeCase: ({ caseId, closeReason, closeNote, options }: {
|
|
167
|
+
caseId: string;
|
|
168
|
+
closeReason: string;
|
|
169
|
+
closeNote?: string;
|
|
170
|
+
options?: RequestOptions;
|
|
171
|
+
}) => Promise<SdkResponse<any>>;
|
|
172
|
+
/**
|
|
173
|
+
* Email the customer a reminder of the requirements still open.
|
|
174
|
+
* @async
|
|
175
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
176
|
+
* @param {Object} params - The reminder
|
|
177
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
178
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
179
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the staff view of the case
|
|
180
|
+
*/
|
|
181
|
+
remindCase: ({ caseId, options }: {
|
|
182
|
+
caseId: string;
|
|
183
|
+
options?: RequestOptions;
|
|
184
|
+
}) => Promise<SdkResponse<any>>;
|
|
185
|
+
/**
|
|
186
|
+
* Add a staff note, or an email to or from the upstream, to a case's history.
|
|
187
|
+
* @async
|
|
188
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
189
|
+
* @param {Object} params - The note
|
|
190
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
191
|
+
* @param {string} params.kind - STAFF, EMAIL_IN or EMAIL_OUT
|
|
192
|
+
* @param {string} params.text - The note
|
|
193
|
+
* @param {{from?: string, to?: string, subject?: string, body?: string}} [params.email] - The email, on EMAIL_IN and EMAIL_OUT
|
|
194
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
195
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the staff view of the case
|
|
196
|
+
*/
|
|
197
|
+
addCaseNote: ({ caseId, kind, text, email, options }: {
|
|
198
|
+
caseId: string;
|
|
199
|
+
kind: string;
|
|
200
|
+
text: string;
|
|
201
|
+
email?: {
|
|
202
|
+
from?: string;
|
|
203
|
+
to?: string;
|
|
204
|
+
subject?: string;
|
|
205
|
+
body?: string;
|
|
206
|
+
};
|
|
207
|
+
options?: RequestOptions;
|
|
208
|
+
}) => Promise<SdkResponse<any>>;
|
|
209
|
+
/**
|
|
210
|
+
* Get a group's strikes in the last 90 days, the block periods behind them, and whether an open case carries the review flag.
|
|
211
|
+
* @async
|
|
212
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
213
|
+
* @param {Object} params - The lookup
|
|
214
|
+
* @param {string} params.groupId - The group
|
|
215
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
216
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ groupId, windowDays, strikes, reviewDue, periods }`
|
|
217
|
+
*/
|
|
218
|
+
getStrikes: ({ groupId, options }: {
|
|
219
|
+
groupId: string;
|
|
220
|
+
options?: RequestOptions;
|
|
221
|
+
}) => Promise<SdkResponse<any>>;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* List the compliance cases you can see, newest first. `counts.waitingOnYou` is the open cases with requirements still to answer
|
|
225
|
+
* @async
|
|
226
|
+
* @roles api, admin, developer, billing, user
|
|
227
|
+
* @param {Object} [params] - Filters
|
|
228
|
+
* @param {string} [params.groupId] - A group you can view; defaults to your active group
|
|
229
|
+
* @param {string} [params.status] - OPEN, LIFT_REQUESTED or CLOSED
|
|
230
|
+
* @param {string} [params.stage] - new, customer, ready, lift_requested or closed
|
|
231
|
+
* @param {string} [params.objectType] - CAMPAIGN, BRAND, NUMBER, RCS_AGENT or SUBGROUP
|
|
232
|
+
* @param {string} [params.objectId] - The object's id
|
|
233
|
+
* @param {string} [params.subgroupId] - Only cases in this subgroup
|
|
234
|
+
* @param {boolean} [params.suspended] - true for cases with an open suspension or hold, false for the rest
|
|
235
|
+
* @param {string} [params.from] - Opened on or after this ISO 8601 time
|
|
236
|
+
* @param {string} [params.to] - Opened on or before this ISO 8601 time
|
|
237
|
+
* @param {string} [params.sort] - createdAt (default), fixBy or severity
|
|
238
|
+
* @param {number} [params.page] - Page number, from 1
|
|
239
|
+
* @param {number} [params.limit] - Cases per page, 1-200
|
|
240
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
241
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ data, total, page, limit, totalPages, counts: { open, waitingOnYou } }`
|
|
242
|
+
*/
|
|
243
|
+
getCases({ groupId, status, stage, objectType, objectId, subgroupId, suspended, from, to, sort, page, limit, options }?: {
|
|
244
|
+
groupId?: string;
|
|
245
|
+
status?: string;
|
|
246
|
+
stage?: string;
|
|
247
|
+
objectType?: string;
|
|
248
|
+
objectId?: string;
|
|
249
|
+
subgroupId?: string;
|
|
250
|
+
suspended?: boolean;
|
|
251
|
+
from?: string;
|
|
252
|
+
to?: string;
|
|
253
|
+
sort?: string;
|
|
254
|
+
page?: number;
|
|
255
|
+
limit?: number;
|
|
256
|
+
options?: RequestOptions;
|
|
257
|
+
}): Promise<SdkResponse<any>>;
|
|
258
|
+
/**
|
|
259
|
+
* Get one compliance case: its stage, suspensions, tickets and requirements
|
|
260
|
+
* @async
|
|
261
|
+
* @roles api, admin, developer, billing, user
|
|
262
|
+
* @param {Object} params - The lookup
|
|
263
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
264
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
265
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the case
|
|
266
|
+
*/
|
|
267
|
+
getCase({ caseId, options }: {
|
|
268
|
+
caseId: string;
|
|
269
|
+
options?: RequestOptions;
|
|
270
|
+
}): Promise<SdkResponse<any>>;
|
|
271
|
+
/**
|
|
272
|
+
* Answer one requirement with a note, files, or both. A RECORDS requirement needs a file or a note
|
|
273
|
+
* @async
|
|
274
|
+
* @roles api, admin, developer, user
|
|
275
|
+
* @param {Object} params - The answer
|
|
276
|
+
* @param {string} params.caseId - The case (CASE-…)
|
|
277
|
+
* @param {string} params.requirementId - The requirement (CASE-…-n)
|
|
278
|
+
* @param {string} [params.answer] - What you did, up to 2,000 characters
|
|
279
|
+
* @param {string[]} [params.fileIds] - Up to 10 fileIds from uploadFile, on this case
|
|
280
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
281
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the case
|
|
282
|
+
*/
|
|
283
|
+
answerRequirement({ caseId, requirementId, answer, fileIds, options }: {
|
|
284
|
+
caseId: string;
|
|
285
|
+
requirementId: string;
|
|
286
|
+
answer?: string;
|
|
287
|
+
fileIds?: string[];
|
|
288
|
+
options?: RequestOptions;
|
|
289
|
+
}): Promise<SdkResponse<any>>;
|
|
290
|
+
/**
|
|
291
|
+
* Upload a file to a compliance case (CSV, XLSX, PDF, PNG, JPG or TXT, up to 10 MB). Pass the returned fileId in
|
|
292
|
+
* fileIds when you answer the requirement
|
|
293
|
+
* @async
|
|
294
|
+
* @roles api, admin, developer, user
|
|
295
|
+
* @param {Object} params - The upload
|
|
296
|
+
* @param {string} params.caseId - The case the file answers
|
|
297
|
+
* @param {string} [params.requirementId] - The requirement the file answers
|
|
298
|
+
* @param {Blob|File} params.file - The file, as a Blob/File
|
|
299
|
+
* @param {string} [params.fileName] - Multipart filename; required for a CSV/TXT Blob without a name
|
|
300
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
301
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ fileId, fileName, mimeType, size }`
|
|
302
|
+
*/
|
|
303
|
+
uploadFile({ caseId, requirementId, file, fileName, options }: {
|
|
304
|
+
caseId: string;
|
|
305
|
+
requirementId?: string;
|
|
306
|
+
file: Blob | File;
|
|
307
|
+
fileName?: string;
|
|
308
|
+
options?: RequestOptions;
|
|
309
|
+
}): Promise<SdkResponse<any>>;
|
|
310
|
+
/**
|
|
311
|
+
* Download a compliance file
|
|
312
|
+
* @async
|
|
313
|
+
* @roles api, admin, developer, billing, user
|
|
314
|
+
* @param {Object} params - The lookup
|
|
315
|
+
* @param {string} params.fileId - The fileId uploadFile returned
|
|
316
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
317
|
+
* @returns {Promise<SdkResponse<ArrayBuffer>>} A promise that resolves to the file bytes as an ArrayBuffer
|
|
318
|
+
*/
|
|
319
|
+
getFile({ fileId, options }: {
|
|
320
|
+
fileId: string;
|
|
321
|
+
options?: RequestOptions;
|
|
322
|
+
}): Promise<SdkResponse<ArrayBuffer>>;
|
|
323
|
+
}
|
|
324
|
+
export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
|
|
325
|
+
export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|