@signalhouse-sms/sdk 1.5.1 → 1.6.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
@@ -51,7 +51,7 @@ Integrated Axios with standardized returns
51
51
  Lightweight and tree-shakeable
52
52
 
53
53
  Documentation
54
- For full API reference and advanced usage, visit https://v2.signalhouse.io
54
+ For full API reference and advanced usage, visit https://app2.signalhouse.io/docs
55
55
 
56
56
  License
57
57
  ISC © Signal House
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhouse-sms/sdk",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -91,6 +91,22 @@
91
91
  * @property {string} updatedAt - Last-update timestamp.
92
92
  */
93
93
 
94
+ /**
95
+ * A paused agent conversation: a person took over the conversation between an agent's number and
96
+ * one contact, so the agent does not answer that contact on that number until someone resumes it. As returned
97
+ * by the server.
98
+ * @typedef {Object} AgentContactPause
99
+ * @property {string} groupId - The group that owns the agent's number.
100
+ * @property {string|null} subgroupId - The number's subgroup.
101
+ * @property {string} channel - The channel; "sms".
102
+ * @property {string} endpointValue - The agent's number: digits only, country code included, no "+".
103
+ * @property {string} contactIdentifier - The contact's number: digits only, country code included, no "+".
104
+ * @property {string} reason - Why it was paused: "human_reply" (a person replied by hand), "escalation" (the agent asked for a person) or "manual".
105
+ * @property {string|null} pausedBy - The user who paused it, when known.
106
+ * @property {string} createdAt - When the conversation was paused.
107
+ * @property {string} updatedAt - Last-update timestamp.
108
+ */
109
+
94
110
  /**
95
111
  * A reply an SMS agent wrote but did not send, held for a person to approve or reject (the
96
112
  * Pending Replies queue), as returned by the server.
@@ -106,7 +122,7 @@
106
122
  * @property {string} inboundText - The contact message the agent was answering.
107
123
  * @property {string} draftText - The reply as the agent wrote it.
108
124
  * @property {string|null} sentText - The text actually sent; differs from draftText when edited.
109
- * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "guardrail".
125
+ * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
110
126
  * @property {string} status - "pending", "sending", "sent", "rejected" or "failed" (the send path accepted nothing, e.g. the contact opted out).
111
127
  * @property {string|null} decidedBy - The user who approved or rejected it.
112
128
  * @property {string|null} decidedAt - When it was approved or rejected.
@@ -586,6 +602,70 @@ export class Agents {
586
602
  return this.client(`/agent/endpoints/${safeChannel}/${safeEndpointValue}`, { method: "DELETE", ...options });
587
603
  }
588
604
 
605
+ /**
606
+ * List paused agent conversations in a group, newest first. A paused conversation is one a person took
607
+ * over; the agent stays out of it until it is resumed.
608
+ * @async
609
+ * @roles api, admin, developer, billing, user
610
+ * @param {Object} params - The parameters for listing paused conversations.
611
+ * @param {string} params.groupId - The group whose paused conversations to list (required).
612
+ * @param {string} [params.subgroupId] - Narrow to one subgroup.
613
+ * @param {string} [params.channel] - Narrow to one channel ("sms").
614
+ * @param {string} [params.endpointValue] - Narrow to one agent number (digits only, no "+").
615
+ * @param {string} [params.contactIdentifier] - Narrow to one contact number (digits only, no "+").
616
+ * @param {RequestOptions} [params.options] - Additional options for the request.
617
+ * @throws {Error} Throws an error if the groupId parameter is missing.
618
+ * @returns {Promise<SdkResponse<AgentContactPause[]>>} - The paused conversations returned from the server.
619
+ */
620
+ async getAgentContactPauses({ groupId, subgroupId, channel, endpointValue, contactIdentifier, options = {} }) {
621
+ this.client._require({ groupId });
622
+ const queryString = this.client._getQueryString({ groupId, subgroupId, channel, endpointValue, contactIdentifier });
623
+ return this.client(`/agent/pauses${queryString}`, { method: "GET", ...options });
624
+ }
625
+
626
+ /**
627
+ * Pause an agent on one conversation (its number + one contact). The agent stops answering that contact
628
+ * on that number until the conversation is resumed; there is no timer. The conversation's pending
629
+ * replies are rejected. Pausing a paused conversation keeps the original pause.
630
+ * @async
631
+ * @roles api, admin, developer, billing, user
632
+ * @param {Object} params - The parameters for the pause.
633
+ * @param {string} params.channel - The channel; must be "sms".
634
+ * @param {string} params.endpointValue - The agent's number: 10 to 15 digits, country code included, no "+".
635
+ * @param {string} params.contactIdentifier - The contact's number: 10 to 15 digits, country code included, no "+".
636
+ * @param {Object} [params.pauseData] - `{ reason? }`: "human_reply" or "manual" (the default).
637
+ * @param {RequestOptions} [params.options] - Additional options for the request.
638
+ * @throws {Error} Throws an error if channel, endpointValue, or contactIdentifier is missing.
639
+ * @returns {Promise<SdkResponse<AgentContactPause>>} - The pause returned from the server.
640
+ */
641
+ async pauseAgentConversation({ channel, endpointValue, contactIdentifier, pauseData = {}, options = {} }) {
642
+ this.client._require({ channel, endpointValue, contactIdentifier });
643
+ const safeChannel = encodeURIComponent(channel);
644
+ const safeEndpointValue = encodeURIComponent(endpointValue);
645
+ const safeContactIdentifier = encodeURIComponent(contactIdentifier);
646
+ return this.client(`/agent/pauses/${safeChannel}/${safeEndpointValue}/${safeContactIdentifier}`, { method: "PUT", body: pauseData, ...options });
647
+ }
648
+
649
+ /**
650
+ * Resume an agent on a paused conversation, so it answers the contact's next text again.
651
+ * @async
652
+ * @roles api, admin, developer, billing, user
653
+ * @param {Object} params - The parameters for the resume.
654
+ * @param {string} params.channel - The channel; must be "sms".
655
+ * @param {string} params.endpointValue - The agent's number: 10 to 15 digits, country code included, no "+".
656
+ * @param {string} params.contactIdentifier - The contact's number: 10 to 15 digits, country code included, no "+".
657
+ * @param {RequestOptions} [params.options] - Additional options for the request.
658
+ * @throws {Error} Throws an error if channel, endpointValue, or contactIdentifier is missing.
659
+ * @returns {Promise<SdkResponse<AgentContactPause>>} - The removed pause returned from the server.
660
+ */
661
+ async resumeAgentConversation({ channel, endpointValue, contactIdentifier, options = {} }) {
662
+ this.client._require({ channel, endpointValue, contactIdentifier });
663
+ const safeChannel = encodeURIComponent(channel);
664
+ const safeEndpointValue = encodeURIComponent(endpointValue);
665
+ const safeContactIdentifier = encodeURIComponent(contactIdentifier);
666
+ return this.client(`/agent/pauses/${safeChannel}/${safeEndpointValue}/${safeContactIdentifier}`, { method: "DELETE", ...options });
667
+ }
668
+
589
669
  /**
590
670
  * List held agent replies (the Pending Replies queue) in a group, newest first.
591
671
  * @async
@@ -70,14 +70,15 @@
70
70
 
71
71
  /**
72
72
  * @typedef {Object} TollFreeBrandDetails
73
- * @property {string} businessRegistrationType - The business registration type (required, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
73
+ * @property {string} [businessRegistrationType] - The business registration type (required unless businessVerificationId is sent, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
74
74
  * @property {string} legalEntityType - The legal entity type (required, one of PRIVATE_COMPANY, PUBLIC_COMPANY, NON_PROFIT, GOVERNMENT, SOLE_PROPRIETOR)
75
- * @property {string} taxId - The business tax identifier (required, at most 50 characters)
76
- * @property {string} countryCode - The business country code (required, 2-letter ISO code)
75
+ * @property {string} [taxId] - The business tax identifier (required unless businessVerificationId is sent, at most 50 characters)
76
+ * @property {string} [countryCode] - The business country code (required unless businessVerificationId is sent, 2-letter ISO code)
77
77
  * @property {string} supportPhone - The customer-support phone number (required, E.164 with an optional leading "+" and no spaces, parentheses or hyphens, e.g. "17025550100")
78
78
  * @property {string} [taxIdIssuingCountry] - The country that issued the tax ID (optional, 2-letter ISO code)
79
79
  * @property {string} [businessDBA] - The business "doing business as" name (optional, at most 255 characters)
80
80
  * @property {string} [businessWebsite] - The customer's real website, sent to Infobip for brand verification (optional, valid URL, at most 255 characters; distinct from the top-level website / landing URL)
81
+ * @property {string} [businessVerificationId] - The ID of the business verification the brand uses (starts with BV). Required for a group whose toll-free brands need a business verification, and must name a VERIFIED one of the brand's group (in a group that verifies each subgroup's business separately, of the brand's subgroup); refused (400) for any other group. Set at creation only: it can't be changed
81
82
  */
