@signalhouse-sms/sdk 1.15.0 → 1.17.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhouse-sms/sdk",
3
- "version": "1.15.0",
3
+ "version": "1.17.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -51,6 +51,7 @@ import { Audit } from "./domains/Audit.js";
51
51
  import { Contracts } from "./domains/Contracts.js";
52
52
  import { Verify } from "./domains/Verify.js";
53
53
  import { Compliance } from "./domains/Compliance.js";
54
+ import { Vetting } from "./domains/Vetting.js";
54
55
 
55
56
  export class SignalHouseSDK {
56
57
  /**
@@ -108,6 +109,8 @@ export class SignalHouseSDK {
108
109
  this.verify = new Verify(client, this.enableAdmin);
109
110
  // Compliance cases under /compliance; staff methods under compliance.admin.
110
111
  this.compliance = new Compliance(client, multipartClient, this.enableAdmin);
112
+ // Staff-only brand vetting for branded calling under /vetting; every method sits behind enableAdmin.
113
+ this.vetting = new Vetting(client, this.enableAdmin);
111
114
  }
112
115
 
113
116
  /**
@@ -88,13 +88,14 @@ export class Auth {
88
88
  * @param {string} [params.attribution.shLanding] - Marketing-site landing page passed on the register link (sh_landing)
89
89
  * @param {string} [params.attribution.shCta] - Marketing-site CTA that sent the visitor (sh_cta)
90
90
  * @param {string} [params.attribution.shGuide] - Marketing-site guide the CTA was on (sh_guide)
91
+ * @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
91
92
  * @param {RequestOptions} [params.options] - Additional options for the request
92
93
  * @returns {Promise<SdkResponse<any>>} The response from the server (contains the JWT token)
93
94
  */
94
- async register({ businessName, fullName, email, password, oauthTicket, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, options = {} }) {
95
+ async register({ businessName, fullName, email, password, oauthTicket, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, captchaToken, options = {} }) {
95
96
  return this.client(`/auth/register`, {
96
97
  method: "POST",
97
- body: { businessName, fullName, email, password, oauthTicket, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution },
98
+ body: { businessName, fullName, email, password, oauthTicket, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, captchaToken },
98
99
  ...options,
99
100
  });
100
101
  }
@@ -212,7 +212,7 @@ export class Brands {
212
212
  * @param {string} [params.status] - The status of the brand to filter by (PENDING_CREATION, PENDING_APPROVAL, UNVERIFIED, VERIFIED, VETTED_VERIFIED, PENDING_DELETE, DELETED)
213
213
  * @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC", "TOLL_FREE", or "SHORT_CODE")
214
214
  * @param {boolean} [params.currentTollFreeCarrier] - With subgroupId or groupId: when true, return only toll-free brands that a new toll-free campaign in that group can use (those on the group's current toll-free carrier)
215
- * @param {string} [params.search] - Staff-only (no id/subgroupId/groupId): case-insensitive substring over brandId, names, EIN, email, group, subgroup and reference ID
215
+ * @param {string|string[]} [params.search] - Search terms, each sent as its own `search` key; every term must match. With subgroupId or groupId, free text matches brandId, displayName and companyName; on the staff-only list (no id/subgroupId/groupId) it matches brandId, displayName, companyName, ein, email, groupId, subgroupId and referenceId. `field:term` searches one of those eight fields. Each term is 3 to 100 characters, at most 5 terms.
216
216
  * @param {string} [params.sortBy] - Staff-only: createdAt, brandId, displayName, groupId, subgroupId, status, entityType or country
217
217
  * @param {"asc"|"desc"} [params.sortOrder] - Staff-only: sort direction (default asc)
218
218
  * @param {string} [params.entityType] - Staff-only: exact entity type filter
@@ -336,7 +336,7 @@ export class Campaigns {
336
336
  * @param {number} [params.page] - The page number for pagination
337
337
  * @param {number} [params.limit] - The number of items per page
338
338
  * @param {string} [params.status] - The status of the campaign to filter by
339
- * @param {string} [params.search] - Search term to filter campaigns by campaignId or brandId
339
+ * @param {string|string[]} [params.search] - Search terms, each sent as its own `search` key; every term must match. With brandId, subgroupId or groupId, free text matches campaignId; on the staff-only list (no id/brandId/subgroupId/groupId) it matches campaignId and brandId. `field:term` searches campaignId or brandId. Each term is 3 to 100 characters, at most 5 terms.
340
340
  * @param {string} [params.sortBy] - Field to sort by (e.g. "createdAt", "campaignId", "brandId", "groupId", "subgroupId", "usecase", "status")
341
341
  * @param {string} [params.sortOrder] - Sort direction ("asc" or "desc")
342
342
  * @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC", "TOLL_FREE", or "SHORT_CODE")
@@ -55,19 +55,44 @@ export class Compliance {
55
55
  },
56
56
 
57
57
  /**
58
- * List alerts, with the inbox counts.
58
+ * List alerts, newest received first. Each row carries `case: { caseId, status, stage, assigneeUserId, suspended }`,
59
+ * or null with no case. `counts` follows every filter except open, inbox, assignee, suspended and severity.
59
60
  * @async
60
61
  * @roles signalhouse_admin, signalhouse_user
61
- * @param {Object} [params] - Filters: type, form, severity, channel, source, subjectKind, subjectId, number, groupId, subgroupId, campaignId, caseId, inbox, open, blocks, slackPending, from, to, page, limit
62
+ * @param {Object} [params] - Filters: q (an id, a number or part of the account name, up to 100 characters), type,
63
+ * form, severity (one value or a comma list), channel, source, subjectKind, subjectId, number, groupId,
64
+ * subgroupId, brandId, campaignId, caseId, assignee (a user id, or "none"), suspended, inbox, open, blocks,
65
+ * slackPending, from, to, liftedFrom (blocks lifted on or after this time), page, limit
62
66
  * @param {RequestOptions} [params.options] - Additional options for the request
63
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ data, total, page, limit, totalPages, counts: { inCase, inbox, noted } }`
67
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ data, total, page, limit, totalPages, counts: { all, open,
68
+ * mine, unowned, suspended, resolved, inbox, accounts, openBySeverity, unownedBySeverity } }`
64
69
  */
65
70
  getAlerts: async ({ options = {}, ...filters } = {}) => {
66
71
  return this.client(`/compliance/alerts${this.client._getQueryString(filters)}`, { method: "GET", ...options });
67
72
  },
68
73
 
69
74
  /**
70
- * Get one alert with its raw payload, escalation chain, case summary and timeline.
75
+ * List every active customer account, plus any group with open compliance work, with its risk, open alert counts,
76
+ * outbound message count over a window and Signal House's next step. Without groupId, channel keeps the accounts with
77
+ * an open alert on it; subgroupId, brandId, campaignId and number need a groupId and then narrow that account's
78
+ * counts. Risk always covers the whole account. `counts` holds each chip's total over the searched rows.
79
+ * @async
80
+ * @roles signalhouse_admin, signalhouse_user
81
+ * @param {Object} [params] - Filters: search (a string or an array of strings, every one must match; each is free text
82
+ * or `field:term` for groupId, groupName or groupCompanyName, 3 to 100 characters, at most 5), sort (next, account,
83
+ * risk, alerts, suspended, notices or messages), sortOrder (asc or desc), chips (a comma list of waiting, suspended, high, notices, review, inbox),
84
+ * days (7, 30 or 90), groupId, subgroupId, brandId, campaignId, number, channel, page, limit
85
+ * @param {RequestOptions} [params.options] - Additional options for the request
86
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ data, total, page, limit, totalPages, days, counts: { waiting,
87
+ * suspended, high, notices, review, inbox } }`; each row is `{ groupId, accountName, createdAt, risk, openAlerts, critical,
88
+ * suspended, notices, inbox, reviewDue, messages, nextStep }`
89
+ */
90
+ getAccounts: async ({ options = {}, ...filters } = {}) => {
91
+ return this.client(`/compliance/accounts${this.client._getQueryString(filters)}`, { method: "GET", ...options });
92
+ },
93
+
94
+ /**
95
+ * Get one alert with its escalation chain, case summary and timeline.
71
96
  * @async
72
97
  * @roles signalhouse_admin, signalhouse_user
73
98
  * @param {Object} params - The lookup
@@ -223,7 +248,9 @@ export class Compliance {
223
248
  }
224
249
 
225
250
  /**
226
- * List the compliance cases you can see, newest first. `counts.waitingOnYou` is the open cases with requirements still to answer
251
+ * List the compliance cases you can see, newest first. `counts.waitingOnYou` is the open cases with requirements still to answer.
252
+ * Staff get `counts: { open, unowned, byStage, overdue, oldestLiftRequestedAt }` instead, which follows every filter except
253
+ * status, stage and open
227
254
  * @async
228
255
  * @roles api, admin, developer, billing, user
229
256
  * @param {Object} [params] - Filters
@@ -234,16 +261,23 @@ export class Compliance {
234
261
  * @param {string} [params.objectId] - The object's id
235
262
  * @param {string} [params.subgroupId] - Only cases in this subgroup
236
263
  * @param {boolean} [params.suspended] - true for cases with an open suspension or hold, false for the rest
264
+ * @param {string} [params.q] - Staff only: a case, group, object, brand, campaign or subgroup id, or part of the account name, up to 100 characters. Ignored for other roles
265
+ * @param {string} [params.brandId] - Staff only: only cases on this brand. Ignored for other roles
266
+ * @param {string} [params.campaignId] - Staff only: only cases on this campaign. Ignored for other roles
267
+ * @param {string} [params.number] - Staff only: digits with the country code; the number's own case and the cases holding an alert on it. Ignored for other roles
268
+ * @param {boolean} [params.open] - Staff only: true for cases that are not closed, false for closed cases. Ignored for other roles
269
+ * @param {string} [params.assignee] - Staff only: the owner's user id, or "none" for unowned cases. Ignored for other roles
270
+ * @param {boolean} [params.reviewDue] - Staff only: true for cases flagged for account review, false for the rest. Ignored for other roles
237
271
  * @param {string} [params.from] - Opened on or after this ISO 8601 time
238
272
  * @param {string} [params.to] - Opened on or before this ISO 8601 time
239
273
  * @param {string} [params.sort] - createdAt (default), fixBy or severity
240
274
  * @param {number} [params.page] - Page number, from 1
241
275
  * @param {number} [params.limit] - Cases per page, 1-200
242
276
  * @param {RequestOptions} [params.options] - Additional options for the request
243
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ data, total, page, limit, totalPages, counts: { open, waitingOnYou } }`
277
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ data, total, page, limit, totalPages, counts }`
244
278
  */
245
- async getCases({ groupId, status, stage, objectType, objectId, subgroupId, suspended, from, to, sort, page, limit, options = {} } = {}) {
246
- const query = this.client._getQueryString({ groupId, status, stage, objectType, objectId, subgroupId, suspended, from, to, sort, page, limit });
279
+ async getCases({ groupId, status, stage, objectType, objectId, subgroupId, suspended, q, brandId, campaignId, number, open, assignee, reviewDue, from, to, sort, page, limit, options = {} } = {}) {
280
+ const query = this.client._getQueryString({ groupId, status, stage, objectType, objectId, subgroupId, suspended, q, brandId, campaignId, number, open, assignee, reviewDue, from, to, sort, page, limit });
247
281
  return this.client(`/compliance/cases${query}`, { method: "GET", ...options });
248
282
  }
249
283
 
@@ -30,17 +30,21 @@ export class Groups {
30
30
  },
31
31
 
32
32
  /**
33
- * Get a list of all groups with optional pagination parameters
33
+ * Get a list of all groups with optional pagination and search
34
34
  * @async
35
35
  * @roles signalhouse
36
36
  * @param {Object} params - The parameters for getting groups
37
37
  * @param {number} [params.page] - The page number for pagination
38
38
  * @param {number} [params.limit] - The number of items per page
39
+ * @param {string|string[]} [params.search] - One value or several, every one must match. Each is free text, found in
40
+ * the Group ID, group name or company name, or `field:term` to search groupId, groupName or groupCompanyName only.
41
+ * Each term is 3 to 100 characters, and at most 5 values
42
+ * @param {boolean} [params.includeTotal] - With page and limit, return `{ data, total, page, limit, totalPages }`
39
43
  * @param {RequestOptions} [params.options] - Additional options for the request
40
- * @returns {Promise<SdkResponse<any>>} - The list of groups returned from the server
44
+ * @returns {Promise<SdkResponse<any>>} - The list of groups returned from the server, or the envelope with includeTotal
41
45
  */
42
- getGroups: async ({ page, limit, options = {} }) => {
43
- const filters = { page, limit };
46
+ getGroups: async ({ page, limit, search, includeTotal, options = {} }) => {
47
+ const filters = { page, limit, search, includeTotal };
44
48
  const queryString = this.client._getQueryString(filters);
45
49
  return this.client(`/group${queryString}`, { method: "GET", ...options });
46
50
  },
@@ -235,6 +239,74 @@ export class Groups {
235
239
  return this.client(`/group/sso${queryString}`, { method: "DELETE", ...options });
236
240
  }
237
241
 
242
+ /**
243
+ * Read a group's Ontraport connection status: whether it's connected, and the webhook URL to paste
244
+ * into an Ontraport automation's "Send to a Webhook" step. Never includes the API Key or App ID.
245
+ * @async
246
+ * @roles admin, developer, signalhouse_admin
247
+ * @param {Object} params
248
+ * @param {string} params.groupId - The group
249
+ * @param {RequestOptions} [params.options] - Additional options for the request
250
+ * @returns {Promise<SdkResponse<any>>} - { connected, webhookUrl, enabled }
251
+ */
252
+ async getOntraportConnection({ groupId, options = {} }) {
253
+ this.client._require({ groupId });
254
+ const queryString = this.client._getQueryString({ groupId });
255
+ return this.client(`/group/ontraport${queryString}`, { method: "GET", ...options });
256
+ }
257
+
258
+ /**
259
+ * Connect (or reconnect) a group's Ontraport account. The API Key and App ID are verified with a
260
+ * read-only call to Ontraport before anything is stored; a bad pair throws rather than saving.
261
+ * Requires a Signal House Admin to have enabled featureFlags.ontraportIntegration for the group first
262
+ * (opt-in, off by default) - otherwise this throws a validation error.
263
+ * @async
264
+ * @roles admin, developer, signalhouse_admin
265
+ * @param {Object} params
266
+ * @param {string} params.groupId - The group
267
+ * @param {string} params.apiKey - The Ontraport API Key
268
+ * @param {string} params.appId - The Ontraport App ID
269
+ * @param {RequestOptions} [params.options] - Additional options for the request
270
+ * @returns {Promise<SdkResponse<any>>} - { connected, webhookUrl, enabled }
271
+ */
272
+ async connectOntraport({ groupId, apiKey, appId, options = {} }) {
273
+ this.client._require({ groupId, apiKey, appId });
274
+ return this.client(`/group/ontraport`, { method: "PUT", body: { groupId, apiKey, appId }, ...options });
275
+ }
276
+
277
+ /**
278
+ * Disconnect (disable) a group's Ontraport account. The webhook stops accepting deliveries
279
+ * immediately; stored credentials and contact links are kept, so reconnecting the same account
280
+ * resumes cleanly. The primary self-service way to kill a leaked webhook URL.
281
+ * @async
282
+ * @roles admin, developer, signalhouse_admin
283
+ * @param {Object} params
284
+ * @param {string} params.groupId - The group
285
+ * @param {RequestOptions} [params.options] - Additional options for the request
286
+ * @returns {Promise<SdkResponse<any>>} - { connected, webhookUrl, enabled }
287
+ */
288
+ async disconnectOntraport({ groupId, options = {} }) {
289
+ this.client._require({ groupId });
290
+ const queryString = this.client._getQueryString({ groupId });
291
+ return this.client(`/group/ontraport${queryString}`, { method: "DELETE", ...options });
292
+ }
293
+
294
+ /**
295
+ * Mint a fresh webhook token for an existing Ontraport connection, immediately invalidating the old
296
+ * URL. A second self-service way to kill a leaked webhook URL, for when the customer wants to keep
297
+ * sending (unlike disconnectOntraport) but needs a new URL to paste into a rebuilt automation.
298
+ * @async
299
+ * @roles admin, developer, signalhouse_admin
300
+ * @param {Object} params
301
+ * @param {string} params.groupId - The group
302
+ * @param {RequestOptions} [params.options] - Additional options for the request
303
+ * @returns {Promise<SdkResponse<any>>} - { connected, webhookUrl, enabled }
304
+ */
305
+ async regenerateOntraportWebhookToken({ groupId, options = {} }) {
306
+ this.client._require({ groupId });
307
+ return this.client(`/group/ontraport/regenerate-token`, { method: "PUT", body: { groupId }, ...options });
308
+ }
309
+
238
310
  /**
239
311
  * Claim an email domain for a group's SSO; the response includes the DNS TXT record that verifies it
240
312
  * @async
@@ -92,6 +92,8 @@ export class Messages {
92
92
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages. Inbound messages also carry
93
93
  * sentimentScore (-100..100, null when unscored), sentimentLabel ("positive"|"neutral"|"negative", null when
94
94
  * sentimentScore is null) and sentimentScoredAt. Outbound messages are never scored.
95
+ * Inbound messages also carry inReplyToMessageId: the message the reply answers, absent when there is none. If that
96
+ * message has a parentMessageId, it was an RCS fallback, and the parent is the RCS message you sent.
95
97
  */
96
98
  async getMessages({
97
99
  id,
@@ -142,7 +144,7 @@ export class Messages {
142
144
  * @param {string} params.id - The message ID
143
145
  * @param {RequestOptions} [params.options] - Additional options for the request
144
146
  * @throws {Error} Throws an error if the id parameter is missing
145
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404. An RCS message and its fallback leg also carry `costBreakdown`: `{ legs: [{ messageId, channel, billed, billingClass, segments, baseMicros, carrierMicros, rated }] }`, null when it cannot be computed. A settled RCS message also carries `carrierFeeMicros`: the carrier pass-through and media surcharge it was charged
147
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404. An RCS message and its fallback leg also carry `costBreakdown`: `{ legs: [{ messageId, channel, billed, billingClass, segments, baseMicros, carrierMicros, rated }] }`, null when it cannot be computed. A settled RCS message also carries `carrierFeeMicros`: the carrier pass-through and media surcharge it was charged. Inbound messages also carry `inReplyToMessageId`: the message the reply answers, absent when there is none. If that message has a `parentMessageId`, it was an RCS fallback, and the parent is the RCS message you sent
146
148
  */
147
149
  async getMessage({ id, options = {} }) {
148
150
  this.client._require({ id });
@@ -499,6 +501,7 @@ export class Messages {
499
501
  * true server-side (the SignalHouse shortlink system, which mints unique per-recipient links).
500
502
  * @param {RequestOptions} [params.options] - Additional options for the request
501
503
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the response data from the server
504
+ * @deprecated P2P messaging is retired and the API answers 410. This method will be removed in a future major release.
502
505
  */
503
506
  async sendP2P({ recipientPhoneNumbers, messageBody, statusCallbackUrl, groupId, subgroupId, useSignalHouseShortlinks, options = {} }) {
504
507
  this.client._require({ recipientPhoneNumbers, messageBody });
@@ -523,6 +526,7 @@ export class Messages {
523
526
  * @param {RequestOptions} [params.options] - Additional options for the request
524
527
  * @throws {Error} Throws an error if the batchId parameter is missing
525
528
  * @returns {Promise<SdkResponse<any>>} - The P2P batch object returned from the server
529
+ * @deprecated P2P messaging is retired and the API answers 410. This method will be removed in a future major release.
526
530
  */
527
531
  async getP2PBatch({ batchId, options = {} }) {
528
532
  this.client._require({ batchId });
@@ -669,7 +673,7 @@ export class Messages {
669
673
  }
670
674
 
671
675
  /**
672
- * Look up the carrier for a phone number. Always performs a fresh lookup (not cached). Billed per request.
676
+ * Look up the carrier for a phone number. Always performs a fresh lookup (not cached). Billed per request. An Australian number on ACMA's list of numbers reserved for TV, film and creative works is refused with a 400 as an invalid number, without a lookup or a charge.
673
677
  * @async
674
678
  * @roles api, admin, developer, billing, user
675
679
  * @param {Object} params - The parameters for looking up a carrier
@@ -88,6 +88,7 @@ export class Numbers {
88
88
  * @param {string} [params.groupId] - Filter by group ID
89
89
  * @param {boolean} [params.currentTollFreeCarrier] - With subgroupId or groupId: when true, return only toll-free numbers that a new toll-free campaign in that group can use (those on the group's current toll-free carrier)
90
90
  * @param {boolean} [params.released] - With subgroupId or groupId: when true, return only its released numbers (status RELEASED) instead of its active ones
91
+ * @param {string|string[]} [params.search] - Search terms, each sent as its own `search` key; every term must match. Free text matches phoneNumber and friendlyName; `field:term` searches one of those fields. A term that reads as a phone number (digits, spaces, + ( ) . -) matches the number's digits, so "(512) 555" finds 15125550100. Each term is 3 to 100 characters, at most 5 terms.
91
92
  * @param {number} [params.page] - The page number for pagination (default: 1)
92
93
  * @param {number} [params.limit] - The number of items per page for pagination (default: 20)
93
94
  * @param {RequestOptions} [params.options] - Additional options for the request
@@ -110,8 +111,8 @@ export class Numbers {
110
111
  * or GET /campaign/health.
111
112
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of phone numbers
112
113
  */
113
- async getPhoneNumbers({ phoneNumber, campaignId, registrationId, brandId, subgroupId, groupId, currentTollFreeCarrier, released, page, limit, options = {} }) {
114
- const filters = { phoneNumber, campaignId, registrationId, brandId, subgroupId, groupId, currentTollFreeCarrier, released, page, limit };
114
+ async getPhoneNumbers({ phoneNumber, campaignId, registrationId, brandId, subgroupId, groupId, currentTollFreeCarrier, released, search, page, limit, options = {} }) {
115
+ const filters = { phoneNumber, campaignId, registrationId, brandId, subgroupId, groupId, currentTollFreeCarrier, released, search, page, limit };
115
116
  const queryString = this.client._getQueryString(filters);
116
117
  return this.client(`/number${queryString}`, { method: 'GET', ...options });
117
118
  }
@@ -552,7 +552,7 @@ export class RcsMessages {
552
552
  * @param {Object} params - The lookup
553
553
  * @param {string} params.messageId - The message ID
554
554
  * @param {RequestOptions} [params.options] - Additional options for the request
555
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the message; an unknown ID is a 404. A settled RCS message carries carrierFeeMicros, the carrier pass-through and media surcharge it was charged
555
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the message; an unknown ID is a 404. A settled RCS message carries carrierFeeMicros, the carrier pass-through and media surcharge it was charged. An inbound RCS message also carries inReplyToMessageId: the message it answers, absent when there is none
556
556
  */
557
557
  async get({ messageId, options = {} }) {
558
558
  this.client._require({ messageId });
@@ -19,8 +19,8 @@
19
19
  * @property {string} [country] - The country for the subgroup's address
20
20
  * @property {string} [postalCode] - The postal code for the subgroup's address
21
21
  * @property {string} [phone] - The phone number for the subgroup
22
- * @property {string} [carrierIdFamily] - Optional agency-managed carrier ID selection ("Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop"). Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
23
- * @property {string|null} [carrierIdRegion] - Optional ClearSky region ("PRClaro", "GuamDocomo", "GuamGTA", "GuamITE") or null; only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
22
+ * @property {string} [carrierIdFamily] - Deprecated: accepted and stored, with no effect on billing. One of "Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
23
+ * @property {string|null} [carrierIdRegion] - Deprecated: accepted and stored, with no effect on billing. ClearSky region ("PRClaro", "GuamDocomo", "GuamGTA", "GuamITE") or null; only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
24
24
  */
25
25
 
26
26
  /**
@@ -38,8 +38,8 @@
38
38
  * @property {string} [postalCode] - The postal code for the subgroup's address
39
39
  * @property {string} [phone] - The phone number for the subgroup
40
40
  * @property {string} [status] - The status of the subgroup (e.g., "active", "inactive")
41
- * @property {string} [carrierIdFamily] - Optional agency-managed carrier ID selection ("Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop"). Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
42
- * @property {string|null} [carrierIdRegion] - Optional ClearSky region ("PRClaro", "GuamDocomo", "GuamGTA", "GuamITE") or null; only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
41
+ * @property {string} [carrierIdFamily] - Deprecated: accepted and stored, with no effect on billing. One of "Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
42
+ * @property {string|null} [carrierIdRegion] - Deprecated: accepted and stored, with no effect on billing. ClearSky region ("PRClaro", "GuamDocomo", "GuamGTA", "GuamITE") or null; only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
43
43
  * @property {boolean} [cnamAutoApply] - Turn caller name (CNAM) auto-apply on or off: eligible numbers get their brand's registered name as the name shown on outbound calls. Requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin or developer role.
44
44
  * @property {string|null} [cnamBrandId] - Default caller-ID brand for numbers with no campaign (e.g. voice-only). Must be a verified brand in this subgroup; required when turning auto-apply on in a subgroup with more than one verified brand.
45
45
  */
@@ -88,13 +88,14 @@ export class Subgroups {
88
88
  * @param {Object} params - The parameters for getting subgroups
89
89
  * @param {string} [params.id] - Filter by subgroup ID
90
90
  * @param {string} [params.groupId] - Filter by parent group ID
91
+ * @param {string|string[]} [params.search] - Search terms, each sent as its own `search` key; every term must match. Free text matches subgroupId, subgroupName and subgroupCompanyName; `field:term` searches one of those fields. Each term is 3 to 100 characters, at most 5 terms.
91
92
  * @param {number} [params.page] - The page number for pagination
92
93
  * @param {number} [params.limit] - The number of items per page for pagination
93
94
  * @param {RequestOptions} [params.options] - Additional options for the request
94
95
  * @returns {Promise<SdkResponse<any>>} - The list of subgroups returned from the server
95
96
  */
96
- async getSubgroups({ id, groupId, page, limit, options = {} }) {
97
- const filters = { id, groupId, page, limit };
97
+ async getSubgroups({ id, groupId, search, page, limit, options = {} }) {
98
+ const filters = { id, groupId, search, page, limit };
98
99
  const queryString = this.client._getQueryString(filters);
99
100
  return this.client(`/subgroup${queryString}`, { method: "GET", ...options });
100
101
  }
@@ -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
+ }
@@ -9,6 +9,8 @@ import { Tokens } from "./voice/Tokens.js";
9
9
  import { Analytics } from "./voice/Analytics.js";
10
10
  import { OutboundVoice } from "./voice/OutboundVoice.js";
11
11
  import { CallFlows } from "./voice/CallFlows.js";
12
+ import { PushCredentials } from "./voice/PushCredentials.js";
13
+ import { PushDevices } from "./voice/PushDevices.js";
12
14
 
13
15
  /**
14
16
  * Voice domain — wraps the Voice service (mounted under /voice on the
@@ -25,6 +27,8 @@ import { CallFlows } from "./voice/CallFlows.js";
25
27
  * - `sdk.voice.callLogs` — Account-scoped call history: list/get + presigned recording.
26
28
  * - `sdk.voice.globalVoiceSettings` — Account-wide voice defaults (accepted regions, max spend, E911).
27
29
  * - `sdk.voice.tokens` — Mint ephemeral SIP credentials for the browser voice SDK.
30
+ * - `sdk.voice.pushCredentials` — Mobile push: the Apple/Firebase credentials that wake your app for calls.
31
+ * - `sdk.voice.pushDevices` — Mobile push: register a device (called by the app with its voice token).
28
32
  * - `sdk.voice.analytics` — Aggregated call analytics (summary tiles + byDate/byNumber/byCarrier breakdowns).
29
33
  */
30
34
  export class Voice {
@@ -42,5 +46,7 @@ export class Voice {
42
46
  this.analytics = new Analytics(client, enableAdmin);
43
47
  this.outboundVoice = new OutboundVoice(client, enableAdmin);
44
48
  this.callFlows = new CallFlows(client, enableAdmin);
49
+ this.pushCredentials = new PushCredentials(client, enableAdmin);
50
+ this.pushDevices = new PushDevices(client, enableAdmin);
45
51
  }
46
52
  }
@@ -30,7 +30,7 @@
30
30
  /**
31
31
  * @typedef {Object} CallFlowStep
32
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.
33
+ * @property {"inbound"|"answer"|"play"|"sms"|"ivr"|"ai_agent"|"ai_sms"|"webhook"|"fwd_phone"|"fwd_sip"|"voicemail"|"hangup"} type - The step kind. `catalog()` lists the kinds this service can run.
34
34
  * @property {string} name - Display name.
35
35
  * @property {Object} [config] - The step's settings, which depend on its type.
36
36
  * @property {number} [positionX] - Canvas x position, for a visual builder.