@signalhouse-sms/sdk 1.5.1 → 1.7.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 +1 -1
- package/package.json +1 -1
- package/src/SignalHouseSDK.js +1 -0
- package/src/domains/Agents.js +81 -1
- package/src/domains/Auth.js +427 -8
- package/src/domains/Brands.js +115 -61
- package/src/domains/Campaigns.js +7 -0
- package/src/domains/Groups.js +99 -1
- package/src/domains/Messages.js +5 -5
- package/src/domains/Numbers.js +4 -1
- package/src/domains/Voice.js +2 -0
- package/src/domains/voice/OutboundVoice.js +150 -0
- package/types/domains/Agents.d.ts +123 -2
- package/types/domains/Auth.d.ts +411 -7
- package/types/domains/Brands.d.ts +175 -90
- package/types/domains/Campaigns.d.ts +7 -0
- package/types/domains/Groups.d.ts +97 -1
- package/types/domains/Messages.d.ts +5 -5
- package/types/domains/Numbers.d.ts +4 -1
- package/types/domains/Voice.d.ts +2 -0
- package/types/domains/voice/OutboundVoice.d.ts +128 -0
package/src/domains/Brands.js
CHANGED
|
@@ -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)
|
|
@@ -159,6 +175,51 @@ export class Brands {
|
|
|
159
175
|
this.client = client;
|
|
160
176
|
this.multipartClient = multipartClient;
|
|
161
177
|
this.enableAdmin = enableAdmin;
|
|
178
|
+
|
|
179
|
+
if (enableAdmin) {
|
|
180
|
+
this.admin = {
|
|
181
|
+
/**
|
|
182
|
+
* 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.
|
|
185
|
+
* @async
|
|
186
|
+
* @roles signalhouse_api, signalhouse_admin, signalhouse_user
|
|
187
|
+
* @param {Object} params - The parameters for getting the toll-free ISV account
|
|
188
|
+
* @param {string} params.groupId - The ID of the group whose toll-free ISV account to get
|
|
189
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
190
|
+
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
191
|
+
* @returns {Promise<SdkResponse<TollFreeIsvAccount|null>>} The group's toll-free ISV account, or null when it has none. The API key secret is never returned. The API returns 404 when the group does not exist or is not active.
|
|
192
|
+
*/
|
|
193
|
+
getTollFreeIsvAccount: async ({ groupId, options = {} }) => {
|
|
194
|
+
this.client._require({ groupId });
|
|
195
|
+
return this.client(`/brand/toll-free-isv-account/${encodeURIComponent(groupId)}`, { method: 'GET', ...options });
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Register a group's toll-free ISV account, or replace the API key of the account it already has. Staff only. The
|
|
200
|
+
* toll-free provider checks the account and key before they are stored. Register it before the group has any toll-free
|
|
201
|
+
* records at the provider; after that, only the API key of the same account can be replaced.
|
|
202
|
+
* @async
|
|
203
|
+
* @roles signalhouse_admin
|
|
204
|
+
* @param {Object} params - The parameters for setting the toll-free ISV account
|
|
205
|
+
* @param {string} params.groupId - The ID of the group whose toll-free ISV account to set
|
|
206
|
+
* @param {string} params.accountSid - The SID of the group's own top-level account at the toll-free provider (AC followed by 32 lowercase hexadecimal characters)
|
|
207
|
+
* @param {string} params.apiKeySid - The SID of a Main API key in that account, which can create subaccounts (SK followed by 32 lowercase hexadecimal characters)
|
|
208
|
+
* @param {string} params.apiKeySecret - The API key's secret (1 to 128 characters), stored encrypted and never returned
|
|
209
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
210
|
+
* @throws {Error} Throws an error if the groupId, accountSid, apiKeySid or apiKeySecret parameter is missing
|
|
211
|
+
* @returns {Promise<SdkResponse<TollFreeIsvAccount>>} The stored toll-free ISV account, without the API key secret. The API returns 400 when the provider refuses the account or its key, and 404 when the group does not exist or is not active.
|
|
212
|
+
*/
|
|
213
|
+
setTollFreeIsvAccount: async ({ groupId, accountSid, apiKeySid, apiKeySecret, options = {} }) => {
|
|
214
|
+
this.client._require({ groupId, accountSid, apiKeySid, apiKeySecret });
|
|
215
|
+
return this.client(`/brand/toll-free-isv-account/${encodeURIComponent(groupId)}`, {
|
|
216
|
+
method: 'PUT',
|
|
217
|
+
body: { accountSid, apiKeySid, apiKeySecret },
|
|
218
|
+
...options,
|
|
219
|
+
});
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
162
223
|
}
|
|
163
224
|
|
|
164
225
|
/**
|
|
@@ -187,7 +248,7 @@ export class Brands {
|
|
|
187
248
|
* @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
|
|
188
249
|
* @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
|
|
189
250
|
* @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)
|
|
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).
|
|
191
252
|
*/
|
|
192
253
|
async getBrands({
|
|
193
254
|
id,
|
|
@@ -285,83 +346,76 @@ export class Brands {
|
|
|
285
346
|
}
|
|
286
347
|
|
|
287
348
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
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.
|
|
291
352
|
* @async
|
|
292
353
|
* @roles api, admin, developer, billing, user
|
|
293
|
-
* @param {Object} params - The parameters for
|
|
294
|
-
* @param {string} params.groupId - The ID of the group whose business
|
|
295
|
-
* @param {string} [params.subgroupId] - The subgroup whose business
|
|
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
|
|
296
357
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
297
358
|
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
298
|
-
* @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean,
|
|
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.
|
|
299
360
|
*/
|
|
300
|
-
async
|
|
361
|
+
async getBusinessVerifications({ groupId, subgroupId, options = {} }) {
|
|
301
362
|
this.client._require({ groupId });
|
|
302
363
|
const queryString = this.client._getQueryString({ subgroupId });
|
|
303
364
|
return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'GET', ...options });
|
|
304
365
|
}
|
|
305
366
|
|
|
306
367
|
/**
|
|
307
|
-
*
|
|
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.
|
|
368
|
+
* Get one of a group's business verifications by its ID.
|
|
310
369
|
* @async
|
|
311
370
|
* @roles api, admin, developer, billing, user
|
|
312
|
-
* @param {Object} params - The parameters for
|
|
313
|
-
* @param {string} params.groupId - The ID of the group
|
|
314
|
-
* @param {string}
|
|
315
|
-
* @param {BusinessVerificationDetails} params.details - The business verification details (see BusinessVerificationDetails typedef for details)
|
|
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)
|
|
316
374
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
317
|
-
* @throws {Error} Throws an error if the groupId or
|
|
318
|
-
* @returns {Promise<SdkResponse<
|
|
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.
|
|
319
377
|
*/
|
|
320
|
-
async
|
|
321
|
-
this.client._require({ groupId,
|
|
322
|
-
|
|
323
|
-
return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'PUT', body: details, ...options });
|
|
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 });
|
|
324
381
|
}
|
|
325
382
|
|
|
326
383
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
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`.
|
|
330
387
|
* @async
|
|
331
|
-
* @roles
|
|
332
|
-
* @param {Object} params - The parameters for
|
|
333
|
-
* @param {string} params.groupId - The ID of the group
|
|
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)
|
|
334
393
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
335
|
-
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
336
|
-
* @returns {Promise<SdkResponse<
|
|
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.
|
|
337
396
|
*/
|
|
338
|
-
async
|
|
339
|
-
this.client._require({ groupId });
|
|
340
|
-
|
|
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 });
|
|
341
401
|
}
|
|
342
402
|
|
|
343
403
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* records at the provider; after that, only the API key of the same account can be replaced.
|
|
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.
|
|
347
406
|
* @async
|
|
348
|
-
* @roles
|
|
349
|
-
* @param {Object} params - The parameters for
|
|
350
|
-
* @param {string} params.groupId - The ID of the group
|
|
351
|
-
* @param {string} params.
|
|
352
|
-
* @param {
|
|
353
|
-
* @param {string} params.apiKeySecret - The API key's secret (1 to 128 characters), stored encrypted and never returned
|
|
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)
|
|
354
412
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
355
|
-
* @throws {Error} Throws an error if the groupId,
|
|
356
|
-
* @returns {Promise<SdkResponse<
|
|
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.
|
|
357
415
|
*/
|
|
358
|
-
async
|
|
359
|
-
this.client._require({ groupId,
|
|
360
|
-
return this.client(`/brand/
|
|
361
|
-
method: 'PUT',
|
|
362
|
-
body: { accountSid, apiKeySid, apiKeySecret },
|
|
363
|
-
...options,
|
|
364
|
-
});
|
|
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 });
|
|
365
419
|
}
|
|
366
420
|
|
|
367
421
|
/**
|
package/src/domains/Campaigns.js
CHANGED
|
@@ -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({
|
package/src/domains/Groups.js
CHANGED
|
@@ -171,7 +171,7 @@ export class Groups {
|
|
|
171
171
|
* @roles api, admin, developer, billing
|
|
172
172
|
* @param {Object} params - The parameters for updating a group
|
|
173
173
|
* @param {string} params.id - The ID of the group to update
|
|
174
|
-
* @param {Object} params.groupData - The data for the group, including required fields such as groupName.
|
|
174
|
+
* @param {Object} params.groupData - The data for the group, including required fields such as groupName. A group admin can set requireTwoFactor (boolean) to require 2FA for every member.
|
|
175
175
|
* Optional CNP fields: cspId (string|null), defaultCnpSubgroupId (string|null)
|
|
176
176
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
177
177
|
* @throws {Error} Throws an error if the id or groupData parameter is missing
|
|
@@ -182,4 +182,102 @@ export class Groups {
|
|
|
182
182
|
const safeId = encodeURIComponent(id);
|
|
183
183
|
return this.client(`/group/${safeId}`, { method: "PUT", body: groupData, ...options });
|
|
184
184
|
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Get a group's Enterprise SSO configuration: whether SSO is available, the redirect URL to register at
|
|
188
|
+
* the identity provider, the saved provider (never its client secret), and each claimed domain with the
|
|
189
|
+
* DNS TXT record that verifies it
|
|
190
|
+
* @async
|
|
191
|
+
* @roles admin
|
|
192
|
+
* @param {Object} params
|
|
193
|
+
* @param {string} params.groupId - The group
|
|
194
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
195
|
+
* @returns {Promise<SdkResponse<any>>} - { groupId, available, callbackUrl, connection, domains }
|
|
196
|
+
*/
|
|
197
|
+
async getSsoConfiguration({ groupId, options = {} }) {
|
|
198
|
+
this.client._require({ groupId });
|
|
199
|
+
const queryString = this.client._getQueryString({ groupId });
|
|
200
|
+
return this.client(`/group/sso${queryString}`, { method: "GET", ...options });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Create or update a group's OpenID Connect identity provider. Requires a fresh
|
|
205
|
+
* auth.confirmTwoFactorIdentity from the same session
|
|
206
|
+
* @async
|
|
207
|
+
* @roles admin
|
|
208
|
+
* @param {Object} params
|
|
209
|
+
* @param {string} params.groupId - The group
|
|
210
|
+
* @param {string} params.issuer - The provider's https issuer URL
|
|
211
|
+
* @param {string} params.clientId - The client ID registered at the provider
|
|
212
|
+
* @param {string} [params.clientSecret] - The client secret; required the first time, omit to keep the saved one
|
|
213
|
+
* @param {boolean} [params.enabled] - Whether sign-in through the provider is on (default true)
|
|
214
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
215
|
+
* @returns {Promise<SdkResponse<any>>} - The SSO configuration
|
|
216
|
+
*/
|
|
217
|
+
async saveSsoConnection({ groupId, issuer, clientId, clientSecret, enabled, options = {} }) {
|
|
218
|
+
this.client._require({ groupId, issuer, clientId });
|
|
219
|
+
return this.client(`/group/sso`, { method: "PUT", body: { groupId, issuer, clientId, clientSecret, enabled }, ...options });
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Remove a group's identity provider and its domains, and unlink every account that signed in through it.
|
|
224
|
+
* Requires a fresh auth.confirmTwoFactorIdentity from the same session
|
|
225
|
+
* @async
|
|
226
|
+
* @roles admin
|
|
227
|
+
* @param {Object} params
|
|
228
|
+
* @param {string} params.groupId - The group
|
|
229
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
230
|
+
* @returns {Promise<SdkResponse<any>>} - The (now empty) SSO configuration
|
|
231
|
+
*/
|
|
232
|
+
async deleteSsoConnection({ groupId, options = {} }) {
|
|
233
|
+
this.client._require({ groupId });
|
|
234
|
+
const queryString = this.client._getQueryString({ groupId });
|
|
235
|
+
return this.client(`/group/sso${queryString}`, { method: "DELETE", ...options });
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Claim an email domain for a group's SSO; the response includes the DNS TXT record that verifies it
|
|
240
|
+
* @async
|
|
241
|
+
* @roles admin
|
|
242
|
+
* @param {Object} params
|
|
243
|
+
* @param {string} params.groupId - The group
|
|
244
|
+
* @param {string} params.domain - The domain, e.g. "acme.com"
|
|
245
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
246
|
+
* @returns {Promise<SdkResponse<any>>} - The SSO configuration
|
|
247
|
+
*/
|
|
248
|
+
async addSsoDomain({ groupId, domain, options = {} }) {
|
|
249
|
+
this.client._require({ groupId, domain });
|
|
250
|
+
return this.client(`/group/sso/domains`, { method: "POST", body: { groupId, domain }, ...options });
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Verify a claimed domain by its DNS TXT record
|
|
255
|
+
* @async
|
|
256
|
+
* @roles admin
|
|
257
|
+
* @param {Object} params
|
|
258
|
+
* @param {string} params.groupId - The group
|
|
259
|
+
* @param {string} params.domain - The claimed domain
|
|
260
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
261
|
+
* @returns {Promise<SdkResponse<any>>} - The SSO configuration
|
|
262
|
+
*/
|
|
263
|
+
async verifySsoDomain({ groupId, domain, options = {} }) {
|
|
264
|
+
this.client._require({ groupId, domain });
|
|
265
|
+
return this.client(`/group/sso/domains/${encodeURIComponent(domain)}/verify`, { method: "POST", body: { groupId }, ...options });
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Remove a domain from a group's SSO
|
|
270
|
+
* @async
|
|
271
|
+
* @roles admin
|
|
272
|
+
* @param {Object} params
|
|
273
|
+
* @param {string} params.groupId - The group
|
|
274
|
+
* @param {string} params.domain - The domain
|
|
275
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
276
|
+
* @returns {Promise<SdkResponse<any>>} - The SSO configuration
|
|
277
|
+
*/
|
|
278
|
+
async removeSsoDomain({ groupId, domain, options = {} }) {
|
|
279
|
+
this.client._require({ groupId, domain });
|
|
280
|
+
const queryString = this.client._getQueryString({ groupId });
|
|
281
|
+
return this.client(`/group/sso/domains/${encodeURIComponent(domain)}${queryString}`, { method: "DELETE", ...options });
|
|
282
|
+
}
|
|
185
283
|
}
|
package/src/domains/Messages.js
CHANGED
|
@@ -140,7 +140,7 @@ export class Messages {
|
|
|
140
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.
|
|
141
141
|
* @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
142
|
* @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). 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.
|
|
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.
|
|
144
144
|
* @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
145
|
* @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
146
|
* @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.
|
|
@@ -177,7 +177,7 @@ export class Messages {
|
|
|
177
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.
|
|
178
178
|
* @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
179
|
* @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). 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.
|
|
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.
|
|
181
181
|
* @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
182
|
* @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
183
|
* @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.
|
|
@@ -260,7 +260,7 @@ export class Messages {
|
|
|
260
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.
|
|
261
261
|
* @param {string|string[]} [params.phoneNumber]
|
|
262
262
|
* @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); 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.
|
|
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.
|
|
264
264
|
* @param {string} [params.startDate]
|
|
265
265
|
* @param {string} [params.endDate]
|
|
266
266
|
* @param {number} [params.page=1]
|
|
@@ -293,7 +293,7 @@ export class Messages {
|
|
|
293
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.
|
|
294
294
|
* @param {string|string[]} [params.phoneNumber]
|
|
295
295
|
* @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); 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.
|
|
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.
|
|
297
297
|
* @param {string} [params.startDate]
|
|
298
298
|
* @param {string} [params.endDate]
|
|
299
299
|
* @param {number} [params.page=1]
|
|
@@ -362,7 +362,7 @@ export class Messages {
|
|
|
362
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
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.
|
|
364
364
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
365
|
-
* @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), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
|
|
365
|
+
* @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
366
|
*/
|
|
367
367
|
async getDncRecords({ groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds, options = {} }) {
|
|
368
368
|
const filters = { groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds };
|
package/src/domains/Numbers.js
CHANGED
|
@@ -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
|
},
|
package/src/domains/Voice.js
CHANGED
|
@@ -7,6 +7,7 @@ import { CallLogs } from "./voice/CallLogs.js";
|
|
|
7
7
|
import { GlobalVoiceSettings } from "./voice/GlobalVoiceSettings.js";
|
|
8
8
|
import { Tokens } from "./voice/Tokens.js";
|
|
9
9
|
import { Analytics } from "./voice/Analytics.js";
|
|
10
|
+
import { OutboundVoice } from "./voice/OutboundVoice.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Voice domain — wraps the Voice service (mounted under /voice on the
|
|
@@ -37,5 +38,6 @@ export class Voice {
|
|
|
37
38
|
this.globalVoiceSettings = new GlobalVoiceSettings(client, enableAdmin);
|
|
38
39
|
this.tokens = new Tokens(client, enableAdmin);
|
|
39
40
|
this.analytics = new Analytics(client, enableAdmin);
|
|
41
|
+
this.outboundVoice = new OutboundVoice(client, enableAdmin);
|
|
40
42
|
}
|
|
41
43
|
}
|