82
83
 
83
84
  /**
@@ -103,6 +104,18 @@
103
104
  * @property {string} representative.jobLevel - The representative's job level (required, one of DIRECTOR, GM, VP, CEO, CFO, GENERAL_COUNSEL, OTHER)
104
105
  */
105
106
 
107
+ /**
108
+ * @typedef {Object} BusinessVerification
109
+ * @property {string} businessVerificationId - The business verification's ID (starts with BV)
110
+ * @property {string} groupId - The group it belongs to
111
+ * @property {string} [subgroupId] - The subgroup whose business it verifies; present only in a group that verifies each subgroup's business separately
112
+ * @property {string} status - SUBMITTING, IN_REVIEW, VERIFIED or NEEDS_CHANGES
113
+ * @property {BusinessVerificationDetails} details - The submitted details
114
+ * @property {string} submittedAt - When it was last submitted (ISO date)
115
+ * @property {string|null} reviewedAt - When it was last reviewed (ISO date), or null
116
+ * @property {string|null} rejectionReason - Why it needs changes, or null
117
+ */
118
+
106
119
  /**
107
120
  * @typedef {Object} TollFreeIsvAccount
108
121
  * @property {string} groupId - The group the account is registered to
@@ -114,17 +127,20 @@
114
127
  */
115
128
 
116
129
  /**
130
+ * Toll-free brand data. When tollFree.businessVerificationId is sent, the legal fields (companyName, street, city, state,
131
+ * postalCode, country, firstName, lastName and tollFree's businessRegistrationType, taxId, countryCode and
132
+ * taxIdIssuingCountry) are optional: the business verification's values replace any that are sent.
117
133
  * @typedef {Object} CreateTollFreeBrandData
118
134
  * @property {string} subgroupId - The ID of the subgroup to create the brand under (required, exactly 8 characters)
119
135
  * @property {string} displayName - The display name for the brand (required, at most 255 characters)
120
- * @property {string} companyName - The company name for the brand (required, at most 255 characters)
121
- * @property {string} street - The street address of the primary contact for the brand (required, at most 255 characters)
122
- * @property {string} city - The city of the primary contact for the brand (required, at most 100 characters)
123
- * @property {string} state - The state of the primary contact for the brand (required, at most 20 characters; must be a valid 2-letter US state code when country is "US")
124
- * @property {string} postalCode - The postal code of the primary contact for the brand (required, at most 10 characters)
136
+ * @property {string} [companyName] - The company name for the brand (required unless tollFree.businessVerificationId is sent, at most 255 characters)
137
+ * @property {string} [street] - The street address of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 255 characters)
138
+ * @property {string} [city] - The city of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
139
+ * @property {string} [state] - The state of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 20 characters; must be a valid 2-letter US state code when country is "US")
140
+ * @property {string} [postalCode] - The postal code of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 10 characters)
125
141
  * @property {string} email - The email address of the primary contact for the brand (required, valid email, at most 100 characters)
126
- * @property {string} firstName - The first name of the primary contact for the brand (required, at most 100 characters)
127
- * @property {string} lastName - The last name of the primary contact for the brand (required, at most 100 characters)
142
+ * @property {string} [firstName] - The first name of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
143
+ * @property {string} [lastName] - The last name of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
128
144
  * @property {string} website - The website URL for the brand (required, valid URL, at most 255 characters)
129
145
  * @property {TollFreeBrandDetails} tollFree - The Toll-Free brand details (required)
130
146
  * @property {string} [referenceId] - A unique reference for the brand (optional, at most 50 characters)
@@ -187,7 +203,7 @@ export class Brands {
187
203
  * @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
188
204
  * @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
189
205
  * @param {RequestOptions} [params.options] - Additional options for the request
190
- * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, usesBusinessVerification?: boolean, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.usesBusinessVerification` (whether it waits on the business verification that applies to its subgroup). The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit.
206
+ * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, usesBusinessVerification?: boolean, businessVerificationId?: string|null, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages), `tollFree.usesBusinessVerification` (whether it waits on its own business verification) and `tollFree.businessVerificationId` (the ID of the business verification it uses, or null when it uses none). The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit. Each brand carries `carrierSuspensions` (carrier brand suspension rules; active while liftedAt is null).
191
207
  */
