@signalhouse-sms/sdk 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhouse-sms/sdk",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -33,6 +33,7 @@ import { Groups } from "./domains/Groups.js";
33
33
  import { Landings } from "./domains/Landings.js";
34
34
  import { Messages } from "./domains/Messages.js";
35
35
  import { Templates } from "./domains/Templates.js";
36
+ import { Rcs } from "./domains/Rcs.js";
36
37
  import { Numbers } from "./domains/Numbers.js";
37
38
  import { Registrations } from "./domains/Registrations.js";
38
39
  import { Onboarding } from "./domains/Onboarding.js";
@@ -80,6 +81,7 @@ export class SignalHouseSDK {
80
81
  this.landings = new Landings(client, multipartClient, this.enableAdmin);
81
82
  this.messages = new Messages(client, multipartClient, this.enableAdmin);
82
83
  this.templates = new Templates(client, multipartClient, this.enableAdmin);
84
+ this.rcs = new Rcs(client, multipartClient);
83
85
  this.numbers = new Numbers(client, multipartClient, this.enableAdmin);
84
86
  this.registrations = new Registrations(client, this.enableAdmin);
85
87
  this.onboarding = new Onboarding(client, this.enableAdmin);
@@ -70,50 +70,19 @@
70
70
 
71
71
  /**
72
72
  * @typedef {Object} TollFreeBrandDetails
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)
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)
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 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)
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; "US" or "CA" when the group's toll-free brands are reviewed on submit)
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
- * @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
82
- */
83
-
84
- /**
85
- * @typedef {Object} BusinessVerificationDetails
86
- * @property {string} businessName - The legal business name (required, at most 255 characters)
87
- * @property {string} businessType - The business type (required, one of CO_OPERATIVE, CORPORATION, LIMITED_LIABILITY_CORPORATION, NON_PROFIT_CORPORATION, PARTNERSHIP)
88
- * @property {string} industry - The business industry (required, one of AGRICULTURE, AUTOMOTIVE, BANKING, CONSTRUCTION, CONSUMER, EDUCATION, ELECTRONICS, ENGINEERING, ENERGY, FAST_MOVING_CONSUMER_GOODS, FINANCIAL, FINTECH, FOOD_AND_BEVERAGE, GOVERNMENT, HEALTHCARE, HOSPITALITY, INSURANCE, JEWELRY, LEGAL, MANUFACTURING, MEDIA, NOT_FOR_PROFIT, OIL_AND_GAS, ONLINE, PROFESSIONAL_SERVICES, RAW_MATERIALS, REAL_ESTATE, RELIGION, RETAIL, TECHNOLOGY, TELECOMMUNICATIONS, TRANSPORTATION, TRAVEL)
89
- * @property {string} registrationType - 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)
90
- * @property {string} registrationNumber - The business registration number, e.g. the EIN (required, at most 50 characters)
91
- * @property {string} website - The business website (required, valid URL, at most 255 characters)
92
- * @property {string} street - The business street address (required, at most 255 characters)
93
- * @property {string} [street2] - The second line of the street address (optional, at most 255 characters)
94
- * @property {string} city - The business city (required, at most 100 characters)
95
- * @property {string} state - The business state or province (required, 2-letter code)
96
- * @property {string} postalCode - The business postal code (required, at most 10 characters)
97
- * @property {string} country - The business country (required, "US" or "CA")
98
- * @property {Object} representative - The business's authorized representative (required)
99
- * @property {string} representative.firstName - The representative's first name (required, at most 100 characters)
100
- * @property {string} representative.lastName - The representative's last name (required, at most 100 characters)
101
- * @property {string} representative.email - The representative's email address (required, valid email, at most 100 characters)
102
- * @property {string} representative.phone - The representative's phone number (required, E.164 with an optional leading "+" and no spaces, parentheses or hyphens, e.g. "+17025550100")
103
- * @property {string} representative.jobTitle - The representative's job title (required, at most 100 characters)
104
- * @property {string} representative.jobLevel - The representative's job level (required, one of DIRECTOR, GM, VP, CEO, CFO, GENERAL_COUNSEL, OTHER)
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
80
+ * @property {string} [businessWebsite] - The customer's real website, sent to the toll-free carrier for verification (optional, valid URL, at most 255 characters; distinct from the top-level website / landing URL)
81
+ * @property {string} [businessStructure] - The business structure (one of CO_OPERATIVE, CORPORATION, LIMITED_LIABILITY_CORPORATION, NON_PROFIT_CORPORATION, PARTNERSHIP). Required when the group's toll-free brands are reviewed on submit; refused (400) otherwise
82
+ * @property {string} [industry] - The business industry (one of AGRICULTURE, AUTOMOTIVE, BANKING, CONSTRUCTION, CONSUMER, EDUCATION, ELECTRONICS, ENGINEERING, ENERGY, FAST_MOVING_CONSUMER_GOODS, FINANCIAL, FINTECH, FOOD_AND_BEVERAGE, GOVERNMENT, HEALTHCARE, HOSPITALITY, INSURANCE, JEWELRY, LEGAL, MANUFACTURING, MEDIA, NOT_FOR_PROFIT, OIL_AND_GAS, ONLINE, PROFESSIONAL_SERVICES, RAW_MATERIALS, REAL_ESTATE, RELIGION, RETAIL, TECHNOLOGY, TELECOMMUNICATIONS, TRANSPORTATION, TRAVEL). Required when the group's toll-free brands are reviewed on submit; refused (400) otherwise
83
+ * @property {string} [contactEmail] - The email address of the contact named by firstName and lastName (valid email, at most 100 characters). Required when the group's toll-free brands are reviewed on submit; refused (400) otherwise
84
+ * @property {string} [contactJobTitle] - The contact's job title (at most 100 characters). Required when the group's toll-free brands are reviewed on submit; refused (400) otherwise
85
+ * @property {string} [contactJobLevel] - The contact's job level (one of DIRECTOR, GM, VP, CEO, CFO, GENERAL_COUNSEL, OTHER). Required when the group's toll-free brands are reviewed on submit; refused (400) otherwise
117
86
  */
118
87
 
119
88
  /**
@@ -127,20 +96,23 @@
127
96
  */
128
97
 
129
98
  /**
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.
99
+ * Toll-free brand data. When the group's toll-free brands are reviewed on submit (see getTollFreeRequirements), tollFree
100
+ * also needs businessStructure, industry, contactEmail, contactJobTitle and contactJobLevel, tollFree.countryCode must be
101
+ * "US" or "CA", and state must be a 2-letter state or province code. Any other group is refused those five fields.
102
+ * Such a brand's business details can't be changed after it's submitted: companyName, street, city, state, postalCode,
103
+ * country, firstName, lastName and tollFree's businessRegistrationType, taxId, countryCode, taxIdIssuingCountry,
104
+ * businessStructure, industry, contactEmail, contactJobTitle and contactJobLevel.
133
105
  * @typedef {Object} CreateTollFreeBrandData
134
106
  * @property {string} subgroupId - The ID of the subgroup to create the brand under (required, exactly 8 characters)
135
107
  * @property {string} displayName - The display name for the brand (required, at most 255 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)
141
- * @property {string} email - The email address of the primary contact for the brand (required, valid email, 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)
108
+ * @property {string} companyName - The company name for the brand (required, at most 255 characters)
109
+ * @property {string} street - The street address of the primary contact for the brand (required, at most 255 characters)
110
+ * @property {string} city - The city of the primary contact for the brand (required, at most 100 characters)
111
+ * @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", and a 2-letter state or province code when the group's toll-free brands are reviewed on submit)
112
+ * @property {string} postalCode - The postal code of the primary contact for the brand (required, at most 10 characters)
113
+ * @property {string} email - The brand's support email address (required, valid email, at most 100 characters)
114
+ * @property {string} firstName - The first name of the primary contact for the brand (required, at most 100 characters)
115
+ * @property {string} lastName - The last name of the primary contact for the brand (required, at most 100 characters)
144
116
  * @property {string} website - The website URL for the brand (required, valid URL, at most 255 characters)
145
117
  * @property {TollFreeBrandDetails} tollFree - The Toll-Free brand details (required)
146
118
  * @property {string} [referenceId] - A unique reference for the brand (optional, at most 50 characters)
@@ -153,6 +125,12 @@
153
125
  * @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)
154
126
  */
155
127
 
128
+ /**
129
+ * @typedef {Object} TollFreeRequirements
130
+ * @property {string} groupId - The group the requirements are for
131
+ * @property {boolean} reviewsBusinessOnSubmit - Whether the group's new toll-free brands are reviewed when they're submitted. When true, a new toll-free brand needs tollFree.businessStructure, industry, contactEmail, contactJobTitle and contactJobLevel, a tollFree.countryCode of "US" or "CA" and a 2-letter state or province code; it stays DCA_PENDING until it's reviewed, and its business details can't be changed after it's submitted. When false, those five fields are refused
132
+ */
133
+
156
134
  /**
157
135
  * @typedef {Object} CreateShortCodeBrandData
158
136
  * @property {string} subgroupId - The ID of the subgroup to create the brand under.
@@ -180,8 +158,7 @@ export class Brands {
180
158
  this.admin = {
181
159
  /**
182
160
  * Get a group's toll-free ISV account: the group's own top-level account at the toll-free provider, used when its
183
- * subgroups are separate businesses. Each subgroup gets an account and business verifications of its own under it.
184
- * Staff only.
161
+ * subgroups are separate businesses. Each subgroup gets an account of its own under it. Staff only.
185
162
  * @async
186
163
  * @roles signalhouse_api, signalhouse_admin, signalhouse_user
187
164
  * @param {Object} params - The parameters for getting the toll-free ISV account
@@ -248,7 +225,7 @@ export class Brands {
248
225
  * @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
249
226
  * @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
250
227
  * @param {RequestOptions} [params.options] - Additional options for the request
251
- * @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).
228
+ * @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, reviewsBusinessOnSubmit?: boolean, businessStructure?: string|null, industry?: string|null, contactEmail?: string|null, contactJobTitle?: string|null, contactJobLevel?: string|null, rejectionReason?: 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) and `tollFree.reviewsBusinessOnSubmit` (whether it's reviewed when it's submitted and keeps its business details from then on). A brand reviewed on submit also carries its `tollFree.businessStructure`, `tollFree.industry`, `tollFree.contactEmail`, `tollFree.contactJobTitle` and `tollFree.contactJobLevel`, and `tollFree.rejectionReason` (why its review rejected it, in plain English, or null). On other toll-free brands these are null or absent. 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).
252
229
  */
253
230
  async getBrands({
254
231
  id,
@@ -331,7 +308,10 @@ export class Brands {
331
308
  }
332
309
 
333
310
  /**
334
- * Create a new Toll-Free (TFN) brand
311
+ * Create a new Toll-Free (TFN) brand. When the group's toll-free brands are reviewed on submit (see
312
+ * getTollFreeRequirements), the brand stays DCA_PENDING until it's reviewed, then becomes DCA_ACTIVE, or DCA_REJECTED
313
+ * with tollFree.rejectionReason saying why. Its business details can't be changed after it's submitted, so a rejected
314
+ * brand is fixed by creating it again with the corrections.
335
315
  * @async
336
316
  * @roles api, admin, developer, billing, user
337
317
  * @param {Object} params - The parameters for creating the toll-free brand
@@ -346,76 +326,20 @@ export class Brands {
346
326
  }
347
327
 
348
328
  /**
349
- * List a group's business verifications, newest first, and whether its toll-free brands need one. Some groups verify
350
- * each subgroup's business separately: a platform whose subgroups are separate businesses, set up by Signal House. For
351
- * those groups pass the subgroup whose business verifications to list.
329
+ * Get whether a group's new toll-free brands are reviewed when they're submitted, which decides the details
330
+ * createTollFreeBrand needs.
352
331
  * @async
353
332
  * @roles api, admin, developer, billing, user
354
- * @param {Object} params - The parameters for listing the business verifications
355
- * @param {string} params.groupId - The ID of the group whose business verifications to list
356
- * @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
333
+ * @param {Object} params - The parameters for getting the toll-free requirements
334
+ * @param {string} params.groupId - The ID of the group whose toll-free requirements to get
357
335
  * @param {RequestOptions} [params.options] - Additional options for the request
358
336
  * @throws {Error} Throws an error if the groupId parameter is missing
359
- * @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.
337
+ * @returns {Promise<SdkResponse<TollFreeRequirements>>} The group's toll-free requirements (see TollFreeRequirements typedef for details). The API returns 403 when the caller can't view the group.
360
338
  */
361
- async getBusinessVerifications({ groupId, subgroupId, options = {} }) {
339
+ async getTollFreeRequirements({ groupId, options = {} }) {
362
340
  this.client._require({ groupId });
363
- const queryString = this.client._getQueryString({ subgroupId });
364
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'GET', ...options });
365
- }
366
-
367
- /**
368
- * Get one of a group's business verifications by its ID.
369
- * @async
370
- * @roles api, admin, developer, billing, user
371
- * @param {Object} params - The parameters for getting the business verification
372
- * @param {string} params.groupId - The ID of the group the business verification belongs to
373
- * @param {string} params.businessVerificationId - The ID of the business verification to get (starts with BV)
374
- * @param {RequestOptions} [params.options] - Additional options for the request
375
- * @throws {Error} Throws an error if the groupId or businessVerificationId parameter is missing
376
- * @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.
377
- */
378
- async getBusinessVerification({ groupId, businessVerificationId, options = {} }) {
379
- this.client._require({ groupId, businessVerificationId });
380
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}/${encodeURIComponent(businessVerificationId)}`, { method: 'GET', ...options });
381
- }
382
-
383
- /**
384
- * Create and submit a new business verification for a group, or for one subgroup in a group that verifies each
385
- * subgroup's business separately. Review usually takes 1–2 business days; once it is VERIFIED, new toll-free brands
386
- * can use it by naming it as `tollFree.businessVerificationId`.
387
- * @async
388
- * @roles api, admin, developer, billing, user
389
- * @param {Object} params - The parameters for creating the business verification
390
- * @param {string} params.groupId - The ID of the group the business verification is for (must be the caller's active group)
391
- * @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
392
- * @param {BusinessVerificationDetails} params.details - The business verification details (see BusinessVerificationDetails typedef for details)
393
- * @param {RequestOptions} [params.options] - Additional options for the request
394
- * @throws {Error} Throws an error if the groupId or details parameter is missing
395
- * @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.
396
- */
397
- async createBusinessVerification({ groupId, subgroupId, details, options = {} }) {
398
- this.client._require({ groupId, details });
399
- const queryString = this.client._getQueryString({ subgroupId });
400
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'POST', body: details, ...options });
401
- }
402
-
403
- /**
404
- * Correct and resubmit a business verification that needs changes. Allowed only while its status is NEEDS_CHANGES.
405
- * Review usually takes 1–2 business days; the toll-free brands that use it stay pending until it is verified.
406
- * @async
407
- * @roles api, admin, developer, billing, user
408
- * @param {Object} params - The parameters for updating the business verification
409
- * @param {string} params.groupId - The ID of the group the business verification belongs to (must be the caller's active group)
410
- * @param {string} params.businessVerificationId - The ID of the business verification to update (starts with BV)
411
- * @param {BusinessVerificationDetails} params.details - The corrected business verification details (see BusinessVerificationDetails typedef for details)
412
- * @param {RequestOptions} [params.options] - Additional options for the request
413
- * @throws {Error} Throws an error if the groupId, businessVerificationId or details parameter is missing
414
- * @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.
415
- */
416
- async updateBusinessVerification({ groupId, businessVerificationId, details, options = {} }) {
417
- this.client._require({ groupId, businessVerificationId, details });
418
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}/${encodeURIComponent(businessVerificationId)}`, { method: 'PUT', body: details, ...options });
341
+ const safeGroupId = encodeURIComponent(groupId);
342
+ return this.client(`/brand/toll-free-requirements/${safeGroupId}`, { method: 'GET', ...options });
419
343
  }
