@signalhousellc/sdk 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +5 -56
  2. package/index.d.ts +1 -0
  3. package/index.js +2 -0
  4. package/package.json +32 -34
  5. package/voice-browser.d.ts +1 -0
  6. package/voice-browser.js +2 -0
  7. package/warn.js +7 -0
  8. package/webhooks.d.ts +1 -0
  9. package/webhooks.js +2 -0
  10. package/scripts/install-skills.mjs +0 -329
  11. package/skills/VENDORED.json +0 -22
  12. package/skills/signalhouse-10dlc/SKILL.md +0 -172
  13. package/skills/signalhouse-10dlc/examples/brightsmile-onboarding.md +0 -62
  14. package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +0 -104
  15. package/skills/signalhouse-advisor/SKILL.md +0 -84
  16. package/skills/signalhouse-numbers/SKILL.md +0 -82
  17. package/skills/signalhouse-setup/SKILL.md +0 -121
  18. package/skills/signalhouse-sms/SKILL.md +0 -81
  19. package/skills/signalhouse-webhooks/SKILL.md +0 -148
  20. package/src/SignalHouseSDK.js +0 -201
  21. package/src/domains/Agents.js +0 -987
  22. package/src/domains/Auth.js +0 -225
  23. package/src/domains/Billing.js +0 -265
  24. package/src/domains/Brands.js +0 -566
  25. package/src/domains/Campaigns.js +0 -691
  26. package/src/domains/Dnc.js +0 -168
  27. package/src/domains/Groups.js +0 -187
  28. package/src/domains/Landings.js +0 -237
  29. package/src/domains/Messages.js +0 -609
  30. package/src/domains/Notifications.js +0 -62
  31. package/src/domains/Numbers.js +0 -574
  32. package/src/domains/Onboarding.js +0 -128
  33. package/src/domains/Registrations.js +0 -246
  34. package/src/domains/Shortlinks.js +0 -80
  35. package/src/domains/Subgroups.js +0 -136
  36. package/src/domains/Subscriptions.js +0 -164
  37. package/src/domains/Templates.js +0 -403
  38. package/src/domains/Tickets.js +0 -100
  39. package/src/domains/Users.js +0 -228
  40. package/src/domains/Voice.js +0 -41
  41. package/src/domains/Webhooks.js +0 -125
  42. package/src/domains/voice/Analytics.js +0 -82
  43. package/src/domains/voice/CallLogs.js +0 -111
  44. package/src/domains/voice/Calls.js +0 -118
  45. package/src/domains/voice/GlobalVoiceSettings.js +0 -54
  46. package/src/domains/voice/NumberRoutes.js +0 -82
  47. package/src/domains/voice/ProgrammableVoiceProfiles.js +0 -191
  48. package/src/domains/voice/SipProfiles.js +0 -203
  49. package/src/domains/voice/SipTrunks.js +0 -203
  50. package/src/domains/voice/Tokens.js +0 -96
  51. package/src/domains/voice/browser/Call.js +0 -366
  52. package/src/domains/voice/browser/Device.js +0 -484
  53. package/src/domains/voice/browser/index.js +0 -17
  54. package/src/webhooks/verifySignature.js +0 -66