192
208
  async getBrands({
193
209
  id,
@@ -285,47 +301,81 @@ export class Brands {
285
301
  }
286
302
 
287
303
  /**
288
- * Get a group's business verification: whether its toll-free brands need one, its status and the submitted details.
289
- * Some groups verify each subgroup's business separately: a platform whose subgroups are separate businesses, set up by
290
- * Signal House. For those groups pass the subgroup whose business verification to get.
304
+ * List a group's business verifications, newest first, and whether its toll-free brands need one. Some groups verify
305
+ * each subgroup's business separately: a platform whose subgroups are separate businesses, set up by Signal House. For
306
+ * those groups pass the subgroup whose business verifications to list.
291
307
  * @async
292
308
  * @roles api, admin, developer, billing, user
293
- * @param {Object} params - The parameters for getting the business verification
294
- * @param {string} params.groupId - The ID of the group whose business verification to get
295
- * @param {string} [params.subgroupId] - The subgroup whose business verification to get, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored
309
+ * @param {Object} params - The parameters for listing the business verifications
310
+ * @param {string} params.groupId - The ID of the group whose business verifications to list
311
+ * @param {string} [params.subgroupId] - The subgroup whose business verifications to list, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored
296
312
  * @param {RequestOptions} [params.options] - Additional options for the request
297
313
  * @throws {Error} Throws an error if the groupId parameter is missing
298
- * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} The business verification. `subgroupId` is present only when it belongs to one subgroup: the subgroup whose business it describes. `required` says whether the group's new toll-free brands need one; `status` is NOT_STARTED, SUBMITTING, IN_REVIEW, VERIFIED or NEEDS_CHANGES; `rejectionReason` says why it needs changes, or is null. When `required` is true and `status` is NOT_STARTED, submit it before creating the first toll-free brand it covers. The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, and 404 when the subgroup is not in the group.
314
+ * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, businessVerifications: Array<BusinessVerification> }>>} The business verifications, newest first. `subgroupId` is present only when they belong to one subgroup. `required` says whether the group's new toll-free brands need a business verification: each one names a VERIFIED business verification as `tollFree.businessVerificationId`. The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, and 404 when the subgroup is not in the group.
299
315
  */
300
- async getBusinessVerification({ groupId, subgroupId, options = {} }) {
316
+ async getBusinessVerifications({ groupId, subgroupId, options = {} }) {
301
317
  this.client._require({ groupId });
302
318
  const queryString = this.client._getQueryString({ subgroupId });
303
319
  return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'GET', ...options });
304
320
  }
305
321
 
306
322
  /**
307
- * Submit or update a group's business verification, or one subgroup's in a group that verifies each subgroup's business
308
- * separately. Allowed when it is not started or needs changes. Review usually takes 1–2 business days; the toll-free
309
- * brands it covers stay pending until it is verified.
323
+ * Get one of a group's business verifications by its ID.
310
324
  * @async
311
325
  * @roles api, admin, developer, billing, user
312
- * @param {Object} params - The parameters for submitting the business verification
313
- * @param {string} params.groupId - The ID of the group whose business verification to submit (must be the caller's active group)
314
- * @param {string} [params.subgroupId] - The subgroup whose business verification to submit, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored. The subgroup must be active
326
+ * @param {Object} params - The parameters for getting the business verification
327
+ * @param {string} params.groupId - The ID of the group the business verification belongs to
328
+ * @param {string} params.businessVerificationId - The ID of the business verification to get (starts with BV)
329
+ * @param {RequestOptions} [params.options] - Additional options for the request
330
+ * @throws {Error} Throws an error if the groupId or businessVerificationId parameter is missing
331
+ * @returns {Promise<SdkResponse<BusinessVerification & { required: boolean }>>} The business verification, plus `required` (whether the group's new toll-free brands need one). The API returns 404 when it isn't one of the group's.
332
+ */
333
+ async getBusinessVerification({ groupId, businessVerificationId, options = {} }) {
334
+ this.client._require({ groupId, businessVerificationId });
335
+ return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}/${encodeURIComponent(businessVerificationId)}`, { method: 'GET', ...options });
336
+ }
337
+
338
+ /**
339
+ * Create and submit a new business verification for a group, or for one subgroup in a group that verifies each
340
+ * subgroup's business separately. Review usually takes 1–2 business days; once it is VERIFIED, new toll-free brands
341
+ * can use it by naming it as `tollFree.businessVerificationId`.
342
+ * @async
343
+ * @roles api, admin, developer, billing, user
344
+ * @param {Object} params - The parameters for creating the business verification
345
+ * @param {string} params.groupId - The ID of the group the business verification is for (must be the caller's active group)
346
+ * @param {string} [params.subgroupId] - The subgroup whose business it verifies, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored. The subgroup must be active
315
347
  * @param {BusinessVerificationDetails} params.details - The business verification details (see BusinessVerificationDetails typedef for details)
316
348
  * @param {RequestOptions} [params.options] - Additional options for the request
317
349
  * @throws {Error} Throws an error if the groupId or details parameter is missing
318
- * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} A 202 with the business verification, now SUBMITTING (the same shape as getBusinessVerification, with `subgroupId` only when it belongs to one subgroup). The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, or when the subgroup is inactive, and 404 when the subgroup is not in the group.
350
+ * @returns {Promise<SdkResponse<BusinessVerification>>} A 202 with the new business verification, now SUBMITTING. The API returns 400 when the group's toll-free brands don't need a business verification, when the group verifies each subgroup's business separately and no subgroupId is given, or when the subgroup is inactive, and 404 when the subgroup is not in the group.
319
351
  */
320
- async submitBusinessVerification({ groupId, subgroupId, details, options = {} }) {
352
+ async createBusinessVerification({ groupId, subgroupId, details, options = {} }) {
321
353
  this.client._require({ groupId, details });
322
354
  const queryString = this.client._getQueryString({ subgroupId });
323
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'PUT', body: details, ...options });
355
+ return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'POST', body: details, ...options });
356
+ }
357
+
358
+ /**
359
+ * Correct and resubmit a business verification that needs changes. Allowed only while its status is NEEDS_CHANGES.
360
+ * Review usually takes 1–2 business days; the toll-free brands that use it stay pending until it is verified.
361
+ * @async
362
+ * @roles api, admin, developer, billing, user
363
+ * @param {Object} params - The parameters for updating the business verification
364
+ * @param {string} params.groupId - The ID of the group the business verification belongs to (must be the caller's active group)
365
+ * @param {string} params.businessVerificationId - The ID of the business verification to update (starts with BV)
366
+ * @param {BusinessVerificationDetails} params.details - The corrected business verification details (see BusinessVerificationDetails typedef for details)
367
+ * @param {RequestOptions} [params.options] - Additional options for the request
368
+ * @throws {Error} Throws an error if the groupId, businessVerificationId or details parameter is missing
369
+ * @returns {Promise<SdkResponse<BusinessVerification>>} A 202 with the business verification, now SUBMITTING. The API returns 400 when it doesn't need changes, and 404 when it isn't one of the group's.
370
+ */
371
+ async updateBusinessVerification({ groupId, businessVerificationId, details, options = {} }) {
372
+ this.client._require({ groupId, businessVerificationId, details });
373
+ return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}/${encodeURIComponent(businessVerificationId)}`, { method: 'PUT', body: details, ...options });
324
374
  }
325
375
 