420
344
 
421
345
  /**
@@ -47,12 +47,12 @@ export class Messages {
47
47
  * @param {string} [params.subgroupId] - Filter messages by the ID of the associated subgroup
48
48
  * @param {string} [params.groupId] - Filter messages by the ID of the associated group
49
49
  * @param {string|string[]} [params.registrationId] - Filter to messages attributed to these registrations. Cannot be combined with campaignId; each id must belong to the group. Accepts a single value or an array.
50
- * @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED)
50
+ * @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED; RCS messages also READ, EXPIRED, FALLBACK, BLOCKED)
51
51
  * @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
52
52
  * @param {string|string[]} [params.messageType] - Filter messages by their type. Accepts a single value or an array (e.g. ["SMS", "MMS"]). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types.
53
- * @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, virtualLongCode, tollFree, shortCode, p2p. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
54
- * @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. Accepted whether or not the environment serves hourly analytics.
55
- * @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. Accepted whether or not the environment serves hourly analytics.
53
+ * @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, virtualLongCode, tollFree, shortCode, p2p, rcs. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
54
+ * @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.
55
+ * @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.
56
56
  * @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (a message matches ANY of them) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
57
57
  * @param {string} [params.carrier] - Filter messages by the carrier used for sending
58
58
  * @param {string|string[]} [params.sentimentLabel] - Filter messages by sentiment bucket. Accepts a single value or an array (e.g. ["positive", "negative"]). Allowed values: positive, neutral, negative. Applied as the sentimentScore range the ±25 label threshold produces, so unscored messages match no bucket and outbound messages (never scored) are excluded.
@@ -67,6 +67,13 @@ export class Messages {
67
67
  * @param {number} [params.page] - The page number for pagination
68
68
  * @param {number} [params.limit] - The number of messages per page
69
69
  * @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".
70
+ * @param {string} [params.templateId] - RCS messages sent from this template
71
+ * @param {number} [params.templateVersion] - RCS messages sent from this template version
72
+ * @param {string} [params.bulkId] - The RCS messages of one send
73
+ * @param {string} [params.fallbackReason] - Why an RCS message ran its fallback (NOT_CAPABLE, CARRIER_NOT_LAUNCHED, TTL_EXPIRED, RCS_ERROR, PROVIDER_ERROR, SMS_ONLY)
74
+ * @param {string} [params.billingClass] - Filter by RCS billing class (RICH, RICH_MEDIA)
75
+ * @param {string} [params.deliveredChannel] - Filter by the channel that delivered an RCS message (rcs, sms, mms)
76
+ * @param {boolean} [params.isTest] - true for RCS test messages only, false to leave them out
70
77
  * @param {RequestOptions} [params.options] - Additional options for the request
71
78
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages. Inbound messages also carry
72
79
  * sentimentScore (-100..100, null when unscored), sentimentLabel ("positive"|"neutral"|"negative", null when
@@ -99,13 +106,35 @@ export class Messages {
99
106
  page,
100
107
  limit,
101
108
  dateBounds,
109
+ templateId,
110
+ templateVersion,
111
+ bulkId,
112
+ fallbackReason,
113
+ billingClass,
114
+ deliveredChannel,
115
+ isTest,
102
116
  options = {},
103
117
  }) {
104
- 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 };
118
+ 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 };
105
119
  const queryString = this.client._getQueryString(withRegionScopes(filters));
106
120
  return this.client(`/message${queryString}`, { method: "GET", ...options });
107
121
  }
108
122
 
123
+ /**
124
+ * Get one message of any type by its ID
125
+ * @async
126
+ * @roles api, admin, developer, billing, user
127
+ * @param {Object} params - The parameters for getting a message
128
+ * @param {string} params.id - The message ID
129
+ * @param {RequestOptions} [params.options] - Additional options for the request
130
+ * @throws {Error} Throws an error if the id parameter is missing
131
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404
132
+ */
133
+ async getMessage({ id, options = {} }) {
134
+ this.client._require({ id });
135
+ return this.client(`/message/${encodeURIComponent(id)}`, { method: "GET", ...options });
136
+ }
137
+
109
138
  /**
110
139
  * Fetch the latest upstream carrier delivery report for a set of messages by ID.
111
140
  * Useful for reconciling messages stuck in a non-terminal state. Outbound SMS and MMS messages sent from numbers on
@@ -137,17 +166,17 @@ export class Messages {
137
166
  * @param {string|string[]} [params.subgroupId] - Filter analytics by the ID of the associated subgroup. Accepts a single value, an array, or a comma-separated string.
138
167
  * @param {string|string[]} [params.brandId] - Filter analytics by the ID of the associated brand. Accepts a single value, an array, or a comma-separated string.
139
168
  * @param {string|string[]} [params.campaignId] - Filter analytics by the ID of the associated campaign. Accepts a single value, an array, or a comma-separated string.
140
- * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
169
+ * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
141
170
  * @param {string|string[]} [params.phoneNumber] - Filter analytics by the phone number involved in the messages. Accepts a single value, an array, or a comma-separated string.
142
171
  * @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
143
- * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
172
+ * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string.
144
173
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode
145
174
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back
146
175
  * @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (match ANY) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
147
176
  * @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
148
177
  * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, virtualLongCode, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here (matched by carrier). Accepts a single value or an array. Ignored when matchAny is true (matchAny takes precedence).
149
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
150
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
178
+ * @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.
179
+ * @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.
151
180
  * @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".
152
181
  * @param {RequestOptions} [params.options] - Additional options for the request
153
182
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the analytics data. Also includes inbound-message
@@ -174,18 +203,18 @@ export class Messages {
174
203
  * @param {string|string[]} [params.subgroupId] - Filter analytics by the ID of the associated subgroup. Accepts a single value, an array, or a comma-separated string.
175
204
  * @param {string|string[]} [params.brandId] - Filter analytics by the ID of the associated brand. Accepts a single value, an array, or a comma-separated string.
176
205
  * @param {string|string[]} [params.campaignId] - Filter analytics by the ID of the associated campaign. Accepts a single value, an array, or a comma-separated string.
177
- * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
206
+ * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
178
207
  * @param {string|string[]} [params.phoneNumber] - Filter analytics by the phone number involved in the messages. Accepts a single value, an array, or a comma-separated string.
179
208
  * @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
180
- * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
209
+ * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string.
181
210
  * @param {string} [params.startDate] - ISO-8601 date or timestamp. It is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode, then floored to the start of its hour at either granularity, because the hourly cube is keyed by hour and a mid-hour start would drop that hour's bucket.
182
211
  * @param {string} [params.endDate] - ISO-8601 date or timestamp. At day granularity it is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back; at hour granularity it is honoured as given.
183
212
  * @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
184
213
  * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, virtualLongCode, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here. Accepts a single value or an array.
185
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
186
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
187
- * @param {("day"|"hour")} [params.granularity] - Time-bucket grain of the byDate rows. Omit for day (each row's _id is a "YYYY-MM-DD" date). "hour" buckets by hour (each row's _id is a "YYYY-MM-DD HH:MM:SS" UTC hour) and is capped to a 7-day span. Only accepted where the environment serves hourly analytics; elsewhere any value, including "day", is rejected with a 400 -- omit the parameter unless hour grain is wanted.
188
- * @param {("carrier"|"carrierFamily")} [params.breakdown] - Adds a byBreakdown time × dimension series to the response ({ dimension, rows }: each row is one byDate bucket (_id) for one carrier or carrier family (key), over the top 50 keys by volume, excluding P2P) and caps the span at 31 days. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
214
+ * @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.
215
+ * @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.
216
+ * @param {("day"|"hour")} [params.granularity] - Time-bucket grain of the byDate rows. Omit for day (each row's _id is a "YYYY-MM-DD" date). "hour" buckets by hour (each row's _id is a "YYYY-MM-DD HH:MM:SS" UTC hour) and is capped to a 7-day span.
217
+ * @param {("carrier"|"carrierFamily")} [params.breakdown] - Adds a byBreakdown time × dimension series to the response ({ dimension, rows }: each row is one byDate bucket (_id) for one carrier or carrier family (key), over the top 50 keys by volume, excluding P2P) and caps the span at 31 days.
189
218
  * @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".
190
219
  * @param {RequestOptions} [params.options] - Additional options for the request
191
220
  * @returns {Promise<SdkResponse<Array>>} - A promise that resolves to an array of analytics snapshot records. cardTotals and
@@ -206,15 +235,14 @@ export class Messages {
206
235
  * Get per-minute send throughput (peak segments per minute, sending minutes, minutes at a ceiling) for a
207
236
  * campaign, brand, or group, per time bucket and per carrier family. Measured from SENT transitions at
208
237
  * campaign × carrier-family grain -- the grain carrier ceilings are enforced at -- so a peak here is the
209
- * figure a ceiling is compared against. Only accepted where the environment serves hourly analytics;
210
- * elsewhere the request is rejected with a 400.
238
+ * figure a ceiling is compared against.
211
239
  * @async
212
240
  * @roles api, admin, developer, billing, user
213
241
  * @param {Object} params - The parameters for the throughput read
214
242
  * @param {string} params.groupId - The group to scope the read to (required)
215
243
  * @param {string|string[]} [params.brandId] - Brand scope. Accepts a single value, an array, or a comma-separated string.
216
244
  * @param {string|string[]} [params.campaignId] - Campaign scope; wins over brandId. Accepts a single value, an array, or a comma-separated string.
217
- * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). Accepts a single value or an array.
245
+ * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. Accepts a single value or an array.
218
246
  * @param {string|string[]} [params.carrierFamily] - Carrier-family filter (ATT, TMobile, Verizon, USCellular, ...). Accepts a single value, an array, or a comma-separated string.
219
247
  * @param {string} params.startDate - ISO-8601 date or timestamp. It is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode, then floored to the start of its hour at hour granularity and of its minute at day granularity (the cube is keyed by minute).
220
248
  * @param {string} params.endDate - ISO-8601 date or timestamp. At hour granularity it is honoured as given; at day granularity it is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back. The span is capped at 35 days (the retention of the per-minute data).
@@ -237,7 +265,7 @@ export class Messages {
237
265
  * @roles api, admin, developer, billing, user
238
266
  * @param {Object} params - The parameters for getting analytics filter options
239
267
  * @param {string} params.groupId - The ID of the group whose filter options to load
240
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
268
+ * @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.
241
269
  * @param {RequestOptions} [params.options] - Additional options for the request
242
270
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to { subgroups, brands, campaigns, phoneNumbers, carriers }. Each phone number carries type (TOLL_FREE, SHORT_CODE, ALPHANUMERIC, VIRTUAL_LONG_NUMBER, ...) and country (ISO-2), null when unknown: TOLL_FREE, SHORT_CODE and ALPHANUMERIC are channels by type; any other US number is 10DLC and a non-US one is a Virtual Long Code. `carriers` is a plain array of carrier name strings.
243
271
  */