@@ -1,566 +0,0 @@
1
- /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
- /**
3
- * @template T
4
- * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
- */
6
-
7
- /**
8
- * @typedef {string} BrandLookupId - Carrier Brand ID (B…, TFNB…, or SCB…), Mongo `_id`, or internal reference UUID.
9
- * Use on update, delete, revet, vetting, appeal, and transfer routes. Pending brands return `brandId: null`
10
- * in read/create responses — poll `GET /brand?id=<Mongo _id>` until a carrier Brand ID is assigned.
11
- */
12
-
13
- /**
14
- * @typedef {Object} CreateBrandData
15
- * @property {string} subgroupId - The ID of the subgroup to create the brand under
16
- * @property {string} entityType - The type of entity for the brand (PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, GOVERNMENT)
17
- * @property {string} displayName - The display name for the brand
18
- * @property {string} companyName - The company name for the brand
19
- * @property {string} ein - The EIN (Employer Identification Number) for the brand
20
- * @property {string} [einIssuingCountry] - The country that issued the EIN for the brand
21
- * @property {string} [altBusinessId] - An alternative business identifier for the brand (e.g., DUNS number)
22
- * @property {string} [altBusinessIdType] - The type of the alternative business identifier ("NONE", "DUNS", "LEI", "GIIN")
23
- * @property {string} [firstName] - The first name of the primary contact for the brand
24
- * @property {string} [lastName] - The last name of the primary contact for the brand
25
- * @property {string} phone - The phone number of the primary contact for the brand
26
- * @property {string} street - The street address of the primary contact for the brand
27
- * @property {string} city - The city of the primary contact for the brand
28
- * @property {string} state - The state of the primary contact for the brand
29
- * @property {string} postalCode - The postal code of the primary contact for the brand
30
- * @property {string} country - The country code of the primary contact for the brand (e.g., "US")
31
- * @property {string} email - The email address of the primary contact for the brand
32
- * @property {string} [mobilePhone] - The mobile phone number of the primary contact for the brand
33
- * @property {string} [stockSymbol] - The stock symbol for the brand if it is a publicly traded company
34
- * @property {string} [stockExchange] - The stock exchange where the brand is listed if it is a publicly traded company
35
- * @property {string} [website] - The website URL for the brand
36
- * @property {string} vertical - The vertical for the brand (PROFESSIONAL, REAL_ESTATE, HEALTHCARE, HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION, AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO, MANUFACTURING, GOVERNMENT, TECHNOLOGY, COMMUNICATION)
37
- * @property {string} [referenceId] - A unique reference for the brand
38
- * @property {Array<string>} [tag] - An array of tags to associate with the brand
39
- * @property {boolean} [mock] - Whether to register the brand in TCR's mock environment instead of the live registry. TCR is still called and the mock brand auto-approves, so it does not exercise the rejection states a live registration can hit. Brand creation is not billed; campaign registration and number purchase are still billed as normal
40
- * @property {string} [businessContactEmail] - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
41
- */
42
-
43
- /**
44
- * @typedef {Object} UpdateBrandData
45
- * @property {string} [companyName] - The company name for the brand
46
- * @property {string} [ein] - The EIN (Employer Identification Number) for the brand
47
- * @property {string} [einIssuingCountry] - The country that issued the EIN for the brand
48
- * @property {string} [entityType] - The type of entity for the brand (PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, GOVERNMENT)
49
- * @property {string} [firstName] - The first name of the primary contact for the brand
50
- * @property {string} [lastName] - The last name of the primary contact for the brand
51
- * @property {string} [displayName] - The display name for the brand
52
- * @property {string} [website] - The website URL for the brand
53
- * @property {string} [street] - The street address of the primary contact for the brand
54
- * @property {string} [city] - The city of the primary contact for the brand
55
- * @property {string} [state] - The state of the primary contact for the brand
56
- * @property {string} [postalCode] - The postal code of the primary contact for the brand
57
- * @property {string} [country] - The country code of the primary contact for the brand (e.g., "US")
58
- * @property {string} [email] - The email address of the primary contact for the brand
59
- * @property {string} [referenceId] - A unique reference for the brand
60
- * @property {string} [phone] - The phone number of the primary contact for the brand
61
- * @property {string} [vertical] - The vertical for the brand (PROFESSIONAL, REAL_ESTATE, HEALTHCARE, HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION, AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO, MANUFACTURING, GOVERNMENT, TECHNOLOGY, COMMUNICATION)
62
- * @property {string} [stockSymbol] - The stock symbol for the brand if it is a publicly traded company
63
- * @property {string} [stockExchange] - The stock exchange where the brand is listed if it is a publicly traded company
64
- * @property {string} [altBusinessId] - An alternative business identifier for the brand (e.g., DUNS number)
65
- * @property {string} [altBusinessIdType] - The type of the alternative business identifier ("NONE", "DUNS", "LEI", "GIIN")
66
- * @property {string} [brandRelationship] - Not in use - reserved for future use
67
- * @property {string} [businessContactEmail] - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
68
- * @property {Object} [tollFree] - Toll-Free editable fields, used when updating a Toll-Free brand. Optional sub-fields: legalEntityType, businessRegistrationType, taxId, countryCode, supportPhone, taxIdIssuingCountry, businessDBA, businessWebsite. supportPhone must be E.164 with an optional leading "+" and no spaces, parentheses or hyphens (e.g. "17025550100"). (Toll-Free brands sync to Infobip; only DCA_PENDING/DCA_ACTIVE brands are editable and subgroupId is immutable.)
69
- */
70
-
71
- /**
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)
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)
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
- * @property {string} [taxIdIssuingCountry] - The country that issued the tax ID (optional, 2-letter ISO code)
79
- * @property {string} [businessDBA] - The business "doing business as" name (optional, at most 255 characters)
80
- * @property {string} [businessWebsite] - The customer's real website, sent to Infobip for brand verification (optional, valid URL, at most 255 characters; distinct from the top-level website / landing URL)
81
- */
82
-
83
- /**
84
- * @typedef {Object} BusinessVerificationDetails
85
- * @property {string} businessName - The legal business name (required, at most 255 characters)
86
- * @property {string} businessType - The business type (required, one of CO_OPERATIVE, CORPORATION, LIMITED_LIABILITY_CORPORATION, NON_PROFIT_CORPORATION, PARTNERSHIP)
87
- * @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)
88
- * @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)
89
- * @property {string} registrationNumber - The business registration number, e.g. the EIN (required, at most 50 characters)
90
- * @property {string} website - The business website (required, valid URL, at most 255 characters)
91
- * @property {string} street - The business street address (required, at most 255 characters)
92
- * @property {string} [street2] - The second line of the street address (optional, at most 255 characters)
93
- * @property {string} city - The business city (required, at most 100 characters)
94
- * @property {string} state - The business state or province (required, 2-letter code)
95
- * @property {string} postalCode - The business postal code (required, at most 10 characters)
96
- * @property {string} country - The business country (required, "US" or "CA")
97
- * @property {Object} representative - The business's authorized representative (required)
98
- * @property {string} representative.firstName - The representative's first name (required, at most 100 characters)
99
- * @property {string} representative.lastName - The representative's last name (required, at most 100 characters)
100
- * @property {string} representative.email - The representative's email address (required, valid email, at most 100 characters)
101
- * @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")
102
- * @property {string} representative.jobTitle - The representative's job title (required, at most 100 characters)
103
- * @property {string} representative.jobLevel - The representative's job level (required, one of DIRECTOR, GM, VP, CEO, CFO, GENERAL_COUNSEL, OTHER)
104
- */
105
-
106
- /**
107
- * @typedef {Object} TollFreeIsvAccount
108
- * @property {string} groupId - The group the account is registered to
109
- * @property {string} accountSid - The SID of the group's own top-level account at the toll-free provider
110
- * @property {string} apiKeySid - The SID of the API key Signal House uses in that account (its secret is never returned)
111
- * @property {string} primaryProfileSid - The SID of the account's approved primary business profile, found when the account was registered
112
- * @property {string} createdAt - When the account was first registered (ISO date)
113
- * @property {string} updatedAt - When the account or its API key was last saved (ISO date)
114
- */
115
-
116
- /**
117
- * @typedef {Object} CreateTollFreeBrandData
118
- * @property {string} subgroupId - The ID of the subgroup to create the brand under (required, exactly 8 characters)
119
- * @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)
125
- * @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)
128
- * @property {string} website - The website URL for the brand (required, valid URL, at most 255 characters)
129
- * @property {TollFreeBrandDetails} tollFree - The Toll-Free brand details (required)
130
- * @property {string} [referenceId] - A unique reference for the brand (optional, at most 50 characters)
131
- * @property {Array<string>} [tag] - An array of tags to associate with the brand (optional)
132
- * @property {boolean} [mock] - Accepted and stored, but has no effect on Toll-Free registration: Toll-Free does not use TCR and is already free
133
- * @property {string} [optInLink] - A URL linking to the opt-in flow for the brand (optional, valid URL, at most 255 characters)
134
- * @property {string} [privacyPolicyLink] - A URL linking to the privacy policy for the brand (optional, valid URL, at most 255 characters)
135
- * @property {string} [termsAndConditionsLink] - A URL linking to the terms and conditions for the brand (optional, valid URL, at most 255 characters)
136
- * @property {string} [landingId] - The ID of the landing page associated with the brand (optional)
137
- * @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)
138
- */
139
-
140
- /**
141
- * @typedef {Object} CreateShortCodeBrandData
142
- * @property {string} subgroupId - The ID of the subgroup to create the brand under.
143
- * @property {string} displayName - The Short Code brand display name.
144
- * @property {string} companyName - The official company name.
145
- * @property {string} street - The street address.
146
- * @property {string} city - The city.
147
- * @property {string} state - The state or province.
148
- * @property {string} postalCode - The postal code.
149
- * @property {string} country - The 2-letter country code.
150
- * @property {string} email - The support email address.
151
- * @property {string} firstName - The contact's first name.
152
- * @property {string} lastName - The contact's last name.
153
- * @property {string} website - The company website URL.
154
- * @property {{ businessRegistrationType: string, legalEntityType: string, taxId: string, countryCode: string, supportPhone: string }} shortCode - Short Code registration details.
155
- */
156
-
157
- export class Brands {
158
- constructor(client, multipartClient, enableAdmin) {
159
- this.client = client;
160
- this.multipartClient = multipartClient;
161
- this.enableAdmin = enableAdmin;
162
- }
163
-
164
- /**
165
- * Get a list of brands with optional filters
166
- * @async
167
- * @roles api, admin, developer, user
168
- * @param {Object} params - The parameters for filtering the brands
169
- * @param {string} [params.id] - Brand lookup id (carrier Brand ID, Mongo _id, or internal reference)
170
- * @param {string} [params.subgroupId] - The ID of the subgroup to filter by
171
- * @param {string} [params.groupId] - The ID of the group to filter by
172
- * @param {number} [params.page] - The page number for pagination
173
- * @param {number} [params.limit] - The number of items per page
174
- * @param {string} [params.status] - The status of the brand to filter by (PENDING_CREATION, PENDING_APPROVAL, UNVERIFIED, VERIFIED, VETTED_VERIFIED, PENDING_DELETE, DELETED)
175
- * @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC", "TOLL_FREE", or "SHORT_CODE")
176
- * @param {boolean} [params.currentTollFreeCarrier] - With subgroupId or groupId: when true, return only toll-free brands that a new toll-free campaign in that group can use (those on the group's current toll-free carrier)
177
- * @param {string} [params.search] - Staff-only (no id/subgroupId/groupId): case-insensitive substring over brandId, names, EIN, email, group, subgroup and reference ID
178
- * @param {string} [params.sortBy] - Staff-only: createdAt, brandId, displayName, groupId, subgroupId, status, entityType or country
179
- * @param {"asc"|"desc"} [params.sortOrder] - Staff-only: sort direction (default asc)
180
- * @param {string} [params.entityType] - Staff-only: exact entity type filter
181
- * @param {string} [params.ein] - Staff-only: EIN substring filter
182
- * @param {string} [params.email] - Staff-only: support email substring filter
183
- * @param {string} [params.referenceId] - Staff-only: reference ID substring filter
184
- * @param {string|Array<string>} [params.groupIds] - Staff-only: restrict to these group IDs (sent comma-separated)
185
- * @param {string} [params.createdFrom] - Staff-only: inclusive createdAt lower bound (ISO date)
186
- * @param {string} [params.createdTo] - Staff-only: inclusive createdAt upper bound (ISO date)
187
- * @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
188
- * @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
189
- * @param {RequestOptions} [params.options] - Additional options for the request
190
- * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, usesBusinessVerification?: boolean, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.usesBusinessVerification` (whether it waits on the business verification that applies to its subgroup). The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit.
191
- */
192
- async getBrands({
193
- id,
194
- subgroupId,
195
- groupId,
196
- page,
197
- limit,
198
- status,
199
- registrationType,
200
- currentTollFreeCarrier,
201
- search,
202
- sortBy,
203
- sortOrder,
204
- entityType,
205
- ein,
206
- email,
207
- referenceId,
208
- groupIds,
209
- createdFrom,
210
- createdTo,
211
- excludeDeleted,
212
- includeTotal,
213
- options = {},
214
- }) {
215
- const filters = {
216
- id,
217
- subgroupId,
218
- groupId,
219
- page,
220
- limit,
221
- status,
222
- registrationType,
223
- currentTollFreeCarrier,
224
- search,
225
- sortBy,
226
- sortOrder,
227
- entityType,
228
- ein,
229
- email,
230
- referenceId,
231
- groupIds: Array.isArray(groupIds) ? (groupIds.length ? groupIds.join(',') : undefined) : groupIds,
232
- createdFrom,
233
- createdTo,
234
- excludeDeleted,
235
- includeTotal,
236
- };
237
- const queryString = this.client._getQueryString(filters);
238
- return this.client(`/brand${queryString}`, { method: 'GET', ...options });
239
- }
240
-
241
- /**
242
- * Get external vetting information for a brand
243
- * @async
244
- * @roles api, admin, developer, user
245
- * @param {Object} params - The parameters for getting the external vetting information
246
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
247
- * @param {RequestOptions} [params.options] - Additional options for the request
248
- * @throws {Error} Throws an error if the brandId parameter is missing
249
- * @returns {Promise<SdkResponse<any>>} The response from the server
250
- */
251
- async getExternalVetting({ brandId, options = {} }) {
252
- this.client._require({ brandId });
253
- const safeBrandId = encodeURIComponent(brandId);
254
- return this.client(`/brand/externalvetting/${safeBrandId}`, { method: 'GET', ...options });
255
- }
256
-
257
- /**
258
- * Create a new brand
259
- * @async
260
- * @roles api, admin, developer, billing, user
261
- * @param {Object} params - The parameters for creating the brand (see CreateBrandData typedef for details)
262
- * @param {CreateBrandData} params.brandData - The data for the brand to be created
263
- * @param {RequestOptions} [params.options] - Additional options for the request
264
- * @throws {Error} Throws an error if the brandData parameter is missing or if required fields in brandData are missing
265
- * @returns {Promise<SdkResponse<any>>} Brand entity. `brandId` is `null` until the carrier assigns a Brand ID — use `_id` to poll status.
266
- */
267
- async createBrand({ brandData, options = {} }) {
268
- this.client._require({ brandData: brandData });
269
- return this.client(`/brand`, { method: 'POST', body: brandData, ...options });
270
- }
271
-
272
- /**
273
- * Create a new Toll-Free (TFN) brand
274
- * @async
275
- * @roles api, admin, developer, billing, user
276
- * @param {Object} params - The parameters for creating the toll-free brand
277
- * @param {CreateTollFreeBrandData} params.brandData - The data for the toll-free brand to be created (see CreateTollFreeBrandData typedef for details; TFN-specific fields live under brandData.tollFree, and registrationType is forced server-side by the route)
278
- * @param {RequestOptions} [params.options] - Additional options for the request
279
- * @throws {Error} Throws an error if the brandData parameter is missing
280
- * @returns {Promise<SdkResponse<any>>} Brand entity. For Toll-Free, `brandId` is a TFNB-prefixed id when assigned; otherwise `null` — use `_id` to poll.
281
- */
282
- async createTollFreeBrand({ brandData, options = {} }) {
283
- this.client._require({ brandData });
284
- return this.client(`/brand/toll-free`, { method: 'POST', body: brandData, ...options });
285
- }
286
-
287
- /**
288
- * Get a group's business verification: whether its toll-free brands need one, its status and the submitted details.
289
- * Some groups verify each subgroup's business separately: a platform whose subgroups are separate businesses, set up by
290
- * Signal House. For those groups pass the subgroup whose business verification to get.
291
- * @async
292
- * @roles api, admin, developer, billing, user
293
- * @param {Object} params - The parameters for getting the business verification
294
- * @param {string} params.groupId - The ID of the group whose business verification to get
295
- * @param {string} [params.subgroupId] - The subgroup whose business verification to get, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored
296
- * @param {RequestOptions} [params.options] - Additional options for the request
297
- * @throws {Error} Throws an error if the groupId parameter is missing
298
- * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} The business verification. `subgroupId` is present only when it belongs to one subgroup: the subgroup whose business it describes. `required` says whether the group's new toll-free brands need one; `status` is NOT_STARTED, SUBMITTING, IN_REVIEW, VERIFIED or NEEDS_CHANGES; `rejectionReason` says why it needs changes, or is null. When `required` is true and `status` is NOT_STARTED, submit it before creating the first toll-free brand it covers. The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, and 404 when the subgroup is not in the group.
299
- */
300
- async getBusinessVerification({ groupId, subgroupId, options = {} }) {
301
- this.client._require({ groupId });
302
- const queryString = this.client._getQueryString({ subgroupId });
303
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'GET', ...options });
304
- }
305
-
306
- /**
307
- * Submit or update a group's business verification, or one subgroup's in a group that verifies each subgroup's business
308
- * separately. Allowed when it is not started or needs changes. Review usually takes 1–2 business days; the toll-free
309
- * brands it covers stay pending until it is verified.
310
- * @async
311
- * @roles api, admin, developer, billing, user
312
- * @param {Object} params - The parameters for submitting the business verification
313
- * @param {string} params.groupId - The ID of the group whose business verification to submit (must be the caller's active group)
314
- * @param {string} [params.subgroupId] - The subgroup whose business verification to submit, sent as a query parameter only when given. Required for a group that verifies each subgroup's business separately; for any other group it must be one of the group's subgroups and is otherwise ignored. The subgroup must be active
315
- * @param {BusinessVerificationDetails} params.details - The business verification details (see BusinessVerificationDetails typedef for details)
316
- * @param {RequestOptions} [params.options] - Additional options for the request
317
- * @throws {Error} Throws an error if the groupId or details parameter is missing
318
- * @returns {Promise<SdkResponse<{ groupId: string, subgroupId?: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} A 202 with the business verification, now SUBMITTING (the same shape as getBusinessVerification, with `subgroupId` only when it belongs to one subgroup). The API returns 400 when the group verifies each subgroup's business separately and no subgroupId is given, or when the subgroup is inactive, and 404 when the subgroup is not in the group.
319
- */
320
- async submitBusinessVerification({ groupId, subgroupId, details, options = {} }) {
321
- this.client._require({ groupId, details });
322
- const queryString = this.client._getQueryString({ subgroupId });
323
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}${queryString}`, { method: 'PUT', body: details, ...options });
324
- }
325
-
326
- /**
327
- * Get a group's toll-free ISV account: the group's own top-level account at the toll-free provider, used when its
328
- * subgroups are separate businesses. Each subgroup gets an account and a business verification of its own under it.
329
- * Staff only.
330
- * @async
331
- * @roles signalhouse_api, signalhouse_admin, signalhouse_user
332
- * @param {Object} params - The parameters for getting the toll-free ISV account
333
- * @param {string} params.groupId - The ID of the group whose toll-free ISV account to get
334
- * @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<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.
337
- */
338
- async getTollFreeIsvAccount({ groupId, options = {} }) {
339
- this.client._require({ groupId });
340
- return this.client(`/brand/toll-free-isv-account/${encodeURIComponent(groupId)}`, { method: 'GET', ...options });
341
- }
342
-
343
- /**
344
- * Register a group's toll-free ISV account, or replace the API key of the account it already has. Staff only. The
345
- * toll-free provider checks the account and key before they are stored. Register it before the group has any toll-free
346
- * records at the provider; after that, only the API key of the same account can be replaced.
347
- * @async
348
- * @roles signalhouse_admin
349
- * @param {Object} params - The parameters for setting the toll-free ISV account
350
- * @param {string} params.groupId - The ID of the group whose toll-free ISV account to set
351
- * @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)
352
- * @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)
353
- * @param {string} params.apiKeySecret - The API key's secret (1 to 128 characters), stored encrypted and never returned
354
- * @param {RequestOptions} [params.options] - Additional options for the request
355
- * @throws {Error} Throws an error if the groupId, accountSid, apiKeySid or apiKeySecret parameter is missing
356
- * @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.
357
- */
358
- async setTollFreeIsvAccount({ groupId, accountSid, apiKeySid, apiKeySecret, options = {} }) {
359
- this.client._require({ groupId, accountSid, apiKeySid, apiKeySecret });
360
- return this.client(`/brand/toll-free-isv-account/${encodeURIComponent(groupId)}`, {
361
- method: 'PUT',
362
- body: { accountSid, apiKeySid, apiKeySecret },
363
- ...options,
364
- });
365
- }
366
-
367
- /**
368
- * Create a local Short Code brand for manual Signal House review.
369
- * @async
370
- * @roles api, admin, developer, billing, user
371
- * @param {Object} params - The creation parameters.
372
- * @param {CreateShortCodeBrandData} params.brandData - The Short Code brand data. The route forces registrationType server-side.
373
- * @param {RequestOptions} [params.options] - Additional options for the request.
374
- * @returns {Promise<SdkResponse<any>>} A 201-created Short Code brand with a stable SCB-prefixed ID and PENDING_APPROVAL status.
375
- */
376
- async createShortCodeBrand({ brandData, options = {} }) {
377
- this.client._require({ brandData });
378
- return this.client(`/brand/short-code`, { method: 'POST', body: brandData, ...options });
379
- }
380
-
381
- /**
382
- * Approve a pending Short Code brand.
383
- * @async
384
- * @roles signalhouse_admin
385
- * @param {Object} params - The approval parameters.
386
- * @param {BrandLookupId} params.brandId - The pending Short Code brand lookup ID.
387
- * @param {RequestOptions} [params.options] - Additional options for the request.
388
- * @returns {Promise<SdkResponse<any>>} The verified Short Code brand.
389
- */
390
- async approveShortCodeBrand({ brandId, options = {} }) {
391
- this.client._require({ brandId });
392
- return this.client(`/brand/approve/${encodeURIComponent(brandId)}`, { method: 'POST', ...options });
393
- }
394
-
395
- /**
396
- * Reject a pending Short Code brand with a customer-visible reason.
397
- * @async
398
- * @roles signalhouse_admin
399
- * @param {Object} params - The rejection parameters.
400
- * @param {BrandLookupId} params.brandId - The pending Short Code brand lookup ID.
401
- * @param {string} params.internalRejectionReason - Required customer-visible rejection reason.
402
- * @param {RequestOptions} [params.options] - Additional options for the request.
403
- * @returns {Promise<SdkResponse<any>>} The rejected Short Code brand.
404
- */
405
- async rejectShortCodeBrand({ brandId, internalRejectionReason, options = {} }) {
406
- this.client._require({ brandId, internalRejectionReason });
407
- return this.client(`/brand/reject/${encodeURIComponent(brandId)}`, {
408
- method: 'POST',
409
- body: { internalRejectionReason },
410
- ...options,
411
- });
412
- }
413
-
414
- /**
415
- * Transfer one or more brands to a different subgroup
416
- * @async
417
- * @roles api, admin, developer, billing, user
418
- * @param {Object} params - The parameters for transferring the brands
419
- * @param {string} params.subgroupId - The ID of the subgroup to transfer the brands to
420
- * @param {BrandLookupId[]} params.brandIds - Brand lookup ids to transfer (carrier id, Mongo `_id`, or internal reference).
421
- * @param {RequestOptions} [params.options] - Additional options for the request
422
- * @throws {Error} Throws an error if the subgroupId or brandIds parameters are missing
423
- * @returns {Promise<SdkResponse<any>>} The response from the server
424
- */
425
- async transferBrand({ subgroupId, brandIds, options = {} }) {
426
- this.client._require({ subgroupId, brandIds });
427
- const safeSubgroupId = encodeURIComponent(subgroupId);
428
- return this.client(`/brand/transfer/${safeSubgroupId}`, { method: 'POST', body: { brandIds }, ...options });
429
- }
430
-
431
- /**
432
- * Create external vetting for a brand
433
- * @async
434
- * @roles api, admin, developer, billing, user
435
- * @param {Object} params - The parameters for creating external vetting
436
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
437
- * @param {string} params.vettingProviderId - The external vetting provider: AEGIS or WMC
438
- * @param {string} params.vettingClass - The vetting class: STANDARD, ENHANCED, AUTHPLUS, or RCS (AEGIS accepts all four; WMC accepts STANDARD only)
439
- * @param {Object} [params.additionalData] - Provider-specific additional data forwarded to TCR
440
- * @param {RequestOptions} [params.options] - Additional options for the request
441
- * @throws {Error} Throws an error if the brandId, vettingProviderId, or vettingClass parameter is missing
442
- * @returns {Promise<SdkResponse<any>>} The response from the server
443
- */
444
- async createExternalVetting({ brandId, vettingProviderId, vettingClass, additionalData, options = {} }) {
445
- this.client._require({ brandId, vettingProviderId, vettingClass });
446
- const safeBrandId = encodeURIComponent(brandId);
447
- const body = { vettingProviderId, vettingClass };
448
- if (additionalData !== undefined) body.additionalData = additionalData;
449
- return this.client(`/brand/externalvetting/${safeBrandId}`, { method: 'POST', body, ...options });
450
- }
451
-
452
- /**
453
- * Import an existing external vetting record for a brand
454
- *
455
- * Unlike createExternalVetting (which orders a new, billable vetting), this attaches a vetting the
456
- * brand already completed directly with the provider, using the provider-issued vettingId and
457
- * vettingToken. It is synchronous and not billable.
458
- * @async
459
- * @roles api, admin, developer, billing, user
460
- * @param {Object} params - The parameters for importing external vetting
461
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
462
- * @param {string} params.vettingProviderId - The external vetting provider (AEGIS, WMC, CV)
463
- * @param {string} params.vettingId - The provider-issued vetting / transaction ID to import
464
- * @param {string} [params.vettingToken] - The provider-issued vetting token (required by some providers, e.g. AEGIS)
465
- * @param {RequestOptions} [params.options] - Additional options for the request
466
- * @throws {Error} Throws an error if brandId, vettingProviderId, or vettingId is missing
467
- * @returns {Promise<SdkResponse<any>>} The response from the server
468
- */
469
- async importExternalVetting({ brandId, vettingProviderId, vettingId, vettingToken, options = {} }) {
470
- this.client._require({ brandId, vettingProviderId, vettingId });
471
- const safeBrandId = encodeURIComponent(brandId);
472
- return this.client(`/brand/externalvetting/import/${safeBrandId}`, {
473
- method: 'POST',
474
- body: { vettingProviderId, vettingId, vettingToken },
475
- ...options,
476
- });
477
- }
478
-
479
- /**
480
- * Update a brand's information
481
- * @async
482
- * @roles api, admin, developer, billing, user
483
- * @param {Object} params - The parameters for updating the brand (see UpdateBrandData typedef for details)
484
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
485
- * @param {UpdateBrandData} params.brandData - The data for the brand to be updated
486
- * @param {RequestOptions} [params.options] - Additional options for the request
487
- * @throws {Error} Throws an error if the brandId parameter is missing
488
- * @returns {Promise<SdkResponse<any>>} The response from the server
489
- */
490
- async updateBrand({ brandId, brandData, options = {} }) {
491
- this.client._require({ brandId });
492
- const safeBrandId = encodeURIComponent(brandId);
493
- return this.client(`/brand/${safeBrandId}`, { method: 'PUT', body: brandData, ...options });
494
- }
495
-
496
- /**
497
- * Revet a brand that is in UNVERIFIED status due to an update afer it was previously VERIFIED or VETTED_VERIFIED
498
- * @async
499
- * @roles api, admin, developer, billing, user
500
- * @param {Object} params - The parameters for reverting the brand
501
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
502
- * @param {RequestOptions} [params.options] - Additional options for the request
503
- * @throws {Error} Throws an error if the brandId parameter is missing
504
- * @returns {Promise<SdkResponse<any>>} The response from the server
505
- */
506
- async revetBrand({ brandId, options = {} }) {
507
- this.client._require({ brandId });
508
- const safeBrandId = encodeURIComponent(brandId);
509
- return this.client(`/brand/revet/${safeBrandId}`, { method: 'PUT', ...options });
510
- }
511
-
512
- /**
513
- * Delete a brand (mark it as DELETED). The brand will still be retrievable
514
- * @async
515
- * @roles api, admin, developer, billing, user
516
- * @param {Object} params - The parameters for deleting the brand
517
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
518
- * @param {RequestOptions} [params.options] - Additional options for the request
519
- * @throws {Error} Throws an error if the brandId parameter is missing
520
- * @returns {Promise<SdkResponse<any>>} The response from the server
521
- */
522
- async deleteBrand({ brandId, options = {} }) {
523
- this.client._require({ brandId });
524
- const safeBrandId = encodeURIComponent(brandId);
525
- return this.client(`/brand/${safeBrandId}`, { method: 'DELETE', ...options });
526
- }
527
-
528
- /**
529
- * Get appeal history for a brand
530
- * @async
531
- * @roles api, admin, developer, billing, user
532
- * @param {Object} params - The parameters for getting the appeal history
533
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
534
- * @param {RequestOptions} [params.options] - Additional options for the request
535
- * @throws {Error} Throws an error if the brandId parameter is missing
536
- * @returns {Promise<SdkResponse<Array>>} Array of BrandAppeal objects
537
- */
538
- async getAppealHistory({ brandId, options = {} }) {
539
- this.client._require({ brandId });
540
- const safeBrandId = encodeURIComponent(brandId);
541
- return this.client(`/brand/appeal/${safeBrandId}`, { method: 'GET', ...options });
542
- }
543
-
544
- /**
545
- * Submit a brand identity status appeal with supporting documentation
546
- * @async
547
- * @roles api, admin, developer, billing, user
548
- * @param {Object} params - The parameters for submitting the appeal
549
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
550
- * @param {Array<string>} params.appealCategories - Array of appeal categories (VERIFY_TAX_ID, VERIFY_NON_PROFIT, VERIFY_GOVERNMENT)
551
- * @param {string} params.explanation - Required explanation justifying the appeal
552
- * @param {File|Blob} params.file - The supporting document file
553
- * @param {RequestOptions} [params.options] - Additional options for the request
554
- * @throws {Error} Throws an error if required parameters are missing
555
- * @returns {Promise<SdkResponse<any>>} The response from the server
556
- */
557
- async submitAppeal({ brandId, appealCategories, explanation, file, options = {} }) {
558
- this.client._require({ brandId, appealCategories, explanation, file });
559
- const safeBrandId = encodeURIComponent(brandId);
560
- const formData = new FormData();
561
- formData.append('appealCategories', JSON.stringify(appealCategories));
562
- formData.append('explanation', explanation);
563
- formData.append('file', file);
564
- return this.multipartClient(`/brand/appeal/${safeBrandId}`, { method: 'POST', body: formData, ...options });
565
- }
566
- }