326
376
  /**
327
377
  * Get a group's toll-free ISV account: the group's own top-level account at the toll-free provider, used when its
328
- * subgroups are separate businesses. Each subgroup gets an account and a business verification of its own under it.
378
+ * subgroups are separate businesses. Each subgroup gets an account and business verifications of its own under it.
329
379
  * Staff only.
330
380
  * @async
331
381
  * @roles signalhouse_api, signalhouse_admin, signalhouse_user
@@ -358,6 +358,13 @@ export class Campaigns {
358
358
  * in the window; the volumes say how much traffic sits behind it. A campaign's figure is scored from the
359
359
  * campaign's own summed counters, never averaged from its numbers. For a live figure use GET /number/health
360
360
  * or GET /campaign/health.
361
+ *
362
+ * Every record also carries a `carrierSuspensions` array -- one entry per carrier suspension of the
363
+ * campaign: `{ mnoId, mnoName, source, suspensionCategory, reason, tcrEventType, suspendedAt, liftedAt }`.
364
+ * An entry is active while `liftedAt` is null. `mnoId` is the TCR carrier network id (same ids as `mnoIds`);
365
+ * `source` is CARRIER, UPSTREAM or BRAND (the carrier suspended the whole brand). A suspension applies to one
366
+ * carrier, so `status` stays ACTIVE. Subscribe to the CAMPAIGN_SUSPENDED / CAMPAIGN_UNSUSPENDED webhook events
367
+ * to be told when an entry opens or is lifted.
361
368
  * @returns {Promise<SdkResponse<Array|Object>>} The response from the server - array when unpaginated, or { data, total, page, limit, totalPages } when paginated
362
369
  */
