@signalhouse-sms/sdk 1.7.0 → 1.9.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 +1 -1
- package/src/SignalHouseSDK.js +2 -0
- package/src/domains/Agents.js +1 -1
- package/src/domains/Auth.js +3 -2
- package/src/domains/Brands.js +43 -119
- package/src/domains/Campaigns.js +16 -0
- package/src/domains/Rcs.js +281 -0
- package/src/domains/Registrations.js +76 -3
- package/src/domains/Templates.js +34 -3
- package/types/SignalHouseSDK.d.ts +2 -0
- package/types/domains/Agents.d.ts +2 -2
- package/types/domains/Auth.d.ts +3 -2
- package/types/domains/Brands.d.ts +96 -241
- package/types/domains/Campaigns.d.ts +14 -0
- package/types/domains/Rcs.d.ts +409 -0
- package/types/domains/Registrations.d.ts +70 -2
- package/types/domains/Templates.d.ts +56 -6
package/package.json
CHANGED
package/src/SignalHouseSDK.js
CHANGED
|
@@ -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);
|
package/src/domains/Agents.js
CHANGED
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
* @property {string} inboundText - The contact message the agent was answering.
|
|
123
123
|
* @property {string} draftText - The reply as the agent wrote it.
|
|
124
124
|
* @property {string|null} sentText - The text actually sent; differs from draftText when edited.
|
|
125
|
-
* @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "
|
|
125
|
+
* @property {string} reason - Why it was held: "review_mode", "escalation", "fallback", "guardrail" or "quiet_hours" (an auto-pilot reply written between 9 pm and 9 am in the contact's time zone), or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
|
|
126
126
|
* @property {string} status - "pending", "sending", "sent", "rejected" or "failed" (the send path accepted nothing, e.g. the contact opted out).
|
|
127
127
|
* @property {string|null} decidedBy - The user who approved or rejected it.
|
|
128
128
|
* @property {string|null} decidedAt - When it was approved or rejected.
|
package/src/domains/Auth.js
CHANGED
|
@@ -322,7 +322,8 @@ export class Auth {
|
|
|
322
322
|
* @async
|
|
323
323
|
* @roles admin, developer, billing, user
|
|
324
324
|
* @param {Object} params
|
|
325
|
-
* @param {string} params.provider - "
|
|
325
|
+
* @param {string} params.provider - "microsoft", "apple" or "sso"; must be linked to the account. Google is
|
|
326
|
+
* refused with a 400 because it can't confirm a fresh sign-in; confirm with a code instead
|
|
326
327
|
* @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
|
|
327
328
|
* @returns {Promise<Object>} The response from the server ({ reauthTicket, reauthSecret, expiresInSeconds }). Keep
|
|
328
329
|
* `reauthSecret` in the client that started the flow: it is returned only here, and confirmOAuthReauth needs it
|
|
@@ -367,7 +368,7 @@ export class Auth {
|
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
/**
|
|
370
|
-
* Unlink a provider from the caller's account. Refused when it is the account's only way to sign in.
|
|
371
|
+
* Unlink a provider from the caller's account. Refused when it is the account's only way to sign in. With 2FA on and no password, the last linked Microsoft, Apple or SSO sign-in is refused (400) too.
|
|
371
372
|
* Requires a fresh confirmTwoFactorIdentity from the same session.
|
|
372
373
|
* @async
|
|
373
374
|
* @roles admin, developer, billing, user
|
package/src/domains/Brands.js
CHANGED
|
@@ -70,50 +70,19 @@
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @typedef {Object} TollFreeBrandDetails
|
|
73
|
-
* @property {string}
|
|
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}
|
|
76
|
-
* @property {string}
|
|
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
|
|
81
|
-
* @property {string} [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* @
|
|
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
|
|
131
|
-
*
|
|
132
|
-
*
|
|
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}
|
|
137
|
-
* @property {string}
|
|
138
|
-
* @property {string}
|
|
139
|
-
* @property {string}
|
|
140
|
-
* @property {string}
|
|
141
|
-
* @property {string} email - The email address
|
|
142
|
-
* @property {string}
|
|
143
|
-
* @property {string}
|
|
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
|
|
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,
|
|
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
|
-
*
|
|
350
|
-
*
|
|
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
|
|
355
|
-
* @param {string} params.groupId - The ID of the group whose
|
|
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<
|
|
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
|
|
339
|
+
async getTollFreeRequirements({ groupId, options = {} }) {
|
|
362
340
|
this.client._require({ groupId });
|
|
363
|
-
const
|
|
364
|
-
return this.client(`/brand/
|
|
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
|
/**
|
package/src/domains/Campaigns.js
CHANGED
|
@@ -433,6 +433,22 @@ export class Campaigns {
|
|
|
433
433
|
return this.client(`/campaign/throughput-limits${queryString}`, { method: 'GET', ...options });
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Get today's T-Mobile usage against the daily limit for every active campaign in a group that has one. The same limits and counter as getCampaignThroughputLimits, for the whole group in one call.
|
|
438
|
+
* @async
|
|
439
|
+
* @roles api, admin, developer, billing, user
|
|
440
|
+
* @param {Object} params - Parameters for reading group throughput usage
|
|
441
|
+
* @param {string} params.groupId - Group identifier
|
|
442
|
+
* @param {RequestOptions} [params.options] - Additional request options
|
|
443
|
+
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
444
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt } } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score.
|
|
445
|
+
*/
|
|
446
|
+
async getGroupThroughputUsage({ groupId, options = {} }) {
|
|
447
|
+
this.client._require({ groupId });
|
|
448
|
+
const queryString = this.client._getQueryString({ groupId });
|
|
449
|
+
return this.client(`/campaign/throughput-usage${queryString}`, { method: 'GET', ...options });
|
|
450
|
+
}
|
|
451
|
+
|
|
436
452
|
/**
|
|
437
453
|
* Create a new campaign
|
|
438
454
|
* @async
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} RcsAgentProfile
|
|
9
|
+
* @property {string} [name] - Agent name shown on the handset (max 40)
|
|
10
|
+
* @property {string} [description] - Agent description (max 100)
|
|
11
|
+
* @property {string} [color] - Brand color, hex (default #6868ab)
|
|
12
|
+
* @property {string} [logoUrl] - HTTPS URL of a 224 × 224 px logo (use uploadAsset to host one)
|
|
13
|
+
* @property {string} [heroUrl] - HTTPS URL of a 1440 × 448 px hero image
|
|
14
|
+
* @property {string} [phone] - Contact phone, E.164 (e.g. +18005550142)
|
|
15
|
+
* @property {string} [website] - HTTPS website
|
|
16
|
+
* @property {string} [email] - Contact email
|
|
17
|
+
* @property {string} [phoneLabel] - Caption on the Call action (max 40; submit defaults it to "Call")
|
|
18
|
+
* @property {string} [websiteLabel] - Caption on the Website action (max 40; submit defaults it to "Website")
|
|
19
|
+
* @property {string} [emailLabel] - Caption on the Email action (max 40; submit defaults it to "Email")
|
|
20
|
+
* @property {string} [privacyPolicyUrl] - HTTPS privacy policy URL
|
|
21
|
+
* @property {string} [termsUrl] - HTTPS terms of service URL
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The agent's launch text. Every field is required before submit, the opt-in URL and the launch video included.
|
|
26
|
+
* @typedef {Object} RcsAgentConsent
|
|
27
|
+
* @property {string} [optInDetails] - How recipients opt in (filled from the campaign's messageFlow when blank)
|
|
28
|
+
* @property {string} [optInUrl] - HTTPS page that shows the opt-in
|
|
29
|
+
* @property {string} [optInResponse] - The opt-in confirmation (filled from the campaign's optinMessage)
|
|
30
|
+
* @property {string} [optOutDetails] - How recipients opt out
|
|
31
|
+
* @property {string} [optOutResponse] - The opt-out confirmation (filled from the campaign's optoutMessage)
|
|
32
|
+
* @property {string} [helpResponse] - The HELP reply (filled from the campaign's helpMessage)
|
|
33
|
+
* @property {string} [campaignDescription] - What the agent sends (filled from the campaign's description)
|
|
34
|
+
* @property {string[]} [messageExamples] - 1-6 example messages (filled from the campaign's samples)
|
|
35
|
+
* @property {("UP_TO_10K"|"10K_100K"|"100K_500K"|"500K_1M"|"1M_PLUS")} [estimatedMonthlyVolume] - Expected monthly volume
|
|
36
|
+
* @property {string} [launchVideoUrl] - HTTPS video of the opt-in flow
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The individual at the brand the carrier partner's reviewers may contact about the launch. Every field is required
|
|
41
|
+
* before the launch request; a shared mailbox (support@, info@) is refused.
|
|
42
|
+
* @typedef {Object} RcsAgentContact
|
|
43
|
+
* @property {string} [firstName] - First name (max 100)
|
|
44
|
+
* @property {string} [lastName] - Last name (max 100)
|
|
45
|
+
* @property {string} [role] - Role at the brand (3-75)
|
|
46
|
+
* @property {string} [email] - An individual's business email
|
|
47
|
+
* @property {string} [mobile] - Mobile number, E.164
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Build the multipart form for an agent image upload.
|
|
52
|
+
* @param {Object} params - Form fields
|
|
53
|
+
* @param {("logo"|"hero")} params.kind - Which image
|
|
54
|
+
* @param {Blob|File} params.file - The PNG or JPEG bytes
|
|
55
|
+
* @param {string} [params.fileName] - Optional file name
|
|
56
|
+
* @returns {FormData} - The form with kind and file fields
|
|
57
|
+
*/
|
|
58
|
+
export function agentAssetForm({ kind, file, fileName }) {
|
|
59
|
+
const formData = new FormData();
|
|
60
|
+
formData.append("kind", kind);
|
|
61
|
+
if (fileName) formData.append("file", file, fileName);
|
|
62
|
+
else formData.append("file", file);
|
|
63
|
+
return formData;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* RCS agents under /rcs/agent. An agent links one 10DLC brand and one 10DLC campaign: the campaign's numbers are the
|
|
68
|
+
* SMS fallback, and the brand and campaign supply the company identity and consent text for the carrier launch.
|
|
69
|
+
* One brand or campaign can serve many agents. An agent is a registration (type RCS_AGENT, id RCSA…), so the
|
|
70
|
+
* registrations methods read and edit the same record. 404 while the environment's RCS switch is off; 400 while the
|
|
71
|
+
* group's rcsEnabled flag is off.
|
|
72
|
+
*/
|
|
73
|
+
export class RcsAgents {
|
|
74
|
+
constructor(client, multipartClient) {
|
|
75
|
+
this.client = client;
|
|
76
|
+
this.multipartClient = multipartClient;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Create an agent draft on a 10DLC brand, optionally with its campaign. The agent's subgroup is the brand's.
|
|
81
|
+
* Blank consent fields fill from the linked campaign. Pass options.idempotencyKey to make a retry safe.
|
|
82
|
+
* @async
|
|
83
|
+
* @roles api, admin, developer, billing, user
|
|
84
|
+
* @param {Object} params - The agent
|
|
85
|
+
* @param {string} params.brandId - The 10DLC brand: carrier brand ID, provisional UUID or _id
|
|
86
|
+
* @param {string|null} [params.campaignId] - A 10DLC campaign of that brand: campaign ID or _id; required before submit
|
|
87
|
+
* @param {RcsAgentProfile} [params.agent] - The agent profile
|
|
88
|
+
* @param {RcsAgentConsent} [params.consent] - The launch text; required in full before the launch request
|
|
89
|
+
* @param {RcsAgentContact} [params.contact] - The launch contact; required in full before the launch request
|
|
90
|
+
* @param {("OTP"|"TRANSACTIONAL"|"PROMOTIONAL"|"MULTI_USE")} [params.useCase] - The agent's use case; required before submit
|
|
91
|
+
* @param {("NON_CONVERSATIONAL"|"CONVERSATIONAL")} [params.billingCategory] - Default NON_CONVERSATIONAL; submit refuses CONVERSATIONAL
|
|
92
|
+
* @param {{ mode?: string, channel?: string, from?: string }|null} [params.defaultFallback] - Fallback mode (auto, rcs_only, sms_only, none), channel (auto, sms, mms) and from, a number on the linked campaign
|
|
93
|
+
* @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
|
|
94
|
+
* @param {string[]} [params.testers] - Tester numbers (up to 200), invited once the agent exists at the carrier
|
|
95
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
96
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status DRAFT)
|
|
97
|
+
*/
|
|
98
|
+
async create({ brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options = {} }) {
|
|
99
|
+
this.client._require({ brandId });
|
|
100
|
+
return this.client("/rcs/agent", {
|
|
101
|
+
method: "POST",
|
|
102
|
+
body: { brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers },
|
|
103
|
+
...options,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* List agents, newest first
|
|
109
|
+
* @async
|
|
110
|
+
* @roles api, admin, developer, billing, user
|
|
111
|
+
* @param {Object} [params] - Filters
|
|
112
|
+
* @param {string} [params.groupId] - Filter by group ID
|
|
113
|
+
* @param {string} [params.subgroupId] - Filter by subgroup ID
|
|
114
|
+
* @param {string|string[]} [params.status] - DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING or ARCHIVED, one or a list
|
|
115
|
+
* @param {string} [params.brandId] - Agents linked to this 10DLC brand (carrier brand ID, provisional UUID or _id)
|
|
116
|
+
* @param {string} [params.campaignId] - Agents linked to this 10DLC campaign (campaign ID or _id)
|
|
117
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
118
|
+
* @param {number} [params.limit] - Agents per page (default 25, max 100)
|
|
119
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
120
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { data: [agents], total, page, limit }
|
|
121
|
+
*/
|
|
122
|
+
async list({ groupId, subgroupId, status, brandId, campaignId, page, limit, options = {} } = {}) {
|
|
123
|
+
const queryString = this.client._getQueryString({ groupId, subgroupId, status, brandId, campaignId, page, limit });
|
|
124
|
+
return this.client(`/rcs/agent${queryString}`, { method: "GET", ...options });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Get one agent with the live state of its brand and campaign links
|
|
129
|
+
* @async
|
|
130
|
+
* @roles api, admin, developer, billing, user
|
|
131
|
+
* @param {Object} params - The lookup
|
|
132
|
+
* @param {string} params.agentId - The agent ID (e.g. RCSA7K2M1QZ8RP)
|
|
133
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
134
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
135
|
+
*/
|
|
136
|
+
async get({ agentId, options = {} }) {
|
|
137
|
+
this.client._require({ agentId });
|
|
138
|
+
return this.client(`/rcs/agent/${encodeURIComponent(agentId)}`, { method: "GET", ...options });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Edit an agent while it may change: a draft, a Signal House rejection, a request for changes, or an agent in
|
|
143
|
+
* testing (the change is pushed to the carrier partner). `agent`, `consent` and `contact` merge field by field;
|
|
144
|
+
* every other key replaces; campaignId: null unlinks the campaign. 409 in any other status; brandId is locked once
|
|
145
|
+
* the agent exists at the partner and billingCategory once a launch was requested.
|
|
146
|
+
* @async
|
|
147
|
+
* @roles api, admin, developer, billing, user
|
|
148
|
+
* @param {Object} params - The edit
|
|
149
|
+
* @param {string} params.agentId - The agent ID
|
|
150
|
+
* @param {string} [params.brandId] - Relink to another 10DLC brand of the same subgroup
|
|
151
|
+
* @param {string|null} [params.campaignId] - Link, relink or (null) unlink the campaign
|
|
152
|
+
* @param {RcsAgentProfile} [params.agent] - Profile fields to change
|
|
153
|
+
* @param {RcsAgentConsent} [params.consent] - Consent fields to change
|
|
154
|
+
* @param {RcsAgentContact} [params.contact] - Contact fields to change
|
|
155
|
+
* @param {string|null} [params.useCase] - The use case
|
|
156
|
+
* @param {string} [params.billingCategory] - The billing category
|
|
157
|
+
* @param {Object|null} [params.defaultFallback] - The fallback
|
|
158
|
+
* @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
|
|
159
|
+
* @param {string[]} [params.testers] - Tester numbers
|
|
160
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
161
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
162
|
+
*/
|
|
163
|
+
async update({ agentId, brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options = {} }) {
|
|
164
|
+
this.client._require({ agentId });
|
|
165
|
+
return this.client(`/rcs/agent/${encodeURIComponent(agentId)}`, {
|
|
166
|
+
method: "PUT",
|
|
167
|
+
body: { brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers },
|
|
168
|
+
...options,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Check an agent against the next gate on its path without writing: before it exists at the carrier partner, what
|
|
174
|
+
* creating it needs (the full profile, useCase, NON_CONVERSATIONAL billing); after that, what the launch request needs
|
|
175
|
+
* (a VERIFIED brand, the campaign, the full consent with the video, the contact)
|
|
176
|
+
* @async
|
|
177
|
+
* @roles api, admin, developer, billing, user
|
|
178
|
+
* @param {Object} params - The lookup
|
|
179
|
+
* @param {string} params.agentId - The agent ID
|
|
180
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
181
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { valid, errors: [{ field, reason }], warnings: [{ field, reason }] }
|
|
182
|
+
*/
|
|
183
|
+
async validate({ agentId, options = {} }) {
|
|
184
|
+
this.client._require({ agentId });
|
|
185
|
+
return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/validate`, { method: "POST", ...options });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a
|
|
190
|
+
* useCase and NON_CONVERSATIONAL billing; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
|
|
191
|
+
* errors, warnings }. The agent moves to AGENT_CREATING, then IN_TESTING once the partner reports it ready.
|
|
192
|
+
* @async
|
|
193
|
+
* @roles api, admin, developer, billing, user
|
|
194
|
+
* @param {Object} params - The submission
|
|
195
|
+
* @param {string} params.agentId - The agent ID
|
|
196
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
197
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status AGENT_CREATING)
|
|
198
|
+
*/
|
|
199
|
+
async submit({ agentId, options = {} }) {
|
|
200
|
+
this.client._require({ agentId });
|
|
201
|
+
return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/submit`, { method: "POST", ...options });
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Request the agent's launch: the launch requirements are checked and the agent goes to Signal House review (status
|
|
206
|
+
* PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
|
|
207
|
+
* CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
|
|
208
|
+
* "REGISTRATION_INCOMPLETE", errors, warnings }. Sends POST /registration/:agentId/launch: the agent is a registration.
|
|
209
|
+
* @async
|
|
210
|
+
* @roles api, admin, developer, billing, user
|
|
211
|
+
* @param {Object} params - The launch request
|
|
212
|
+
* @param {string} params.agentId - The agent ID
|
|
213
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
214
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status PENDING_REVIEW)
|
|
215
|
+
*/
|
|
216
|
+
async launch({ agentId, options = {} }) {
|
|
217
|
+
this.client._require({ agentId });
|
|
218
|
+
return this.client(`/registration/${encodeURIComponent(agentId)}/launch`, { method: "POST", ...options });
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Archive an agent
|
|
223
|
+
* @async
|
|
224
|
+
* @roles api, admin, developer, user
|
|
225
|
+
* @param {Object} params - The archive request
|
|
226
|
+
* @param {string} params.agentId - The agent ID
|
|
227
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
228
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status ARCHIVED)
|
|
229
|
+
*/
|
|
230
|
+
async archive({ agentId, options = {} }) {
|
|
231
|
+
this.client._require({ agentId });
|
|
232
|
+
return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/archive`, { method: "POST", ...options });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Resend a tester's expired invitation, which starts a new 24 hours for the tester to accept it. The number must be
|
|
237
|
+
* a tester on the agent (404) and its invitation must be EXPIRED (409); up to 20 invitations go out a day (429).
|
|
238
|
+
* @async
|
|
239
|
+
* @roles api, admin, developer, billing, user
|
|
240
|
+
* @param {Object} params - The resend request
|
|
241
|
+
* @param {string} params.agentId - The agent ID
|
|
242
|
+
* @param {string} params.phoneNumber - The tester's US number, with or without the +
|
|
243
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
244
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
245
|
+
*/
|
|
246
|
+
async resendTesterInvite({ agentId, phoneNumber, options = {} }) {
|
|
247
|
+
this.client._require({ agentId, phoneNumber });
|
|
248
|
+
return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/testers/${encodeURIComponent(phoneNumber)}/resend`, { method: "POST", ...options });
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Host the agent's logo (224 × 224 px, 50 KB max) or hero image (1440 × 448 px, 200 KB max), PNG or JPEG, and set
|
|
253
|
+
* it on the draft. Images of any other size are refused.
|
|
254
|
+
* @async
|
|
255
|
+
* @roles api, admin, developer, billing, user
|
|
256
|
+
* @param {Object} params - The upload
|
|
257
|
+
* @param {string} params.agentId - The agent ID
|
|
258
|
+
* @param {("logo"|"hero")} params.kind - Which image
|
|
259
|
+
* @param {Blob|File} params.file - The image bytes
|
|
260
|
+
* @param {string} [params.fileName] - Optional file name
|
|
261
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
262
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent with the new URL
|
|
263
|
+
*/
|
|
264
|
+
async uploadAsset({ agentId, kind, file, fileName, options = {} }) {
|
|
265
|
+
this.client._require({ agentId, kind, file });
|
|
266
|
+
return this.multipartClient(`/rcs/agent/${encodeURIComponent(agentId)}/asset`, {
|
|
267
|
+
method: "POST",
|
|
268
|
+
body: agentAssetForm({ kind, file, fileName }),
|
|
269
|
+
...options,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* RCS (Google RBM) resources. Templates for RCS live under `templates`.
|
|
276
|
+
*/
|
|
277
|
+
export class Rcs {
|
|
278
|
+
constructor(client, multipartClient) {
|
|
279
|
+
this.agents = new RcsAgents(client, multipartClient);
|
|
280
|
+
}
|
|
281
|
+
}
|