@signalhouse-sms/sdk 1.17.1 → 1.19.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/README.md CHANGED
@@ -45,13 +45,16 @@ const token = await sdk.auth.login({
45
45
  console.log(token);
46
46
  ```
47
47
 
48
+ Error handling
49
+ API errors are returned, not thrown: `{ success: false, error, status }`. Non-2xx responses carry `details` when the API returns one. Connector tokens get 429 `CONNECTOR_CAP_EXCEEDED` (`details.code`, with `cap`, `limit` and `retryAfterSeconds`) or 503 `CONNECTOR_CAP_UNAVAILABLE` (with `retryAfterSeconds`). Wait `details.retryAfterSeconds` before retrying.
50
+
48
51
  Features
49
52
  Full support for Signal House API v2
50
53
  Integrated Axios with standardized returns
51
54
  Lightweight and tree-shakeable
52
55
 
53
56
  Documentation
54
- For full API reference and advanced usage, visit https://app2.signalhouse.io/docs
57
+ For full API reference and advanced usage, visit https://docs.signalhouse.io
55
58
 
56
59
  License
57
60
  ISC © Signal House
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhouse-sms/sdk",
3
- "version": "1.17.1",
3
+ "version": "1.19.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "source": "agent-skills",
3
- "ref": "v0.3.0",
3
+ "ref": "v0.4.0",
4
4
  "skills": [
5
5
  "signalhouse-10dlc",
6
6
  "signalhouse-advisor",
@@ -17,6 +17,6 @@
17
17
  "signalhouse-numbers/SKILL.md": "f996be53809ea2f90e49b32452f162eeff5369056e1f63e422b8fdb46d2896ff",
18
18
  "signalhouse-setup/SKILL.md": "ca87a6d71f3f82614b83ad283971385fc55c13c097b76595b1b85def235373ec",
19
19
  "signalhouse-sms/SKILL.md": "ec7ed8985ad590b0ab5d40c9ddb003eb8cbc566a1309ac5e330f570e0404ec42",
20
- "signalhouse-webhooks/SKILL.md": "d16062e9e0a7cdda3c02aee485bd5114659405d00b1d635da1280db0179490a7"
20
+ "signalhouse-webhooks/SKILL.md": "4806f0cff0c05dee490103e1ba42de784bc270b3111da4d285784ea1ecbbed94"
21
21
  }
22
22
  }
@@ -20,10 +20,31 @@ const REQUEST_TIMEOUT_MS = 30000;
20
20
 
21
21
  /**
22
22
  * The envelope every domain method resolves to. Non-2xx responses never reject; check `success` first.
23
+ * An error envelope carries `details` when the API error body has one, for example `details.code` and
24
+ * `details.retryAfterSeconds` on a connector cap response.
23
25
  * @template T
24
- * @typedef {{ success: true, data: T, status: number } | { success: false, error: string|Object, status: number|null }} SdkResponse
26
+ * @typedef {{ success: true, data: T, status: number } | { success: false, error: string|Object, status: number|null, details?: Object|Array }} SdkResponse
25
27
  */
26
28
 
29
+ /**
30
+ * Decodes a binary error body (ArrayBuffer, Buffer/typed array or Blob from a binary responseType request) as JSON so
31
+ * its `details` can be read. Non-binary bodies are returned unchanged.
32
+ * @async
33
+ * @param {*} data - The axios error response body.
34
+ * @returns {Promise<*>} - The parsed JSON body, the original body when it is not binary, or null when it is not JSON.
35
+ */
36
+ async function parseBinaryErrorBody(data) {
37
+ let text;
38
+ if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) text = new TextDecoder().decode(data);
39
+ else if (typeof Blob !== "undefined" && data instanceof Blob) text = await data.text();
40
+ else return data;
41
+ try {
42
+ return JSON.parse(text);
43
+ } catch {
44
+ return null;
45
+ }
46
+ }
47
+
27
48
  // Main SDK Class (SignalHouseSDK.js)
28
49
  import { Auth } from "./domains/Auth.js";
29
50
  import { Billing } from "./domains/Billing.js";
@@ -86,7 +107,7 @@ export class SignalHouseSDK {
86
107
  this.landings = new Landings(client, multipartClient, this.enableAdmin);
87
108
  this.messages = new Messages(client, multipartClient, this.enableAdmin);
88
109
  this.templates = new Templates(client, multipartClient, this.enableAdmin);
89
- this.rcs = new Rcs(client, multipartClient);
110
+ this.rcs = new Rcs(client, multipartClient, this.enableAdmin);
90
111
  this.numbers = new Numbers(client, multipartClient, this.enableAdmin);
91
112
  this.registrations = new Registrations(client, this.enableAdmin);
92
113
  this.onboarding = new Onboarding(client, this.enableAdmin);
@@ -147,7 +168,7 @@ export class SignalHouseSDK {
147
168
 
148
169
  // Non-2xx responses, plus timeouts and network failures (no `error.response` at all) - those
149
170
  // get a clear message here rather than surfacing axios's internal error.message verbatim.
150
- (error) => {
171
+ async (error) => {
151
172
  if (!error.response) {
152
173
  const isTimeout = error.code === "ECONNABORTED" || /timeout/i.test(error.message || "");
153
174
  return {
@@ -156,11 +177,15 @@ export class SignalHouseSDK {
156
177
  status: null,
157
178
  };
158
179
  }
159
- return {
180
+ const data = error.response.data;
181
+ const result = {
160
182
  success: false,
161
183
  error: error.response?.data?.message || error.response?.data || error.message || 500,
162
184
  status: error.response?.status || error.response?.data || null,
163
185
  };
186
+ const body = await parseBinaryErrorBody(data);
187
+ if (body && typeof body === "object" && "details" in body) result.details = body.details;
188
+ return result;
164
189
  },
165
190
  );
166
191
 
@@ -400,6 +400,13 @@ export class Agents {
400
400
  * `status` records HOW it ended and cannot be recovered afterwards, so pass the one that
401
401
  * actually happened. Ending an already-ended conversation is a no-op, so a retry after a
402
402
  * dropped connection cannot overwrite it.
403
+ *
404
+ * The end fires the AI_AGENT_CONVERSATION_ENDED webhook once, with the transcript; a retry fires
405
+ * nothing. `metadata.endReason` is passed on as the webhook's `endReason`.
406
+ *
407
+ * Voice conversations can't be ended here (403): the voice service ends each one when its call ends,
408
+ * because its length sets the call's AI Voice Agent charge. `metadata.agentSeconds` and
409
+ * `metadata.durationSeconds` are reserved for the voice service and are ignored if sent.
403
410
  * @async
404
411
  * @roles api, admin, developer, billing, user
405
412
  * @param {Object} params - The parameters for ending a conversation.
@@ -57,7 +57,7 @@ export class Auth {
57
57
  * @param {string} params.password - The user's password
58
58
  * @param {string} [params.deviceToken] - A trusted-device token from an earlier verifyTwoFactorChallenge; skips 2FA while valid
59
59
  * @param {RequestOptions} [params.options] - Additional options for the request
60
- * @returns {Promise<SdkResponse<any>>} The response from the server: { token }, or { mfaRequired: true, challengeId, methods, primaryMethod, hasBackupCodes } when the account has 2FA on; or { token, twoFactorSetupRequired: true } (a setup-only session) when the user's group requires 2FA and they haven't turned it on
60
+ * @returns {Promise<SdkResponse<any>>} The response from the server: { token, role } (role is the signed-in user's role, for feature-gating), or { mfaRequired: true, challengeId, methods, primaryMethod, hasBackupCodes } when the account has 2FA on; or { token, role, twoFactorSetupRequired: true } (a setup-only session) when the user's group requires 2FA and they haven't turned it on
61
61
  */
62
62
  async login({ email, password, deviceToken, options = {} }) {
63
63
  return this.client(`/auth`, { method: "POST", body: { email, password, deviceToken }, ...options });
@@ -252,6 +252,7 @@ export class Billing {
252
252
  /**
253
253
  * Get the fee schedule for a specific group.
254
254
  * When the group is on a custom volume-tiered plan, the response also includes volumePricing: tiers, the current period's dates, count and minimum, ramp, and current rate (rates in microdollars per segment).
255
+ * aiAgentPerMinute is the rate for an AI voice agent's time on a call, in microdollars per minute prorated per second, charged on top of the call's own rate.
255
256
  * @async
256
257
  * @roles api, admin, developer, billing, user
257
258
  * @param {Object} params - The parameters for getting the fees
@@ -38,6 +38,7 @@
38
38
  * @property {Array<string>} [tag] - An array of tags to associate with the brand
39
39
  * @property {boolean} [mock] - Whether to register the brand in TCR's mock environment instead of the live registry. TCR is still called and the mock brand auto-approves, so it does not exercise the rejection states a live registration can hit. Brand creation is not billed; campaign registration and number purchase are still billed as normal
40
40
  * @property {string} [businessContactEmail] - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
41
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
41
42
  */
42
43
 
43
44
  /**
@@ -123,6 +124,7 @@
123
124
  * @property {string} [termsAndConditionsLink] - A URL linking to the terms and conditions for the brand (optional, valid URL, at most 255 characters)
124
125
  * @property {string} [landingId] - The ID of the landing page associated with the brand (optional)
125
126
  * @property {string} [country] - The country code of the primary contact for the brand (optional, 2-letter code; when "US", state must be a valid 2-letter US state code)
127
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
126
128
  */
127
129
 
128
130
  /**
@@ -146,6 +148,7 @@
146
148
  * @property {string} lastName - The contact's last name.
147
149
  * @property {string} website - The company website URL.
148
150
  * @property {{ businessRegistrationType: string, legalEntityType: string, taxId: string, countryCode: string, supportPhone: string }} shortCode - Short Code registration details.
151
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier.
149
152
  */
150
153
 
151
154
  export class Brands {
@@ -38,6 +38,7 @@
38
38
  * @property {string} [embeddedLinkSample] - A sample of the embedded link used in the campaign (optional, must be at most 255 characters)
39
39
  * @property {string[]} [sampleMediaIds] - Up to 5 mediaIds from uploadSampleMedia: sample MMS media shown to carrier and TCR reviewers (10DLC only)
40
40
  * @property {Array<string>} phoneNumbers - An array of phone numbers associated with the campaign (required, each number must be at least 10 digits and contain only digits, a maximum of 5000 numbers is allowed)
41
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
41
42
  */
42
43
 
43
44
  /**
@@ -110,6 +111,7 @@
110
111
  * @property {string} [tag] - A tag for the campaign (optional, at most 255 characters)
111
112
  * @property {boolean} [autoRenewal=true] - Whether the campaign should auto-renew (optional, defaults to true)
112
113
  * @property {Array<string>} phoneNumbers - The Toll-Free numbers to assign to the campaign (required, 1 up to the brand's tollFree.maxNumbersPerCampaign and at most 5, each at least 10 digits and digits only). The numbers must be on the brand's toll-free carrier, or the campaign is refused. Numbers are locked to the campaign once assigned and cannot be moved or added afterward.
114
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
113
115
  */
114
116
 
115
117
  /**
@@ -140,6 +142,7 @@
140
142
  * @property {string} sample3 - Sample message 3 (required, 20-1024 characters)
141
143
  * @property {string} [tag] - A tag for the campaign (optional, at most 255 characters)
142
144
  * @property {ShortCodeDetails} shortCode - The Short Code campaign details (required)
145
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
143
146
  */
144
147
 
145
148
  export class Campaigns {
@@ -88,8 +88,9 @@ export class Messages {
88
88
  * @param {string} [params.billingClass] - Filter by RCS billing class (RICH, RICH_MEDIA)
89
89
  * @param {string} [params.deliveredChannel] - Filter by the channel that delivered an RCS message (rcs, sms, mms)
90
90
  * @param {boolean} [params.isTest] - true for RCS test messages only, false to leave them out
91
+ * @param {boolean} [params.includeTotal] - When true, the response is `{ data, total, page, limit, totalPages, totalExact, partial, countError }` instead of the array. `total` is the number of messages the filters match, counted on the analytics mirror, which can trail the list by seconds, so totalExact is false, except with id, where it is true (total 1, or 0 when no message matches); it is null with `countError` "FILTER_NOT_COUNTABLE" when senderPhoneNumber or recipientPhoneNumber is set, or "COUNT_UNAVAILABLE" when the count could not run, and `partial` is true when startDate is before 2026-01-12, the first day the count covers
91
92
  * @param {RequestOptions} [params.options] - Additional options for the request
92
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages. Inbound messages also carry
93
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages, or the includeTotal envelope. Inbound messages also carry
93
94
  * sentimentScore (-100..100, null when unscored), sentimentLabel ("positive"|"neutral"|"negative", null when
94
95
  * sentimentScore is null) and sentimentScoredAt. Outbound messages are never scored.
95
96
  * Inbound messages also carry inReplyToMessageId: the message the reply answers, absent when there is none. If that
@@ -129,9 +130,10 @@ export class Messages {
129
130
  billingClass,
130
131
  deliveredChannel,
131
132
  isTest,
133
+ includeTotal,
132
134
  options = {},
133
135
  }) {
134
- const filters = { id, campaignId, brandId, subgroupId, groupId, registrationId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, region, regionScopes, matchAny, carrier, sentimentLabel, errorCode, startDate, endDate, sortField, sortOrder, page, limit, dateBounds, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest };
136
+ const filters = { id, campaignId, brandId, subgroupId, groupId, registrationId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, region, regionScopes, matchAny, carrier, sentimentLabel, errorCode, startDate, endDate, sortField, sortOrder, page, limit, dateBounds, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, includeTotal };
135
137
  const queryString = this.client._getQueryString(withRegionScopes(filters));
136
138
  return this.client(`/message${queryString}`, { method: "GET", ...options });
137
139
  }
@@ -420,11 +422,12 @@ export class Messages {
420
422
  * @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
421
423
  * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
422
424
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
425
+ * @param {boolean} [params.includeTotal] - When true, the response is `{ data, total, page, limit, totalPages, totalExact, partial, countError }` instead of the array. `total` is the number of records (counted in a separate read, so totalExact is false; keep paging while a page is full) the filters match, or null with `countError` "COUNT_UNAVAILABLE" when the count could not run
423
426
  * @param {RequestOptions} [params.options] - Additional options for the request
424
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the paginated DNC records. Each record carries senderPhoneNumber — the first business number that received the opt-out (set once, never changed by a later STOP or a campaign move; the same value as phoneNumber) — optOutKeyword — the normalized keyword that revoked consent (e.g. "stop", "opt out"; a repeat opt-out records the most recent word), null for opt-outs recorded before keyword capture shipped — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
427
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the paginated DNC records, or the includeTotal envelope. Each record carries senderPhoneNumber — the first business number that received the opt-out (set once, never changed by a later STOP or a campaign move; the same value as phoneNumber) — optOutKeyword — the normalized keyword that revoked consent (e.g. "stop", "opt out"; a repeat opt-out records the most recent word), null for opt-outs recorded before keyword capture shipped — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
425
428
  */
426
- async getDncRecords({ groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds, options = {} }) {
427
- const filters = { groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds };
429
+ async getDncRecords({ groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds, includeTotal, options = {} }) {
430
+ const filters = { groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds, includeTotal };
428
431
  const queryString = this.client._getQueryString(withRegionScopes(filters));
429
432
  return this.client(`/message/dnc${queryString}`, { method: "GET", ...options });
430
433
  }
@@ -436,19 +436,36 @@ export class Numbers {
436
436
  /**
437
437
  * Assign phone numbers to a campaign by providing the campaign ID and a list of phone numbers to assign.
438
438
  * Numbers that are not found, already RELEASED, currently being released (transient PENDING_RELEASE
439
- * status), already assigned to a different campaign, on a mismatched DCA, or (for a 10DLC campaign
440
- * without a number pool) beyond the remaining 49-number-per-campaign limit are not queued - each is
441
- * reported back individually in `skipped` instead of failing the whole request. A Toll-Free campaign
442
- * whose brand reports `tollFree.maxNumbersPerCampaign` as 1 holds one number: a request that would give
443
- * it a second is refused with a 400 and nothing is queued.
439
+ * status), already assigned to a different campaign, on a mismatched DCA, on an Infobip Toll-Free
440
+ * campaign that is not yet ACTIVE, or (for a 10DLC campaign without a number pool) beyond the remaining
441
+ * 49-number-per-campaign limit are not queued - each is reported back individually in `skipped` instead
442
+ * of failing the whole request. A Toll-Free campaign whose brand reports
443
+ * `tollFree.maxNumbersPerCampaign` as 1 holds one number: a request that would give it a second resolves
444
+ * `{ success: false }` with a 400 and no `details`.
445
+ * Numbers on an Infobip Toll-Free campaign that is not yet ACTIVE (PENDING_DELETE and EXPIRED campaigns
446
+ * instead resolve `{ success: false }` for the whole request, with a 400 and no `details`) are skipped
447
+ * individually: every number not already skipped for another reason is reported in `skipped`, and one
448
+ * NUMBER_ASSIGNMENT_FAILED event lists them with the reason "campaign {campaignId} is an Infobip
449
+ * Toll-Free campaign that is not yet ACTIVE (status: {status})". The check runs again when a queued
450
+ * number actually executes: if the campaign has stopped being ACTIVE by then, the still-eligible queued
451
+ * numbers are not assigned, and one NUMBER_ASSIGNMENT_FAILED event lists them with the reason "campaign
452
+ * is an Infobip Toll-Free campaign that is not yet ACTIVE (status: {status})".
453
+ * If every provided number ends up skipped for one of the per-number reasons above, or none fit the
454
+ * campaign's remaining 49-number capacity, the call resolves `{ success: false }` with a 400 instead of
455
+ * a 202 with an empty `queued` array, so a caller can't mistake an all-skipped request for success - in
456
+ * both of these cases only, `details` carries the same `{ queued: [], skipped }` breakdown a partial
457
+ * success would have returned. Other failures - none of the submitted numbers exist in the account, the
458
+ * campaign is not found, or the campaign is in a terminal state (PENDING_DELETE/EXPIRED) - also resolve
459
+ * `{ success: false }` with a 400 or 404, but carry no `details.skipped`, since no per-number evaluation
460
+ * ran.
444
461
  * @async
445
462
  * @roles api, admin, developer, billing, user
446
463
  * @param {Object} params - The parameters for assigning phone numbers to a campaign
447
464
  * @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
448
465
  * @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
449
466
  * @param {RequestOptions} [params.options] - Additional options for the request
450
- * @throws {Error} Throws an error if the campaignId or phoneNumbers parameter is missing, if none of the phone numbers exist in the account, or if the campaign is not found or in a terminal state
451
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ Message, queued, skipped }` - `queued` numbers were sent for assignment; `skipped` numbers were rejected (not found, RELEASED, currently being released, already assigned to a campaign, cross-DCA mismatch, or over the 49-number limit).
467
+ * @throws {Error} Throws an error only for a missing campaignId or phoneNumbers parameter (client-side validation, before any request is sent). Every server-side rejection - no matching numbers, campaign not found, terminal campaign state, or an all-skipped request - resolves normally with `success: false`; it does not throw.
468
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ success: true, data: { Message, queued, skipped }, status: 202 }` when at least one number queues - `queued` numbers were sent for assignment; `skipped` numbers were rejected (not found, RELEASED, currently being released, already assigned to a campaign, cross-DCA mismatch, an Infobip Toll-Free campaign that is not yet ACTIVE, or over the 49-number limit). Any rejection, including an all-skipped request, resolves `{ success: false, error, status, details? }` instead - callers must check `success` to detect a failed assignment rather than relying on a throw or a catch block.
452
469
  */
453
470
  async assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options = {} }) {
454
471
  this.client._require({ campaignId, phoneNumbers });
@@ -593,8 +593,184 @@ export class RcsMessages {
593
593
  * RCS (Google RBM) resources. Templates for RCS live under `templates`.
594
594
  */
595
595
  export class Rcs {
596
- constructor(client, multipartClient) {
596
+ /**
597
+ * @param {*} client - The JSON request client
598
+ * @param {*} multipartClient - The multipart request client
599
+ * @param {boolean} [enableAdmin] - Whether the portal-only methods under `admin` are available
600
+ */
601
+ constructor(client, multipartClient, enableAdmin = false) {
602
+ this.client = client;
603
+ this.enableAdmin = enableAdmin;
597
604
  this.agents = new RcsAgents(client, multipartClient);
598
605
  this.messages = new RcsMessages(client);
606
+
607
+ // Hidden Admin namespace INSIDE the domain: the portal's guided launch-video recording. 404 while the
608
+ // environment's RCS switch is off.
609
+ if (enableAdmin) {
610
+ this.admin = {
611
+ /**
612
+ * Read which of the agent's message examples are linked to a template for the guided launch recording.
613
+ * One entry per `consent.messageExamples` entry, in the same order.
614
+ * @async
615
+ * @roles api, admin, developer, billing, user
616
+ * @param {Object} params - The read
617
+ * @param {string} params.agentId - The agent ID
618
+ * @param {RequestOptions} [params.options] - Additional options for the request
619
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ agentId, useCase, samples }`
620
+ */
621
+ getLaunchRecordingSamples: async ({ agentId, options = {} }) => {
622
+ this.client._require({ agentId });
623
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording-samples`, { method: "GET", ...options });
624
+ },
625
+
626
+ /**
627
+ * Replace the template links on the agent's message examples. A link sends that published template, with its
628
+ * variables, in place of the example's text during the guided launch recording, and the launch request sends that
629
+ * template's text, rendered with the same variables, as the example. It does not edit the stored examples. An
630
+ * agent that cannot be edited in its current state refuses a change (409 `AGENT_NOT_EDITABLE`); a list equal to
631
+ * the stored one is accepted and writes nothing. An edit that changes the message examples removes every link.
632
+ * @async
633
+ * @roles api, admin, developer, billing, user
634
+ * @param {Object} params - The write
635
+ * @param {string} params.agentId - The agent ID
636
+ * @param {Array<{ index: number, templateId: string|null, variables?: Object<string, string>, trafficType?: ("TRANSACTION"|"PROMOTION"|null) }>} params.samples - The whole list of links; `templateId: null` clears one
637
+ * @param {RequestOptions} [params.options] - Additional options for the request
638
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ agentId, useCase, samples }`
639
+ */
640
+ setLaunchRecordingSamples: async ({ agentId, samples, options = {} }) => {
641
+ this.client._require({ agentId, samples });
642
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording-samples`, { method: "PUT", body: { samples }, ...options });
643
+ },
644
+
645
+ /**
646
+ * Start a guided launch-recording session with one of the agent's approved testers. A live session for the
647
+ * agent is cancelled. 409 with `details.blockers` when the agent, the tester or the consent text is not ready.
648
+ * @async
649
+ * @roles api, admin, developer, billing, user
650
+ * @param {Object} params - The session
651
+ * @param {string} params.agentId - The agent ID
652
+ * @param {string} params.phoneNumber - An approved tester's number, digits without the +
653
+ * @param {RequestOptions} [params.options] - Additional options for the request
654
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
655
+ */
656
+ startLaunchRecording: async ({ agentId, phoneNumber, options = {} }) => {
657
+ this.client._require({ agentId, phoneNumber });
658
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording`, { method: "POST", body: { phoneNumber }, ...options });
659
+ },
660
+
661
+ /**
662
+ * Start a direct launch-video upload session without a guided recording script. Returns an upload-only
663
+ * session (`mode: "upload"`) whose upload token accepts an MP4 or MOV video via the public upload routes
664
+ * and saves it to `consent.launchVideoUrl` through `completeLaunchRecording`.
665
+ * @async
666
+ * @roles api, admin, developer, billing, user
667
+ * @param {Object} params - The upload session
668
+ * @param {string} params.agentId - The agent ID
669
+ * @param {RequestOptions} [params.options] - Additional options for the request
670
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
671
+ */
672
+ startLaunchVideoUpload: async ({ agentId, options = {} }) => {
673
+ this.client._require({ agentId });
674
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording/upload`, { method: "POST", ...options });
675
+ },
676
+
677
+ /**
678
+ * Read a launch-recording session: each step's state, the upload and, once accepted, the video URL.
679
+ * 404 when the session is unknown, cancelled or expired.
680
+ * @async
681
+ * @roles api, admin, developer, billing, user
682
+ * @param {Object} params - The read
683
+ * @param {string} params.agentId - The agent ID
684
+ * @param {string} params.sessionId - The session ID
685
+ * @param {RequestOptions} [params.options] - Additional options for the request
686
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
687
+ */
688
+ getLaunchRecording: async ({ agentId, sessionId, options = {} }) => {
689
+ this.client._require({ agentId, sessionId });
690
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording/${encodeURIComponent(sessionId)}`, { method: "GET", ...options });
691
+ },
692
+
693
+ /**
694
+ * Send one scripted message of the session to the tester: the opt-in confirmation or a sample.
695
+ * 409 when that step was already sent.
696
+ * @async
697
+ * @roles api, admin, developer, billing, user
698
+ * @param {Object} params - The send
699
+ * @param {string} params.agentId - The agent ID
700
+ * @param {string} params.sessionId - The session ID
701
+ * @param {string} params.step - The step key: `CONFIRMATION` or `SAMPLE_<index>`
702
+ * @param {RequestOptions} [params.options] - Additional options for the request
703
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
704
+ */
705
+ sendLaunchRecordingStep: async ({ agentId, sessionId, step, options = {} }) => {
706
+ this.client._require({ agentId, sessionId, step });
707
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording/${encodeURIComponent(sessionId)}/send`, { method: "POST", body: { step }, ...options });
708
+ },
709
+
710
+ /**
711
+ * Accept the session's uploaded video as the agent's launch video (`consent.launchVideoUrl`).
712
+ * 409 with `details.missing` while a step is not done or no verified upload exists, and 409 `MEDIA_CHANGED` when
713
+ * the stored file changed after its check; upload it again.
714
+ * @async
715
+ * @roles api, admin, developer, billing, user
716
+ * @param {Object} params - The completion
717
+ * @param {string} params.agentId - The agent ID
718
+ * @param {string} params.sessionId - The session ID
719
+ * @param {RequestOptions} [params.options] - Additional options for the request
720
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }` with status COMPLETED
721
+ */
722
+ completeLaunchRecording: async ({ agentId, sessionId, options = {} }) => {
723
+ this.client._require({ agentId, sessionId });
724
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording/${encodeURIComponent(sessionId)}/complete`, { method: "POST", ...options });
725
+ },
726
+
727
+ /**
728
+ * Cancel a launch-recording session.
729
+ * @async
730
+ * @roles api, admin, developer, billing, user
731
+ * @param {Object} params - The cancellation
732
+ * @param {string} params.agentId - The agent ID
733
+ * @param {string} params.sessionId - The session ID
734
+ * @param {RequestOptions} [params.options] - Additional options for the request
735
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ cancelled: true }`
736
+ */
737
+ cancelLaunchRecording: async ({ agentId, sessionId, options = {} }) => {
738
+ this.client._require({ agentId, sessionId });
739
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/launch-recording/${encodeURIComponent(sessionId)}`, { method: "DELETE", ...options });
740
+ },
741
+
742
+ /**
743
+ * Read the upload page's details by its token. With `contentType`, also returns a signed form (`upload.url`,
744
+ * `upload.fields`) to post the video straight to storage: every field first, the file last in `file`.
745
+ * @async
746
+ * @roles public
747
+ * @param {Object} params - The read
748
+ * @param {string} params.token - The upload token from the session's `upload.token`
749
+ * @param {("video/mp4"|"video/quicktime")} [params.contentType] - The file's type; asks for the signed form
750
+ * @param {RequestOptions} [params.options] - Additional options for the request
751
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ agentName, state, expiresAt, maxBytes, acceptedTypes, upload? }`
752
+ */
753
+ getLaunchRecordingUpload: async ({ token, contentType, options = {} }) => {
754
+ this.client._require({ token });
755
+ const queryString = this.client._getQueryString({ contentType });
756
+ return this.client(`/rcs/launch-recording/upload/${encodeURIComponent(token)}${queryString}`, { method: "GET", ...options });
757
+ },
758
+
759
+ /**
760
+ * Tell the API the video was posted to storage, so it checks the stored file. 400 with a plain reason when
761
+ * nothing was stored, the file is too large or it is not an accepted video.
762
+ * @async
763
+ * @roles public
764
+ * @param {Object} params - The completion
765
+ * @param {string} params.token - The upload token
766
+ * @param {RequestOptions} [params.options] - Additional options for the request
767
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ state, videoUrl, bytes, mimeType }`
768
+ */
769
+ completeLaunchRecordingUpload: async ({ token, options = {} }) => {
770
+ this.client._require({ token });
771
+ return this.client(`/rcs/launch-recording/upload/${encodeURIComponent(token)}/complete`, { method: "POST", ...options });
772
+ },
773
+ };
774
+ }
599
775
  }