363
370
  async getCampaigns({
@@ -41,14 +41,17 @@ export class Numbers {
41
41
  * @roles signalhouse
42
42
  * @param {Object} params - The parameters for approving the request
43
43
  * @param {string} params.portingId - The _id of the port-in request
44
+ * @param {string} [params.subGroupId] - Subgroup to assign when the request has none yet.
45
+ * Ignored if the request already has a subGroupId -- an existing assignment is never overwritten.
44
46
  * @param {RequestOptions} [params.options] - Additional options for the request
45
47
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated port-in request
46
48
  */
47
- approvePortRequest: async ({ portingId, options = {} }) => {
49
+ approvePortRequest: async ({ portingId, subGroupId, options = {} }) => {
48
50
  this.client._require({ portingId });
49
51
  const safeId = encodeURIComponent(portingId);
50
52
  return this.client(`/number/portin/${safeId}/approve`, {
51
53
  method: 'POST',
54
+ body: { subGroupId },
52
55
  ...options,
53
56
  });
54
57
  },
@@ -83,6 +83,21 @@
83
83
  * @property {string} createdAt - Creation timestamp.
84
84
  * @property {string} updatedAt - Last-update timestamp.
85
85
  */
86
+ /**
87
+ * A paused agent conversation: a person took over the conversation between an agent's number and
88
+ * one contact, so the agent does not answer that contact on that number until someone resumes it. As returned
89
+ * by the server.
90
+ * @typedef {Object} AgentContactPause
91
+ * @property {string} groupId - The group that owns the agent's number.
92
+ * @property {string|null} subgroupId - The number's subgroup.
93
+ * @property {string} channel - The channel; "sms".
94
+ * @property {string} endpointValue - The agent's number: digits only, country code included, no "+".
95
+ * @property {string} contactIdentifier - The contact's number: digits only, country code included, no "+".
96
+ * @property {string} reason - Why it was paused: "human_reply" (a person replied by hand), "escalation" (the agent asked for a person) or "manual".
97
+ * @property {string|null} pausedBy - The user who paused it, when known.
98
+ * @property {string} createdAt - When the conversation was paused.
99
+ * @property {string} updatedAt - Last-update timestamp.
100
+ */
86
101
  /**
87
102
  * A reply an SMS agent wrote but did not send, held for a person to approve or reject (the
88
103
  * Pending Replies queue), as returned by the server.
@@ -98,7 +113,7 @@
98
113
  * @property {string} inboundText - The contact message the agent was answering.
99
114
  * @property {string} draftText - The reply as the agent wrote it.
100
115
  * @property {string|null} sentText - The text actually sent; differs from draftText when edited.
101
- * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "guardrail".
116
+ * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
102
117
  * @property {string} status - "pending", "sending", "sent", "rejected" or "failed" (the send path accepted nothing, e.g. the contact opted out).
103
118
  * @property {string|null} decidedBy - The user who approved or rejected it.
104
119
  * @property {string|null} decidedAt - When it was approved or rejected.
@@ -546,6 +561,69 @@ export class Agents {
546
561
  endpointValue: string;
547
562
  options?: RequestOptions;
548
563
  }): Promise<SdkResponse<AgentEndpoint>>;
564
+ /**
565
+ * List paused agent conversations in a group, newest first. A paused conversation is one a person took
566
+ * over; the agent stays out of it until it is resumed.
567
+ * @async
568
+ * @roles api, admin, developer, billing, user
569
+ * @param {Object} params - The parameters for listing paused conversations.
570
+ * @param {string} params.groupId - The group whose paused conversations to list (required).
571
+ * @param {string} [params.subgroupId] - Narrow to one subgroup.
572
+ * @param {string} [params.channel] - Narrow to one channel ("sms").
573
+ * @param {string} [params.endpointValue] - Narrow to one agent number (digits only, no "+").
574
+ * @param {string} [params.contactIdentifier] - Narrow to one contact number (digits only, no "+").
575
+ * @param {RequestOptions} [params.options] - Additional options for the request.
576
+ * @throws {Error} Throws an error if the groupId parameter is missing.
577
+ * @returns {Promise<SdkResponse<AgentContactPause[]>>} - The paused conversations returned from the server.
578
+ */
579
+ getAgentContactPauses({ groupId, subgroupId, channel, endpointValue, contactIdentifier, options }: {
580
+ groupId: string;
581
+ subgroupId?: string;
582
+ channel?: string;
583
+ endpointValue?: string;
584
+ contactIdentifier?: string;
585
+ options?: RequestOptions;
586
+ }): Promise<SdkResponse<AgentContactPause[]>>;
587
+ /**
588
+ * Pause an agent on one conversation (its number + one contact). The agent stops answering that contact
589
+ * on that number until the conversation is resumed; there is no timer. The conversation's pending
590
+ * replies are rejected. Pausing a paused conversation keeps the original pause.
591
+ * @async
592
+ * @roles api, admin, developer, billing, user
593
+ * @param {Object} params - The parameters for the pause.
594
+ * @param {string} params.channel - The channel; must be "sms".
595
+ * @param {string} params.endpointValue - The agent's number: 10 to 15 digits, country code included, no "+".
596
+ * @param {string} params.contactIdentifier - The contact's number: 10 to 15 digits, country code included, no "+".
597
+ * @param {Object} [params.pauseData] - `{ reason? }`: "human_reply" or "manual" (the default).
598
+ * @param {RequestOptions} [params.options] - Additional options for the request.
599
+ * @throws {Error} Throws an error if channel, endpointValue, or contactIdentifier is missing.
600
+ * @returns {Promise<SdkResponse<AgentContactPause>>} - The pause returned from the server.
601
+ */
602
+ pauseAgentConversation({ channel, endpointValue, contactIdentifier, pauseData, options }: {
603
+ channel: string;
604
+ endpointValue: string;
605
+ contactIdentifier: string;
606
+ pauseData?: any;
607
+ options?: RequestOptions;
608
+ }): Promise<SdkResponse<AgentContactPause>>;
609
+ /**
610
+ * Resume an agent on a paused conversation, so it answers the contact's next text again.
611
+ * @async
612
+ * @roles api, admin, developer, billing, user
613
+ * @param {Object} params - The parameters for the resume.
614
+ * @param {string} params.channel - The channel; must be "sms".
615
+ * @param {string} params.endpointValue - The agent's number: 10 to 15 digits, country code included, no "+".
616
+ * @param {string} params.contactIdentifier - The contact's number: 10 to 15 digits, country code included, no "+".
617
+ * @param {RequestOptions} [params.options] - Additional options for the request.
618
+ * @throws {Error} Throws an error if channel, endpointValue, or contactIdentifier is missing.
619
+ * @returns {Promise<SdkResponse<AgentContactPause>>} - The removed pause returned from the server.
620
+ */
621
+ resumeAgentConversation({ channel, endpointValue, contactIdentifier, options }: {
622
+ channel: string;
623
+ endpointValue: string;
624
+ contactIdentifier: string;
625
+ options?: RequestOptions;
626
+ }): Promise<SdkResponse<AgentContactPause>>;
549
627
  /**
550
628
  * List held agent replies (the Pending Replies queue) in a group, newest first.
551
629
  * @async
@@ -1172,6 +1250,49 @@ export type AgentEndpoint = {
1172
1250
  */
1173
1251
  updatedAt: string;
1174
1252
  };
1253
+ /**
1254
+ * A paused agent conversation: a person took over the conversation between an agent's number and
1255
+ * one contact, so the agent does not answer that contact on that number until someone resumes it. As returned
1256
+ * by the server.
1257
+ */
1258
+ export type AgentContactPause = {
1259
+ /**
1260
+ * - The group that owns the agent's number.
1261
+ */
1262
+ groupId: string;
1263
+ /**
1264
+ * - The number's subgroup.
1265
+ */
1266
+ subgroupId: string | null;
1267
+ /**
1268
+ * - The channel; "sms".
1269
+ */
1270
+ channel: string;
1271
+ /**
1272
+ * - The agent's number: digits only, country code included, no "+".
1273
+ */
1274
+ endpointValue: string;
1275
+ /**
1276
+ * - The contact's number: digits only, country code included, no "+".
1277
+ */
1278
+ contactIdentifier: string;
1279
+ /**
1280
+ * - Why it was paused: "human_reply" (a person replied by hand), "escalation" (the agent asked for a person) or "manual".
1281
+ */
1282
+ reason: string;
1283
+ /**
1284
+ * - The user who paused it, when known.
1285
+ */
1286
+ pausedBy: string | null;
1287
+ /**
1288
+ * - When the conversation was paused.
1289
+ */
1290
+ createdAt: string;
1291
+ /**
1292
+ * - Last-update timestamp.
1293
+ */
1294
+ updatedAt: string;
1295
+ };
1175
1296
  /**
1176
1297
  * A reply an SMS agent wrote but did not send, held for a person to approve or reject (the
1177
1298
  * Pending Replies queue), as returned by the server.
@@ -1222,7 +1343,7 @@ export type AgentReplyDraft = {
1222
1343
  */
1223
1344
  sentText: string | null;
1224
1345
  /**
1225
- * - Why it was held: "review_mode", "escalation", "fallback" or "guardrail".
1346
+ * - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
1226
1347
  */
1227
1348
  reason: string;
1228
1349
  /**
@@ -66,14 +66,15 @@
66
66
  */
67
67
  /**
68
68
  * @typedef {Object} TollFreeBrandDetails
69
- * @property {string} businessRegistrationType - The business registration type (required, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
69
+ * @property {string} [businessRegistrationType] - The business registration type (required unless businessVerificationId is sent, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
70
70
  * @property {string} legalEntityType - The legal entity type (required, one of PRIVATE_COMPANY, PUBLIC_COMPANY, NON_PROFIT, GOVERNMENT, SOLE_PROPRIETOR)
71
- * @property {string} taxId - The business tax identifier (required, at most 50 characters)
72
- * @property {string} countryCode - The business country code (required, 2-letter ISO code)
71
+ * @property {string} [taxId] - The business tax identifier (required unless businessVerificationId is sent, at most 50 characters)
72
+ * @property {string} [countryCode] - The business country code (required unless businessVerificationId is sent, 2-letter ISO code)
73
73
  * @property {string} supportPhone - The customer-support phone number (required, E.164 with an optional leading "+" and no spaces, parentheses or hyphens, e.g. "17025550100")
74
74
  * @property {string} [taxIdIssuingCountry] - The country that issued the tax ID (optional, 2-letter ISO code)
75
75
  * @property {string} [businessDBA] - The business "doing business as" name (optional, at most 255 characters)
76
76
  * @property {string} [businessWebsite] - The customer's real website, sent to Infobip for brand verification (optional, valid URL, at most 255 characters; distinct from the top-level website / landing URL)
77
+ * @property {string} [businessVerificationId] - The ID of the business verification the brand uses (starts with BV). Required for a group whose toll-free brands need a business verification, and must name a VERIFIED one of the brand's group (in a group that verifies each subgroup's business separately, of the brand's subgroup); refused (400) for any other group. Set at creation only: it can't be changed
77
78
  */
78
79
  /**
79
80
  * @typedef {Object} BusinessVerificationDetails
@@ -97,6 +98,17 @@
97
98
  * @property {string} representative.jobTitle - The representative's job title (required, at most 100 characters)
98
99
  * @property {string} representative.jobLevel - The representative's job level (required, one of DIRECTOR, GM, VP, CEO, CFO, GENERAL_COUNSEL, OTHER)
99
100
  */
101
+ /**
102
+ * @typedef {Object} BusinessVerification
103
+ * @property {string} businessVerificationId - The business verification's ID (starts with BV)
104
+ * @property {string} groupId - The group it belongs to
105
+ * @property {string} [subgroupId] - The subgroup whose business it verifies; present only in a group that verifies each subgroup's business separately
106
+ * @property {string} status - SUBMITTING, IN_REVIEW, VERIFIED or NEEDS_CHANGES
107
+ * @property {BusinessVerificationDetails} details - The submitted details
108
+ * @property {string} submittedAt - When it was last submitted (ISO date)
109
+ * @property {string|null} reviewedAt - When it was last reviewed (ISO date), or null
110
+ * @property {string|null} rejectionReason - Why it needs changes, or null
111
+ */
100
112
  /**
101
113
  * @typedef {Object} TollFreeIsvAccount
102
114
  * @property {string} groupId - The group the account is registered to
@@ -107,17 +119,20 @@
107
119
  * @property {string} updatedAt - When the account or its API key was last saved (ISO date)
108
120
  */
109
121
  /**
122
+ * Toll-free brand data. When tollFree.businessVerificationId is sent, the legal fields (companyName, street, city, state,
123
+ * postalCode, country, firstName, lastName and tollFree's businessRegistrationType, taxId, countryCode and
124
+ * taxIdIssuingCountry) are optional: the business verification's values replace any that are sent.
110
125
  * @typedef {Object} CreateTollFreeBrandData
111
126
  * @property {string} subgroupId - The ID of the subgroup to create the brand under (required, exactly 8 characters)
112
127
  * @property {string} displayName - The display name for the brand (required, at most 255 characters)
113
- * @property {string} companyName - The company name for the brand (required, at most 255 characters)
114
- * @property {string} street - The street address of the primary contact for the brand (required, at most 255 characters)
115
- * @property {string} city - The city of the primary contact for the brand (required, at most 100 characters)
116
- * @property {string} state - The state of the primary contact for the brand (required, at most 20 characters; must be a valid 2-letter US state code when country is "US")
117
- * @property {string} postalCode - The postal code of the primary contact for the brand (required, at most 10 characters)
128
+ * @property {string} [companyName] - The company name for the brand (required unless tollFree.businessVerificationId is sent, at most 255 characters)
129
+ * @property {string} [street] - The street address of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 255 characters)
130
+ * @property {string} [city] - The city of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
131
+ * @property {string} [state] - The state of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 20 characters; must be a valid 2-letter US state code when country is "US")
132
+ * @property {string} [postalCode] - The postal code of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 10 characters)
118
133
  * @property {string} email - The email address of the primary contact for the brand (required, valid email, at most 100 characters)
119
- * @property {string} firstName - The first name of the primary contact for the brand (required, at most 100 characters)
120
- * @property {string} lastName - The last name of the primary contact for the brand (required, at most 100 characters)
134
+ * @property {string} [firstName] - The first name of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
135
+ * @property {string} [lastName] - The last name of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
121
136
  * @property {string} website - The website URL for the brand (required, valid URL, at most 255 characters)
122
137
  * @property {TollFreeBrandDetails} tollFree - The Toll-Free brand details (required)
123
138
  * @property {string} [referenceId] - A unique reference for the brand (optional, at most 50 characters)
@@ -176,7 +191,7 @@ export class Brands {
176
191
  * @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
177
192
  * @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
178
193
  * @param {RequestOptions} [params.options] - Additional options for the request
179
- * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, usesBusinessVerification?: boolean, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.usesBusinessVerification` (whether it waits on the business verification that applies to its subgroup). The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit.
194
+ * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, usesBusinessVerification?: boolean, businessVerificationId?: string|null, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages), `tollFree.usesBusinessVerification` (whether it waits on its own business verification) and `tollFree.businessVerificationId` (the ID of the business verification it uses, or null when it uses none). The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit. Each brand carries `carrierSuspensions` (carrier brand suspension rules; active while liftedAt is null).
180
195
  */
181
196
  getBrands({ id, subgroupId, groupId, page, limit, status, registrationType, currentTollFreeCarrier, search, sortBy, sortOrder, entityType, ein, email, referenceId, groupIds, createdFrom, createdTo, excludeDeleted, includeTotal, options, }: {
182
197
  id?: string;
@@ -215,6 +230,7 @@ export class Brands {
215
230
  labelsSamples?: boolean;
216
231
  supportsMms?: boolean;
217
232
  usesBusinessVerification?: boolean;
233
+ businessVerificationId?: string | null;
218
234
  [key: string]: any;
219
235
  };
220
236
  [key: string]: any;
@@ -268,19 +284,19 @@ export class Brands {
268
284
  options?: RequestOptions;
269
285
  }): Promise<SdkResponse<any>>;
270
286
  /**
271
- * Get a group's business verification: whether its toll-free brands need one, its status and the submitted details.
272
- * Some groups verify each subgroup's business separately: a platform whose subgroups are separate businesses, set up by
273
- * Signal House. For those groups pass the subgroup whose business verification to get.
287
+ * List a group's business verifications, newest first, and whether its toll-free brands need one. Some groups verify
288
+ * each subgroup's business separately: a platform whose subgroups are separate businesses, set up by Signal House. For
289
+ * those groups pass the subgroup whose business verifications to list.
274
290
  * @async
275
291
  * @roles api, admin, developer, billing, user
276
- * @param {Object} params - The parameters for getting the business verification
277
- * @param {string} params.groupId - The ID of the group whose business verification to get
278
- * @param {string} [params.subgroupId] - The subgroup whose business verification to get, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored
292
+ * @param {Object} params - The parameters for listing the business verifications
293
+ * @param {string} params.groupId - The ID of the group whose business verifications to list
294
+ * @param {string} [params.subgroupId] - The subgroup whose business verifications to list, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored
279
295
  * @param {RequestOptions} [params.options] - Additional options for the request
280
296
  * @throws {Error} Throws an error if the groupId parameter is missing
281
- * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} The business verification. `subgroupId` is present only when it belongs to one subgroup: the subgroup whose business it describes. `required` says whether the group's new toll-free brands need one; `status` is NOT_STARTED, SUBMITTING, IN_REVIEW, VERIFIED or NEEDS_CHANGES; `rejectionReason` says why it needs changes, or is null. When `required` is true and `status` is NOT_STARTED, submit it before creating the first toll-free brand it covers. The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, and 404 when the subgroup is not in the group.
297
+ * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, businessVerifications: Array<BusinessVerification> }>>} The business verifications, newest first. `subgroupId` is present only when they belong to one subgroup. `required` says whether the group's new toll-free brands need a business verification: each one names a VERIFIED business verification as `tollFree.businessVerificationId`. The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, and 404 when the subgroup is not in the group.
282
298
  */
283
- getBusinessVerification({ groupId, subgroupId, options }: {
299
+ getBusinessVerifications({ groupId, subgroupId, options }: {
284
300
  groupId: string;
285
301
  subgroupId?: string;
286
302
  options?: RequestOptions;
@@ -288,44 +304,68 @@ export class Brands {
288
304
  groupId: string;
289
305
  subgroupId?: string;
290
306
  required: boolean;
291
- status: string;
292
- details: BusinessVerificationDetails | null;
293
- submittedAt: string | null;
294
- reviewedAt: string | null;
295
- rejectionReason: string | null;
307
+ businessVerifications: Array<BusinessVerification>;
308
+ }>>;
309
+ /**
310
+ * Get one of a group's business verifications by its ID.
311
+ * @async
312
+ * @roles api, admin, developer, billing, user
313
+ * @param {Object} params - The parameters for getting the business verification
314
+ * @param {string} params.groupId - The ID of the group the business verification belongs to
315
+ * @param {string} params.businessVerificationId - The ID of the business verification to get (starts with BV)
316
+ * @param {RequestOptions} [params.options] - Additional options for the request
317
+ * @throws {Error} Throws an error if the groupId or businessVerificationId parameter is missing
318
+ * @returns {Promise<SdkResponse<BusinessVerification & { required: boolean }>>} The business verification, plus `required` (whether the group's new toll-free brands need one). The API returns 404 when it isn't one of the group's.
319
+ */
320
+ getBusinessVerification({ groupId, businessVerificationId, options }: {
321
+ groupId: string;
322
+ businessVerificationId: string;
323
+ options?: RequestOptions;
324
+ }): Promise<SdkResponse<BusinessVerification & {
325
+ required: boolean;
296
326
  }>>;
297
327
  /**
298
- * Submit or update a group's business verification, or one subgroup's in a group that verifies each subgroup's business
299
- * separately. Allowed when it is not started or needs changes. Review usually takes 1–2 business days; the toll-free
300
- * brands it covers stay pending until it is verified.
328
+ * Create and submit a new business verification for a group, or for one subgroup in a group that verifies each
329
+ * subgroup's business separately. Review usually takes 1–2 business days; once it is VERIFIED, new toll-free brands
330
+ * can use it by naming it as `tollFree.businessVerificationId`.
301
331
  * @async
302
332
  * @roles api, admin, developer, billing, user
303
- * @param {Object} params - The parameters for submitting the business verification
304
- * @param {string} params.groupId - The ID of the group whose business verification to submit (must be the caller's active group)
305
- * @param {string} [params.subgroupId] - The subgroup whose business verification to submit, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored. The subgroup must be active
333
+ * @param {Object} params - The parameters for creating the business verification
334
+ * @param {string} params.groupId - The ID of the group the business verification is for (must be the caller's active group)
335
+ * @param {string} [params.subgroupId] - The subgroup whose business it verifies, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored. The subgroup must be active
306
336
  * @param {BusinessVerificationDetails} params.details - The business verification details (see BusinessVerificationDetails typedef for details)
307
337
  * @param {RequestOptions} [params.options] - Additional options for the request
308
338
  * @throws {Error} Throws an error if the groupId or details parameter is missing
309
- * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} A 202 with the business verification, now SUBMITTING (the same shape as getBusinessVerification, with `subgroupId` only when it belongs to one subgroup). The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, or when the subgroup is inactive, and 404 when the subgroup is not in the group.
339
+ * @returns {Promise<SdkResponse<BusinessVerification>>} A 202 with the new business verification, now SUBMITTING. The API returns 400 when the group's toll-free brands don't need a business verification, when the group verifies each subgroup's business separately and no subgroupId is given, or when the subgroup is inactive, and 404 when the subgroup is not in the group.
310
340
  */
311
- submitBusinessVerification({ groupId, subgroupId, details, options }: {
341
+ createBusinessVerification({ groupId, subgroupId, details, options }: {
312
342
  groupId: string;
313
343
  subgroupId?: string;
314
344
  details: BusinessVerificationDetails;
315
345
  options?: RequestOptions;
316
- }): Promise<SdkResponse<{
346
+ }): Promise<SdkResponse<BusinessVerification>>;
347
+ /**
348
+ * Correct and resubmit a business verification that needs changes. Allowed only while its status is NEEDS_CHANGES.
349
+ * Review usually takes 1–2 business days; the toll-free brands that use it stay pending until it is verified.
350
+ * @async
351
+ * @roles api, admin, developer, billing, user
352
+ * @param {Object} params - The parameters for updating the business verification
353
+ * @param {string} params.groupId - The ID of the group the business verification belongs to (must be the caller's active group)
354
+ * @param {string} params.businessVerificationId - The ID of the business verification to update (starts with BV)
355
+ * @param {BusinessVerificationDetails} params.details - The corrected business verification details (see BusinessVerificationDetails typedef for details)
356
+ * @param {RequestOptions} [params.options] - Additional options for the request
357
+ * @throws {Error} Throws an error if the groupId, businessVerificationId or details parameter is missing
358
+ * @returns {Promise<SdkResponse<BusinessVerification>>} A 202 with the business verification, now SUBMITTING. The API returns 400 when it doesn't need changes, and 404 when it isn't one of the group's.
359
+ */
360
+ updateBusinessVerification({ groupId, businessVerificationId, details, options }: {
317
361
  groupId: string;
318
- subgroupId?: string;
319
- required: boolean;
320
- status: string;
321
- details: BusinessVerificationDetails | null;
322
- submittedAt: string | null;
323
- reviewedAt: string | null;
324
- rejectionReason: string | null;
325
- }>>;
362
+ businessVerificationId: string;
363
+ details: BusinessVerificationDetails;
364
+ options?: RequestOptions;
365
+ }): Promise<SdkResponse<BusinessVerification>>;
326
366
  /**
327
367
  * Get a group's toll-free ISV account: the group's own top-level account at the toll-free provider, used when its
328
- * subgroups are separate businesses. Each subgroup gets an account and a business verification of its own under it.
368
+ * subgroups are separate businesses. Each subgroup gets an account and business verifications of its own under it.
329
369
  * Staff only.
330
370
  * @async
331
371
  * @roles signalhouse_api, signalhouse_admin, signalhouse_user
@@ -755,21 +795,21 @@ export type UpdateBrandData = {
755
795
  };
756
796
  export type TollFreeBrandDetails = {
757
797
  /**
758
- * - The business registration type (required, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
798
+ * - The business registration type (required unless businessVerificationId is sent, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
759
799
  */
760
- businessRegistrationType: string;
800
+ businessRegistrationType?: string;
761
801
  /**
762
802
  * - The legal entity type (required, one of PRIVATE_COMPANY, PUBLIC_COMPANY, NON_PROFIT, GOVERNMENT, SOLE_PROPRIETOR)
763
803
  */
764
804
  legalEntityType: string;
765
805
  /**
766
- * - The business tax identifier (required, at most 50 characters)
806
+ * - The business tax identifier (required unless businessVerificationId is sent, at most 50 characters)
767
807
  */
768
- taxId: string;
808
+ taxId?: string;
769
809
  /**
770
- * - The business country code (required, 2-letter ISO code)
810
+ * - The business country code (required unless businessVerificationId is sent, 2-letter ISO code)
771
811
  */
772
- countryCode: string;
812
+ countryCode?: string;
773
813
  /**
774
814
  * - The customer-support phone number (required, E.164 with an optional leading "+" and no spaces, parentheses or hyphens, e.g. "17025550100")
775
815
  */
@@ -786,6 +826,10 @@ export type TollFreeBrandDetails = {
786
826
  * - The customer's real website, sent to Infobip for brand verification (optional, valid URL, at most 255 characters; distinct from the top-level website / landing URL)
787
827
  */
788
828
  businessWebsite?: string;
829
+ /**
830
+ * - The ID of the business verification the brand uses (starts with BV). Required for a group whose toll-free brands need a business verification, and must name a VERIFIED one of the brand's group (in a group that verifies each subgroup's business separately, of the brand's subgroup); refused (400) for any other group. Set at creation only: it can't be changed
831
+ */
832
+ businessVerificationId?: string;
789
833
  };
790
834
  export type BusinessVerificationDetails = {
791
835
  /**
@@ -848,6 +892,40 @@ export type BusinessVerificationDetails = {
848
892
  jobLevel: string;
849
893
  };
850
894
  };
895
+ export type BusinessVerification = {
896
+ /**
897
+ * - The business verification's ID (starts with BV)
898
+ */
899
+ businessVerificationId: string;
900
+ /**
901
+ * - The group it belongs to
902
+ */
903
+ groupId: string;
904
+ /**
905
+ * - The subgroup whose business it verifies; present only in a group that verifies each subgroup's business separately
906
+ */
907
+ subgroupId?: string;
908
+ /**
909
+ * - SUBMITTING, IN_REVIEW, VERIFIED or NEEDS_CHANGES
910
+ */
911
+ status: string;
912
+ /**
913
+ * - The submitted details
914
+ */
915
+ details: BusinessVerificationDetails;
916
+ /**
917
+ * - When it was last submitted (ISO date)
918
+ */
919
+ submittedAt: string;
920
+ /**
921
+ * - When it was last reviewed (ISO date), or null
922
+ */
923
+ reviewedAt: string | null;
924
+ /**
925
+ * - Why it needs changes, or null
926
+ */
927
+ rejectionReason: string | null;
928
+ };
851
929
  export type TollFreeIsvAccount = {
852
930
  /**
853
931
  * - The group the account is registered to
@@ -874,6 +952,11 @@ export type TollFreeIsvAccount = {
874
952
  */
875
953
  updatedAt: string;
876
954
  };
955
+ /**
956
+ * Toll-free brand data. When tollFree.businessVerificationId is sent, the legal fields (companyName, street, city, state,
957
+ * postalCode, country, firstName, lastName and tollFree's businessRegistrationType, taxId, countryCode and
958
+ * taxIdIssuingCountry) are optional: the business verification's values replace any that are sent.
959
+ */
877
960
  export type CreateTollFreeBrandData = {
878
961
  /**
879
962
  * - The ID of the subgroup to create the brand under (required, exactly 8 characters)
@@ -884,37 +967,37 @@ export type CreateTollFreeBrandData = {
884
967
  */
885
968
  displayName: string;
886
969
  /**
887
- * - The company name for the brand (required, at most 255 characters)
970
+ * - The company name for the brand (required unless tollFree.businessVerificationId is sent, at most 255 characters)
888
971
  */
889
- companyName: string;
972
+ companyName?: string;
890
973
  /**
891
- * - The street address of the primary contact for the brand (required, at most 255 characters)
974
+ * - The street address of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 255 characters)
892
975
  */
893
- street: string;
976
+ street?: string;
894
977
  /**
895
- * - The city of the primary contact for the brand (required, at most 100 characters)
978
+ * - The city of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
896
979
  */
897
- city: string;
980
+ city?: string;
898
981
  /**
899
- * - The state of the primary contact for the brand (required, at most 20 characters; must be a valid 2-letter US state code when country is "US")
982
+ * - The state of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 20 characters; must be a valid 2-letter US state code when country is "US")
900
983
  */
901
- state: string;
984
+ state?: string;
902
985
  /**
903
- * - The postal code of the primary contact for the brand (required, at most 10 characters)
986
+ * - The postal code of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 10 characters)
904
987
  */
905
- postalCode: string;
988
+ postalCode?: string;
906
989
  /**
907
990
  * - The email address of the primary contact for the brand (required, valid email, at most 100 characters)
908
991
  */
909
992
  email: string;
910
993
  /**
911
- * - The first name of the primary contact for the brand (required, at most 100 characters)
994
+ * - The first name of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
912
995
  */
913
- firstName: string;
996
+ firstName?: string;
914
997
  /**
915
- * - The last name of the primary contact for the brand (required, at most 100 characters)
998
+ * - The last name of the primary contact for the brand (required unless tollFree.businessVerificationId is sent, at most 100 characters)
916
999
  */
917
- lastName: string;
1000
+ lastName?: string;
918
1001
  /**
919
1002
  * - The website URL for the brand (required, valid URL, at most 255 characters)
920
1003
  */
@@ -327,6 +327,13 @@ export class Campaigns {
327
327
  * in the window; the volumes say how much traffic sits behind it. A campaign's figure is scored from the
328
328
  * campaign's own summed counters, never averaged from its numbers. For a live figure use GET /number/health
329
329
  * or GET /campaign/health.
330
+ *
331
+ * Every record also carries a `carrierSuspensions` array -- one entry per carrier suspension of the
332
+ * campaign: `{ mnoId, mnoName, source, suspensionCategory, reason, tcrEventType, suspendedAt, liftedAt }`.
333
+ * An entry is active while `liftedAt` is null. `mnoId` is the TCR carrier network id (same ids as `mnoIds`);
334
+ * `source` is CARRIER, UPSTREAM or BRAND (the carrier suspended the whole brand). A suspension applies to one
335
+ * carrier, so `status` stays ACTIVE. Subscribe to the CAMPAIGN_SUSPENDED / CAMPAIGN_UNSUSPENDED webhook events
336
+ * to be told when an entry opens or is lifted.
330
337
  * @returns {Promise<SdkResponse<Array|Object>>} The response from the server - array when unpaginated, or { data, total, page, limit, totalPages } when paginated
331
338
  */
332
339
  getCampaigns({ id, brandId, subgroupId, groupId, page, limit, status, search, sortBy, sortOrder, registrationType, options, }: {
@@ -35,11 +35,14 @@ export class Numbers {
35
35
  * @roles signalhouse
36
36
  * @param {Object} params - The parameters for approving the request
37
37
  * @param {string} params.portingId - The _id of the port-in request
38
+ * @param {string} [params.subGroupId] - Subgroup to assign when the request has none yet.
39
+ * Ignored if the request already has a subGroupId -- an existing assignment is never overwritten.
38
40
  * @param {RequestOptions} [params.options] - Additional options for the request
39
41
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated port-in request
40
42
  */
41
- approvePortRequest: ({ portingId, options }: {
43
+ approvePortRequest: ({ portingId, subGroupId, options }: {
42
44
  portingId: string;
45
+ subGroupId?: string;
43
46
  options?: RequestOptions;
44
47
  }) => Promise<SdkResponse<any>>;
45
48
  /**