@@ -257,10 +285,10 @@ export class Messages {
257
285
  * @param {string|string[]} [params.subgroupId]
258
286
  * @param {string|string[]} [params.brandId]
259
287
  * @param {string|string[]} [params.campaignId]
260
- * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
288
+ * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
261
289
  * @param {string|string[]} [params.phoneNumber]
262
290
  * @param {string|string[]} [params.carrier]
263
- * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
291
+ * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated.
264
292
  * @param {string} [params.startDate]
265
293
  * @param {string} [params.endDate]
266
294
  * @param {number} [params.page=1]
@@ -268,8 +296,8 @@ export class Messages {
268
296
  * @param {("tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means all activity. tenDLC/virtualLongCode/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s).
269
297
  * @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
270
298
  * @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".
271
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
272
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
299
+ * @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.
300
+ * @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.
273
301
  * @param {RequestOptions} [params.options]
274
302
  * @returns {Promise<SdkResponse<any>>} - { rows, totalCount, page, limit }. Each row carries sms/mms/p2p metric columns plus `smsOptOuts` and `mmsOptOuts` from the DNC analytics MV (P2P has no opt-outs).
275
303
  * Each row also carries that subgroup's inbound-message sentiment: `sentimentScore` (volume-weighted average of every scored inbound message in that subgroup, -100..100, null when nothing was scored), `sentimentLabel`, `sentimentScoredCount`, `sentimentPositive`, `sentimentNeutral`, `sentimentNegative`, plus the same six per message type under `smsSentiment*`, `mmsSentiment*` and `p2pSentiment*` prefixes. The score is derived server-side and must never be re-averaged across rows — combine the counts, not the scores.
@@ -290,18 +318,18 @@ export class Messages {
290
318
  * @param {string|string[]} [params.subgroupId]
291
319
  * @param {string|string[]} [params.brandId]
292
320
  * @param {string|string[]} [params.campaignId]
293
- * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
321
+ * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
294
322
  * @param {string|string[]} [params.phoneNumber]
295
323
  * @param {string|string[]} [params.carrier]
296
- * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
324
+ * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated.
297
325
  * @param {string} [params.startDate]
298
326
  * @param {string} [params.endDate]
299
327
  * @param {number} [params.page=1]
300
328
  * @param {number} [params.limit=50] - max 50 per page
301
329
  * @param {("tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means every code. tenDLC/virtualLongCode/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s); when one channel is selected, totalErrors reflects only that channel.
302
330
  * @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".
303
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
304
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
331
+ * @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.
332
+ * @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.
305
333
  * @param {string} [params.errorCode] - Narrow the breakdown to a single failure reason: a numeric Infobip carrier code (as a string, e.g. "607"), the Signal House campaign-opt-out code "OUT", or a no-code failure class (other, moderation, att_limit, p2p_stop, campaign_opt_out, dnc_blocked, bind_hold_expired). Omitted = every reason.
306
334
  * @param {RequestOptions} [params.options]
307
335
  * @returns {Promise<SdkResponse<any>>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
@@ -321,15 +349,15 @@ export class Messages {
321
349
  * @param {string} [params.subgroupId] - Filter by the ID of the associated subgroup
322
350
  * @param {string} [params.brandId] - Filter by the ID of the associated brand
323
351
  * @param {string} [params.campaignId] - Filter by the ID of the associated campaign
324
- * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
352
+ * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
325
353
  * @param {string} [params.phoneNumber] - Filter by the phone number
326
354
  * @param {string} [params.carrier] - Filter by the carrier
327
355
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode
328
356
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back
329
357
  * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, virtualLongCode, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
330
358
  * @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".
331
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
332
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
359
+ * @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.
360
+ * @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.
333
361
  * @param {RequestOptions} [params.options] - Additional options for the request
334
362
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the DNC analytics data (totals, byDate, byPhoneNumber, bySenderNumber, byCampaign, bySubgroup, byType, byCarrier, byKeyword). bySenderNumber ({ senderPhoneNumber, total, sms, mms }) attributes each opt-out to the first business number that received it, so it is unchanged by later campaign moves and START replies. byCampaign ({ campaignId, ... }) counts campaign-scoped opt-outs only, by the campaign at the time of the STOP; subgroup-scoped opt-outs (non-US recipients) are never attributed to a campaign and appear under bySubgroup ({ subgroupId, ... }) instead. byType ({ messageType, total }) splits SMS/MMS. byKeyword breaks opt-outs down by the normalized keyword that revoked consent ({ optOutKeyword, total, sms, mms }); opt-outs recorded before keyword capture shipped appear as a single optOutKeyword: null bucket ("not recorded"). The distinct keyword set is open-ended (campaigns register their own keywords beyond the mandatory floor) — render top-N plus Other, never a fixed list.
335
363
  */
@@ -348,7 +376,7 @@ export class Messages {
348
376
  * @param {string} [params.subgroupId] - Filter by the ID of the associated subgroup
349
377
  * @param {string} [params.brandId] - Filter by the ID of the associated brand
350
378
  * @param {string} [params.campaignId] - Filter by the ID of the associated campaign
351
- * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
379
+ * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
352
380
  * @param {string} [params.phoneNumber] - Filter by the phone number
353
381
  * @param {string} [params.carrier] - Filter by the carrier
354
382
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode
@@ -359,8 +387,8 @@ export class Messages {
359
387
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
360
388
  * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, virtualLongCode, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
361
389
  * @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".
362
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
363
- * @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. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
390
+ * @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.
391
+ * @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.
364
392
  * @param {RequestOptions} [params.options] - Additional options for the request
365
393
  * @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).
366
394
  */