600
776
  }
@@ -410,14 +410,16 @@ export class Registrations {
410
410
  * @param {string} params.subgroupId - Subgroup that will own the registration and any allocated numbers
411
411
  * @param {string[]} params.capabilities - One of the type's bundles, e.g. ["SMS"] or ["SMS", "VOICE"]
412
412
  * @param {Object} params.data - The type's submission fields
413
+ * @param {string} [params.complianceScanId] - Optional id of the website compliance scan run before submitting (at
414
+ * most 64 characters). Stored for Signal House registration analytics and never sent to a provider; sent only when set
413
415
  * @param {RequestOptions} [params.options] - Additional options for the request
414
416
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the created registration
415
417
  */
416
- async createRegistration({ region, type, subgroupId, capabilities, data, options = {} }) {
418
+ async createRegistration({ region, type, subgroupId, capabilities, data, complianceScanId, options = {} }) {
417
419
  this.client._require({ region, type, subgroupId, capabilities, data });
418
420
  return this.client("/registration", {
419
421
  method: "POST",
420
- body: { region, type, subgroupId, capabilities, data },
422
+ body: { region, type, subgroupId, capabilities, data, ...(complianceScanId === undefined ? {} : { complianceScanId }) },
421
423
  ...options,
422
424
  });
423
425
  }
@@ -73,15 +73,33 @@ export class Users {
73
73
  * @param {string} [params.search] - Search users by email (case-insensitive)
74
74
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
75
75
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
76
+ * @param {string|Array<string>} [params.groupIds] - Only users whose active group is one of these group IDs
77
+ * @param {string|Array<string>} [params.subgroupIds] - Only users whose active group is the parent group of one of these subgroup IDs
78
+ * @param {string|Array<string>} [params.status] - Only users with one of these statuses (active, inactive)
79
+ * groupIds, subgroupIds and status cannot be combined with email; the API rejects that with a 400.
76
80
  * @param {RequestOptions} [params.options] - Additional options for the request
77
81
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
78
82
  */
79
- getUsers: async ({ email, userType, page, limit, search, sortBy, sortOrder, options = {} }) => {
80
- const filters = { email, userType, page, limit, search, sortBy, sortOrder };
83
+ getUsers: async ({ email, userType, page, limit, search, sortBy, sortOrder, groupIds, subgroupIds, status, options = {} }) => {
84
+ const filters = { email, userType, page, limit, search, sortBy, sortOrder, groupIds, subgroupIds, status };
81
85
  const queryString = this.client._getQueryString(filters);
82
86
  return this.client(`/user${queryString}`, { method: "GET", ...options });
83
87
  },
84
88
 
89
+ /**
90
+ * Get the group and subgroup options for the admin users list filters, bounded and searchable.
91
+ * @roles signalhouse
92
+ * @param {Object} [params] - The parameters for getting the filter options
93
+ * @param {string} [params.search] - 3 to 100 characters matched against group and subgroup IDs and names
94
+ * @param {number} [params.limit] - Maximum options of each kind (1 to 100, default 25)
95
+ * @param {RequestOptions} [params.options] - Additional options for the request
96
+ * @returns {Promise<SdkResponse<{groups: Array<{groupId: string, groupName: string}>, subgroups: Array<{subgroupId: string, subgroupName: string, groupId: string}>}>>} - A promise that resolves to the filter options
97
+ */
98
+ getUserFilterOptions: async ({ search, limit, options = {} } = {}) => {
99
+ const queryString = this.client._getQueryString({ search, limit });
100
+ return this.client(`/user/filter-options${queryString}`, { method: "GET", ...options });
101
+ },
102
+
85
103
  /**
86
104
  * Create a new internal user (admin or service user) with the specified data.
87
105
  * @roles signalhouse
@@ -111,11 +129,14 @@ export class Users {
111
129
  * @param {string} [params.search] - Search users by email (case-insensitive)
112
130
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
113
131
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
132
+ * @param {string|Array<string>} [params.groupIds] - Staff-only, without id or groupId (the API rejects that with a 400): only users whose active group is one of these group IDs
133
+ * @param {string|Array<string>} [params.subgroupIds] - Staff-only, without id or groupId: only users whose active group is the parent group of one of these subgroup IDs
134
+ * @param {string|Array<string>} [params.status] - Staff-only, without id or groupId: only users with one of these statuses (active, inactive)
114
135
  * @param {RequestOptions} [params.options] - Additional options for the request
115
136
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
116
137
  */
117
- async getUsers({ id, groupId, userType, page, limit, search, sortBy, sortOrder, options = {} }) {
118
- const filters = { id, groupId, userType, page, limit, search, sortBy, sortOrder };
138
+ async getUsers({ id, groupId, userType, page, limit, search, sortBy, sortOrder, groupIds, subgroupIds, status, options = {} }) {
139
+ const filters = { id, groupId, userType, page, limit, search, sortBy, sortOrder, groupIds, subgroupIds, status };
119
140
  const queryString = this.client._getQueryString(filters);
120
141
  return this.client(`/user${queryString}`, { method: "GET", ...options });
121
142
  }
@@ -88,6 +88,8 @@ export type SignalHouseSDKConfig = {
88
88
  };
89
89
  /**
90
90
  * The envelope every domain method resolves to. Non-2xx responses never reject; check `success` first.
91
+ * An error envelope carries `details` when the API error body has one, for example `details.code` and
92
+ * `details.retryAfterSeconds` on a connector cap response.
91
93
  */
92
94
  export type SdkResponse<T> = {
93
95
  success: true;
@@ -97,6 +99,7 @@ export type SdkResponse<T> = {
97
99
  success: false;
98
100
  error: string | any;
99
101
  status: number | null;
102
+ details?: any | any[];
100
103
  };
101
104
  import { Auth } from "./domains/Auth.js";
102
105
  import { Billing } from "./domains/Billing.js";
@@ -376,6 +376,13 @@ export class Agents {
376
376
  * `status` records HOW it ended and cannot be recovered afterwards, so pass the one that
377
377
  * actually happened. Ending an already-ended conversation is a no-op, so a retry after a
378
378
  * dropped connection cannot overwrite it.
379
+ *
380
+ * The end fires the AI_AGENT_CONVERSATION_ENDED webhook once, with the transcript; a retry fires
381
+ * nothing. `metadata.endReason` is passed on as the webhook's `endReason`.
382
+ *
383
+ * Voice conversations can't be ended here (403): the voice service ends each one when its call ends,
384
+ * because its length sets the call's AI Voice Agent charge. `metadata.agentSeconds` and
385
+ * `metadata.durationSeconds` are reserved for the voice service and are ignored if sent.
379
386
  * @async
380
387
  * @roles api, admin, developer, billing, user
381
388
  * @param {Object} params - The parameters for ending a conversation.
@@ -48,7 +48,7 @@ export class Auth {
48
48
  * @param {string} params.password - The user's password
49
49
  * @param {string} [params.deviceToken] - A trusted-device token from an earlier verifyTwoFactorChallenge; skips 2FA while valid
50
50
  * @param {RequestOptions} [params.options] - Additional options for the request
51
- * @returns {Promise<SdkResponse<any>>} The response from the server: { token }, or { mfaRequired: true, challengeId, methods, primaryMethod, hasBackupCodes } when the account has 2FA on; or { token, twoFactorSetupRequired: true } (a setup-only session) when the user's group requires 2FA and they haven't turned it on
51
+ * @returns {Promise<SdkResponse<any>>} The response from the server: { token, role } (role is the signed-in user's role, for feature-gating), or { mfaRequired: true, challengeId, methods, primaryMethod, hasBackupCodes } when the account has 2FA on; or { token, role, twoFactorSetupRequired: true } (a setup-only session) when the user's group requires 2FA and they haven't turned it on
52
52
  */
53
53
  login({ email, password, deviceToken, options }: {
54
54
  email: string;
@@ -261,6 +261,7 @@ export class Billing {
261
261
  /**
262
262
  * Get the fee schedule for a specific group.
263
263
  * When the group is on a custom volume-tiered plan, the response also includes volumePricing: tiers, the current period's dates, count and minimum, ramp, and current rate (rates in microdollars per segment).
264
+ * aiAgentPerMinute is the rate for an AI voice agent's time on a call, in microdollars per minute prorated per second, charged on top of the call's own rate.
264
265
  * @async
265
266
  * @roles api, admin, developer, billing, user
266
267
  * @param {Object} params - The parameters for getting the fees
@@ -36,6 +36,7 @@
36
36
  * @property {Array<string>} [tag] - An array of tags to associate with the brand
37
37
  * @property {boolean} [mock] - Whether to register the brand in TCR's mock environment instead of the live registry. TCR is still called and the mock brand auto-approves, so it does not exercise the rejection states a live registration can hit. Brand creation is not billed; campaign registration and number purchase are still billed as normal
38
38
  * @property {string} [businessContactEmail] - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
39
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
39
40
  */
40
41
  /**
41
42
  * @typedef {Object} UpdateBrandData
@@ -117,6 +118,7 @@
117
118
  * @property {string} [termsAndConditionsLink] - A URL linking to the terms and conditions for the brand (optional, valid URL, at most 255 characters)
118
119
  * @property {string} [landingId] - The ID of the landing page associated with the brand (optional)
119
120
  * @property {string} [country] - The country code of the primary contact for the brand (optional, 2-letter code; when "US", state must be a valid 2-letter US state code)
121
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
120
122
  */
121
123
  /**
122
124
  * @typedef {Object} TollFreeRequirements
@@ -138,6 +140,7 @@
138
140
  * @property {string} lastName - The contact's last name.
139
141
  * @property {string} website - The company website URL.
140
142
  * @property {{ businessRegistrationType: string, legalEntityType: string, taxId: string, countryCode: string, supportPhone: string }} shortCode - Short Code registration details.
143
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier.
141
144
  */
142
145
  export class Brands {
143
146
  constructor(client: any, multipartClient: any, enableAdmin: any);
@@ -694,6 +697,10 @@ export type CreateBrandData = {
694
697
  * - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
695
698
  */
696
699
  businessContactEmail?: string;
700
+ /**
701
+ * - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
702
+ */
703
+ complianceScanId?: string;
697
704
  };
698
705
  export type UpdateBrandData = {
699
706
  /**
@@ -962,6 +969,10 @@ export type CreateTollFreeBrandData = {
962
969
  * - The country code of the primary contact for the brand (optional, 2-letter code; when "US", state must be a valid 2-letter US state code)
963
970
  */
964
971
  country?: string;
972
+ /**
973
+ * - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
974
+ */
975
+ complianceScanId?: string;
965
976
  };
966
977
  export type TollFreeRequirements = {
967
978
  /**
@@ -1032,4 +1043,8 @@ export type CreateShortCodeBrandData = {
1032
1043
  countryCode: string;
1033
1044
  supportPhone: string;
1034
1045
  };
1046
+ /**
1047
+ * - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier.
1048
+ */
1049
+ complianceScanId?: string;
1035
1050
  };
@@ -37,6 +37,7 @@
37
37
  * @property {string} [embeddedLinkSample] - A sample of the embedded link used in the campaign (optional, must be at most 255 characters)
38
38
  * @property {string[]} [sampleMediaIds] - Up to 5 mediaIds from uploadSampleMedia: sample MMS media shown to carrier and TCR reviewers (10DLC only)
39
39
  * @property {Array<string>} phoneNumbers - An array of phone numbers associated with the campaign (required, each number must be at least 10 digits and contain only digits, a maximum of 5000 numbers is allowed)
40
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
40
41
  */
41
42
  /**
42
43
  * @typedef {Object} UpdateCampaignData
@@ -105,6 +106,7 @@
105
106
  * @property {string} [tag] - A tag for the campaign (optional, at most 255 characters)
106
107
  * @property {boolean} [autoRenewal=true] - Whether the campaign should auto-renew (optional, defaults to true)
107
108
  * @property {Array<string>} phoneNumbers - The Toll-Free numbers to assign to the campaign (required, 1 up to the brand's tollFree.maxNumbersPerCampaign and at most 5, each at least 10 digits and digits only). The numbers must be on the brand's toll-free carrier, or the campaign is refused. Numbers are locked to the campaign once assigned and cannot be moved or added afterward.
109
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
108
110
  */
109
111
  /**
110
112
  * @typedef {Object} ShortCodeDetails
@@ -133,6 +135,7 @@
133
135
  * @property {string} sample3 - Sample message 3 (required, 20-1024 characters)
134
136
  * @property {string} [tag] - A tag for the campaign (optional, at most 255 characters)
135
137
  * @property {ShortCodeDetails} shortCode - The Short Code campaign details (required)
138
+ * @property {string} [complianceScanId] - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
136
139
  */
137
140
  export class Campaigns {
138
141
  constructor(client: any, multipartClient: any, enableAdmin: any);
@@ -763,6 +766,10 @@ export type CreateCampaignData = {
763
766
  * - An array of phone numbers associated with the campaign (required, each number must be at least 10 digits and contain only digits, a maximum of 5000 numbers is allowed)
764
767
  */
765
768
  phoneNumbers: Array<string>;
769
+ /**
770
+ * - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
771
+ */
772
+ complianceScanId?: string;
766
773
  };
767
774
  export type UpdateCampaignData = {
768
775
  /**
@@ -984,6 +991,10 @@ export type CreateTollFreeCampaignData = {
984
991
  * - The Toll-Free numbers to assign to the campaign (required, 1 up to the brand's tollFree.maxNumbersPerCampaign and at most 5, each at least 10 digits and digits only). The numbers must be on the brand's toll-free carrier, or the campaign is refused. Numbers are locked to the campaign once assigned and cannot be moved or added afterward.
985
992
  */
986
993
  phoneNumbers: Array<string>;
994
+ /**
995
+ * - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
996
+ */
997
+ complianceScanId?: string;
987
998
  };
988
999
  export type ShortCodeDetails = {
989
1000
  /**
@@ -1078,4 +1089,8 @@ export type CreateShortCodeCampaignData = {
1078
1089
  * - The Short Code campaign details (required)
1079
1090
  */
1080
1091
  shortCode: ShortCodeDetails;
1092
+ /**
1093
+ * - Optional id of the website compliance scan run before submitting (at most 64 characters). Stored for Signal House registration analytics and never sent to a registrar or carrier
1094
+ */
1095
+ complianceScanId?: string;
1081
1096
  };
@@ -78,14 +78,15 @@ export class Messages {
78
78
  * @param {string} [params.billingClass] - Filter by RCS billing class (RICH, RICH_MEDIA)
79
79
  * @param {string} [params.deliveredChannel] - Filter by the channel that delivered an RCS message (rcs, sms, mms)
80
80
  * @param {boolean} [params.isTest] - true for RCS test messages only, false to leave them out
81
+ * @param {boolean} [params.includeTotal] - When true, the response is `{ data, total, page, limit, totalPages, totalExact, partial, countError }` instead of the array. `total` is the number of messages the filters match, counted on the analytics mirror, which can trail the list by seconds, so totalExact is false, except with id, where it is true (total 1, or 0 when no message matches); it is null with `countError` "FILTER_NOT_COUNTABLE" when senderPhoneNumber or recipientPhoneNumber is set, or "COUNT_UNAVAILABLE" when the count could not run, and `partial` is true when startDate is before 2026-01-12, the first day the count covers
81
82
  * @param {RequestOptions} [params.options] - Additional options for the request
82
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages. Inbound messages also carry
83
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages, or the includeTotal envelope. Inbound messages also carry
83
84
  * sentimentScore (-100..100, null when unscored), sentimentLabel ("positive"|"neutral"|"negative", null when
84
85
  * sentimentScore is null) and sentimentScoredAt. Outbound messages are never scored.
85
86
  * Inbound messages also carry inReplyToMessageId: the message the reply answers, absent when there is none. If that
86
87
  * message has a parentMessageId, it was an RCS fallback, and the parent is the RCS message you sent.
87
88
  */
88
- getMessages({ id, campaignId, brandId, subgroupId, groupId, registrationId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, region, regionScopes, matchAny, carrier, sentimentLabel, errorCode, startDate, endDate, sortField, sortOrder, page, limit, dateBounds, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, options, }: {
89
+ getMessages({ id, campaignId, brandId, subgroupId, groupId, registrationId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, region, regionScopes, matchAny, carrier, sentimentLabel, errorCode, startDate, endDate, sortField, sortOrder, page, limit, dateBounds, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, includeTotal, options, }: {
89
90
  id?: string;
90
91
  campaignId?: string;
91
92
  brandId?: string;
@@ -119,6 +120,7 @@ export class Messages {
119
120
  billingClass?: string;
120
121
  deliveredChannel?: string;
121
122
  isTest?: boolean;
123
+ includeTotal?: boolean;
122
124
  options?: RequestOptions;
123
125
  }): Promise<SdkResponse<any>>;
124
126
  /**
@@ -469,10 +471,11 @@ export class Messages {
469
471
  * @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
470
472
  * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
471
473
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
474
+ * @param {boolean} [params.includeTotal] - When true, the response is `{ data, total, page, limit, totalPages, totalExact, partial, countError }` instead of the array. `total` is the number of records (counted in a separate read, so totalExact is false; keep paging while a page is full) the filters match, or null with `countError` "COUNT_UNAVAILABLE" when the count could not run
472
475
  * @param {RequestOptions} [params.options] - Additional options for the request
473
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the paginated DNC records. Each record carries senderPhoneNumber — the first business number that received the opt-out (set once, never changed by a later STOP or a campaign move; the same value as phoneNumber) — optOutKeyword — the normalized keyword that revoked consent (e.g. "stop", "opt out"; a repeat opt-out records the most recent word), null for opt-outs recorded before keyword capture shipped — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
476
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the paginated DNC records, or the includeTotal envelope. Each record carries senderPhoneNumber — the first business number that received the opt-out (set once, never changed by a later STOP or a campaign move; the same value as phoneNumber) — optOutKeyword — the normalized keyword that revoked consent (e.g. "stop", "opt out"; a repeat opt-out records the most recent word), null for opt-outs recorded before keyword capture shipped — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
474
477
  */
475
- getDncRecords({ groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds, options }: {
478
+ getDncRecords({ groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds, includeTotal, options }: {
476
479
  groupId?: string;
477
480
  subgroupId?: string;
478
481
  brandId?: string;
@@ -490,6 +493,7 @@ export class Messages {
490
493
  dateBounds?: ("day" | "exact");
491
494
  region?: string | string[];
492
495
  regionScopes?: any[] | string;
496
+ includeTotal?: boolean;
493
497
  options?: RequestOptions;
494
498
  }): Promise<SdkResponse<any>>;
495
499
  /**
@@ -403,19 +403,36 @@ export class Numbers {
403
403
  /**
404
404
  * Assign phone numbers to a campaign by providing the campaign ID and a list of phone numbers to assign.
405
405
  * Numbers that are not found, already RELEASED, currently being released (transient PENDING_RELEASE
406
- * status), already assigned to a different campaign, on a mismatched DCA, or (for a 10DLC campaign
407
- * without a number pool) beyond the remaining 49-number-per-campaign limit are not queued - each is
408
- * reported back individually in `skipped` instead of failing the whole request. A Toll-Free campaign
409
- * whose brand reports `tollFree.maxNumbersPerCampaign` as 1 holds one number: a request that would give
410
- * it a second is refused with a 400 and nothing is queued.
406
+ * status), already assigned to a different campaign, on a mismatched DCA, on an Infobip Toll-Free
407
+ * campaign that is not yet ACTIVE, or (for a 10DLC campaign without a number pool) beyond the remaining
408
+ * 49-number-per-campaign limit are not queued - each is reported back individually in `skipped` instead
409
+ * of failing the whole request. A Toll-Free campaign whose brand reports
410
+ * `tollFree.maxNumbersPerCampaign` as 1 holds one number: a request that would give it a second resolves
411
+ * `{ success: false }` with a 400 and no `details`.
412
+ * Numbers on an Infobip Toll-Free campaign that is not yet ACTIVE (PENDING_DELETE and EXPIRED campaigns
413
+ * instead resolve `{ success: false }` for the whole request, with a 400 and no `details`) are skipped
414
+ * individually: every number not already skipped for another reason is reported in `skipped`, and one
415
+ * NUMBER_ASSIGNMENT_FAILED event lists them with the reason "campaign {campaignId} is an Infobip
416
+ * Toll-Free campaign that is not yet ACTIVE (status: {status})". The check runs again when a queued
417
+ * number actually executes: if the campaign has stopped being ACTIVE by then, the still-eligible queued
418
+ * numbers are not assigned, and one NUMBER_ASSIGNMENT_FAILED event lists them with the reason "campaign
419
+ * is an Infobip Toll-Free campaign that is not yet ACTIVE (status: {status})".
420
+ * If every provided number ends up skipped for one of the per-number reasons above, or none fit the
421
+ * campaign's remaining 49-number capacity, the call resolves `{ success: false }` with a 400 instead of
422
+ * a 202 with an empty `queued` array, so a caller can't mistake an all-skipped request for success - in
423
+ * both of these cases only, `details` carries the same `{ queued: [], skipped }` breakdown a partial
424
+ * success would have returned. Other failures - none of the submitted numbers exist in the account, the
425
+ * campaign is not found, or the campaign is in a terminal state (PENDING_DELETE/EXPIRED) - also resolve
426
+ * `{ success: false }` with a 400 or 404, but carry no `details.skipped`, since no per-number evaluation
427
+ * ran.
411
428
  * @async
412
429
  * @roles api, admin, developer, billing, user
413
430
  * @param {Object} params - The parameters for assigning phone numbers to a campaign
414
431
  * @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
415
432
  * @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
416
433
  * @param {RequestOptions} [params.options] - Additional options for the request
417
- * @throws {Error} Throws an error if the campaignId or phoneNumbers parameter is missing, if none of the phone numbers exist in the account, or if the campaign is not found or in a terminal state
418
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ Message, queued, skipped }` - `queued` numbers were sent for assignment; `skipped` numbers were rejected (not found, RELEASED, currently being released, already assigned to a campaign, cross-DCA mismatch, or over the 49-number limit).
434
+ * @throws {Error} Throws an error only for a missing campaignId or phoneNumbers parameter (client-side validation, before any request is sent). Every server-side rejection - no matching numbers, campaign not found, terminal campaign state, or an all-skipped request - resolves normally with `success: false`; it does not throw.
435
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ success: true, data: { Message, queued, skipped }, status: 202 }` when at least one number queues - `queued` numbers were sent for assignment; `skipped` numbers were rejected (not found, RELEASED, currently being released, already assigned to a campaign, cross-DCA mismatch, an Infobip Toll-Free campaign that is not yet ACTIVE, or over the 49-number limit). Any rejection, including an all-skipped request, resolves `{ success: false, error, status, details? }` instead - callers must check `success` to detect a failed assignment rather than relying on a throw or a catch block.
419
436
  */
420
437
  assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options }: {
421
438
  campaignId: string;
@@ -644,9 +644,185 @@ export class RcsMessages {
644
644
  * RCS (Google RBM) resources. Templates for RCS live under `templates`.
645
645
  */
646
646
  export class Rcs {
647
- constructor(client: any, multipartClient: any);
647
+ /**
648
+ * @param {*} client - The JSON request client
649
+ * @param {*} multipartClient - The multipart request client
650
+ * @param {boolean} [enableAdmin] - Whether the portal-only methods under `admin` are available
651
+ */
652
+ constructor(client: any, multipartClient: any, enableAdmin?: boolean);
653
+ client: any;
654
+ enableAdmin: boolean;
648
655
  agents: RcsAgents;
649
656
  messages: RcsMessages;
657
+ admin: {
658
+ /**
659
+ * Read which of the agent's message examples are linked to a template for the guided launch recording.
660
+ * One entry per `consent.messageExamples` entry, in the same order.
661
+ * @async
662
+ * @roles api, admin, developer, billing, user
663
+ * @param {Object} params - The read
664
+ * @param {string} params.agentId - The agent ID
665
+ * @param {RequestOptions} [params.options] - Additional options for the request
666
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ agentId, useCase, samples }`
667
+ */
668
+ getLaunchRecordingSamples: ({ agentId, options }: {
669
+ agentId: string;
670
+ options?: RequestOptions;
671
+ }) => Promise<SdkResponse<any>>;
672
+ /**
673
+ * Replace the template links on the agent's message examples. A link sends that published template, with its
674
+ * variables, in place of the example's text during the guided launch recording, and the launch request sends that
675
+ * template's text, rendered with the same variables, as the example. It does not edit the stored examples. An
676
+ * agent that cannot be edited in its current state refuses a change (409 `AGENT_NOT_EDITABLE`); a list equal to
677
+ * the stored one is accepted and writes nothing. An edit that changes the message examples removes every link.
678
+ * @async
679
+ * @roles api, admin, developer, billing, user
680
+ * @param {Object} params - The write
681
+ * @param {string} params.agentId - The agent ID
682
+ * @param {Array<{ index: number, templateId: string|null, variables?: Object<string, string>, trafficType?: ("TRANSACTION"|"PROMOTION"|null) }>} params.samples - The whole list of links; `templateId: null` clears one
683
+ * @param {RequestOptions} [params.options] - Additional options for the request
684
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ agentId, useCase, samples }`
685
+ */
686
+ setLaunchRecordingSamples: ({ agentId, samples, options }: {
687
+ agentId: string;
688
+ samples: Array<{
689
+ index: number;
690
+ templateId: string | null;
691
+ variables?: {
692
+ [x: string]: string;
693
+ };
694
+ trafficType?: ("TRANSACTION" | "PROMOTION" | null);
695
+ }>;
696
+ options?: RequestOptions;
697
+ }) => Promise<SdkResponse<any>>;
698
+ /**
699
+ * Start a guided launch-recording session with one of the agent's approved testers. A live session for the
700
+ * agent is cancelled. 409 with `details.blockers` when the agent, the tester or the consent text is not ready.
701
+ * @async
702
+ * @roles api, admin, developer, billing, user
703
+ * @param {Object} params - The session
704
+ * @param {string} params.agentId - The agent ID
705
+ * @param {string} params.phoneNumber - An approved tester's number, digits without the +
706
+ * @param {RequestOptions} [params.options] - Additional options for the request
707
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
708
+ */
709
+ startLaunchRecording: ({ agentId, phoneNumber, options }: {
710
+ agentId: string;
711
+ phoneNumber: string;
712
+ options?: RequestOptions;
713
+ }) => Promise<SdkResponse<any>>;
714
+ /**
715
+ * Start a direct launch-video upload session without a guided recording script. Returns an upload-only
716
+ * session (`mode: "upload"`) whose upload token accepts an MP4 or MOV video via the public upload routes
717
+ * and saves it to `consent.launchVideoUrl` through `completeLaunchRecording`.
718
+ * @async
719
+ * @roles api, admin, developer, billing, user
720
+ * @param {Object} params - The upload session
721
+ * @param {string} params.agentId - The agent ID
722
+ * @param {RequestOptions} [params.options] - Additional options for the request
723
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
724
+ */
725
+ startLaunchVideoUpload: ({ agentId, options }: {
726
+ agentId: string;
727
+ options?: RequestOptions;
728
+ }) => Promise<SdkResponse<any>>;
729
+ /**
730
+ * Read a launch-recording session: each step's state, the upload and, once accepted, the video URL.
731
+ * 404 when the session is unknown, cancelled or expired.
732
+ * @async
733
+ * @roles api, admin, developer, billing, user
734
+ * @param {Object} params - The read
735
+ * @param {string} params.agentId - The agent ID
736
+ * @param {string} params.sessionId - The session ID
737
+ * @param {RequestOptions} [params.options] - Additional options for the request
738
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
739
+ */
740
+ getLaunchRecording: ({ agentId, sessionId, options }: {
741
+ agentId: string;
742
+ sessionId: string;
743
+ options?: RequestOptions;
744
+ }) => Promise<SdkResponse<any>>;
745
+ /**
746
+ * Send one scripted message of the session to the tester: the opt-in confirmation or a sample.
747
+ * 409 when that step was already sent.
748
+ * @async
749
+ * @roles api, admin, developer, billing, user
750
+ * @param {Object} params - The send
751
+ * @param {string} params.agentId - The agent ID
752
+ * @param {string} params.sessionId - The session ID
753
+ * @param {string} params.step - The step key: `CONFIRMATION` or `SAMPLE_<index>`
754
+ * @param {RequestOptions} [params.options] - Additional options for the request
755
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }`
756
+ */
757
+ sendLaunchRecordingStep: ({ agentId, sessionId, step, options }: {
758
+ agentId: string;
759
+ sessionId: string;
760
+ step: string;
761
+ options?: RequestOptions;
762
+ }) => Promise<SdkResponse<any>>;
763
+ /**
764
+ * Accept the session's uploaded video as the agent's launch video (`consent.launchVideoUrl`).
765
+ * 409 with `details.missing` while a step is not done or no verified upload exists, and 409 `MEDIA_CHANGED` when
766
+ * the stored file changed after its check; upload it again.
767
+ * @async
768
+ * @roles api, admin, developer, billing, user
769
+ * @param {Object} params - The completion
770
+ * @param {string} params.agentId - The agent ID
771
+ * @param {string} params.sessionId - The session ID
772
+ * @param {RequestOptions} [params.options] - Additional options for the request
773
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ session }` with status COMPLETED
774
+ */
775
+ completeLaunchRecording: ({ agentId, sessionId, options }: {
776
+ agentId: string;
777
+ sessionId: string;
778
+ options?: RequestOptions;
779
+ }) => Promise<SdkResponse<any>>;
780
+ /**
781
+ * Cancel a launch-recording session.
782
+ * @async
783
+ * @roles api, admin, developer, billing, user
784
+ * @param {Object} params - The cancellation
785
+ * @param {string} params.agentId - The agent ID
786
+ * @param {string} params.sessionId - The session ID
787
+ * @param {RequestOptions} [params.options] - Additional options for the request
788
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ cancelled: true }`
789
+ */
790
+ cancelLaunchRecording: ({ agentId, sessionId, options }: {
791
+ agentId: string;
792
+ sessionId: string;
793
+ options?: RequestOptions;
794
+ }) => Promise<SdkResponse<any>>;
795
+ /**
796
+ * Read the upload page's details by its token. With `contentType`, also returns a signed form (`upload.url`,
797
+ * `upload.fields`) to post the video straight to storage: every field first, the file last in `file`.
798
+ * @async
799
+ * @roles public
800
+ * @param {Object} params - The read
801
+ * @param {string} params.token - The upload token from the session's `upload.token`
802
+ * @param {("video/mp4"|"video/quicktime")} [params.contentType] - The file's type; asks for the signed form
803
+ * @param {RequestOptions} [params.options] - Additional options for the request
804
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ agentName, state, expiresAt, maxBytes, acceptedTypes, upload? }`
805
+ */
806
+ getLaunchRecordingUpload: ({ token, contentType, options }: {
807
+ token: string;
808
+ contentType?: ("video/mp4" | "video/quicktime");
809
+ options?: RequestOptions;
810
+ }) => Promise<SdkResponse<any>>;
811
+ /**
812
+ * Tell the API the video was posted to storage, so it checks the stored file. 400 with a plain reason when
813
+ * nothing was stored, the file is too large or it is not an accepted video.
814
+ * @async
815
+ * @roles public
816
+ * @param {Object} params - The completion
817
+ * @param {string} params.token - The upload token
818
+ * @param {RequestOptions} [params.options] - Additional options for the request
819
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ state, videoUrl, bytes, mimeType }`
820
+ */
821
+ completeLaunchRecordingUpload: ({ token, options }: {
822
+ token: string;
823
+ options?: RequestOptions;
824
+ }) => Promise<SdkResponse<any>>;
825
+ };
650
826
  }
651
827
  export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
652
828
  export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
@@ -363,15 +363,18 @@ export class Registrations {
363
363
  * @param {string} params.subgroupId - Subgroup that will own the registration and any allocated numbers
364
364
  * @param {string[]} params.capabilities - One of the type's bundles, e.g. ["SMS"] or ["SMS", "VOICE"]
365
365
  * @param {Object} params.data - The type's submission fields
366
+ * @param {string} [params.complianceScanId] - Optional id of the website compliance scan run before submitting (at
367
+ * most 64 characters). Stored for Signal House registration analytics and never sent to a provider; sent only when set
366
368
  * @param {RequestOptions} [params.options] - Additional options for the request
367
369
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the created registration
368
370
  */
369
- createRegistration({ region, type, subgroupId, capabilities, data, options }: {
371
+ createRegistration({ region, type, subgroupId, capabilities, data, complianceScanId, options }: {
370
372
  region: string;
371
373
  type: string;
372
374
  subgroupId: string;
373
375
  capabilities: string[];
374
376
  data: any;
377
+ complianceScanId?: string;
375
378
  options?: RequestOptions;
376
379
  }): Promise<SdkResponse<any>>;
377
380
  }
@@ -67,10 +67,14 @@ export class Users {
67
67
  * @param {string} [params.search] - Search users by email (case-insensitive)
68
68
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
69
69
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
70
+ * @param {string|Array<string>} [params.groupIds] - Only users whose active group is one of these group IDs
71
+ * @param {string|Array<string>} [params.subgroupIds] - Only users whose active group is the parent group of one of these subgroup IDs
72
+ * @param {string|Array<string>} [params.status] - Only users with one of these statuses (active, inactive)
73
+ * groupIds, subgroupIds and status cannot be combined with email; the API rejects that with a 400.
70
74
  * @param {RequestOptions} [params.options] - Additional options for the request
71
75
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
72
76
  */
73
- getUsers: ({ email, userType, page, limit, search, sortBy, sortOrder, options }: {
77
+ getUsers: ({ email, userType, page, limit, search, sortBy, sortOrder, groupIds, subgroupIds, status, options }: {
74
78
  email?: string;
75
79
  userType?: string;
76
80
  page?: number;
@@ -78,8 +82,35 @@ export class Users {
78
82
  search?: string;
79
83
  sortBy?: string;
80
84
  sortOrder?: string;
85
+ groupIds?: string | Array<string>;
86
+ subgroupIds?: string | Array<string>;
87
+ status?: string | Array<string>;
81
88
  options?: RequestOptions;
82
89
  }) => Promise<SdkResponse<any>>;
90
+ /**
91
+ * Get the group and subgroup options for the admin users list filters, bounded and searchable.
92
+ * @roles signalhouse
93
+ * @param {Object} [params] - The parameters for getting the filter options
94
+ * @param {string} [params.search] - 3 to 100 characters matched against group and subgroup IDs and names
95
+ * @param {number} [params.limit] - Maximum options of each kind (1 to 100, default 25)
96
+ * @param {RequestOptions} [params.options] - Additional options for the request
97
+ * @returns {Promise<SdkResponse<{groups: Array<{groupId: string, groupName: string}>, subgroups: Array<{subgroupId: string, subgroupName: string, groupId: string}>}>>} - A promise that resolves to the filter options
98
+ */
99
+ getUserFilterOptions: ({ search, limit, options }?: {
100
+ search?: string;
101
+ limit?: number;
102
+ options?: RequestOptions;
103
+ }) => Promise<SdkResponse<{
104
+ groups: Array<{
105
+ groupId: string;
106
+ groupName: string;
107
+ }>;
108
+ subgroups: Array<{
109
+ subgroupId: string;
110
+ subgroupName: string;
111
+ groupId: string;
112
+ }>;
113
+ }>>;
83
114
  /**
84
115
  * Create a new internal user (admin or service user) with the specified data.
85
116
  * @roles signalhouse
@@ -106,10 +137,13 @@ export class Users {
106
137
  * @param {string} [params.search] - Search users by email (case-insensitive)
107
138
  * @param {string} [params.sortBy] - Field to sort by (createdAt, email, activeGroupId, companyName, status, _id)
108
139
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
140
+ * @param {string|Array<string>} [params.groupIds] - Staff-only, without id or groupId (the API rejects that with a 400): only users whose active group is one of these group IDs
141
+ * @param {string|Array<string>} [params.subgroupIds] - Staff-only, without id or groupId: only users whose active group is the parent group of one of these subgroup IDs
142
+ * @param {string|Array<string>} [params.status] - Staff-only, without id or groupId: only users with one of these statuses (active, inactive)
109
143
  * @param {RequestOptions} [params.options] - Additional options for the request
110
144
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of users
111
145
  */
112
- getUsers({ id, groupId, userType, page, limit, search, sortBy, sortOrder, options }: {
146
+ getUsers({ id, groupId, userType, page, limit, search, sortBy, sortOrder, groupIds, subgroupIds, status, options }: {
113
147
  id?: string;
114
148
  groupId?: string;
115
149
  userType?: string;
@@ -118,6 +152,9 @@ export class Users {
118
152
  search?: string;
119
153
  sortBy?: string;
120
154
  sortOrder?: string;
155
+ groupIds?: string | Array<string>;
156
+ subgroupIds?: string | Array<string>;
157
+ status?: string | Array<string>;
121
158
  options?: RequestOptions;
122
159
  }): Promise<SdkResponse<any>>;
123
160
  /**