@signalhousellc/sdk 1.0.51 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhousellc/sdk",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -53,6 +53,42 @@
53
53
  * @property {string} [altBusinessIdType] - The type of the alternative business identifier ("NONE", "DUNS", "LEI", "GIIN")
54
54
  * @property {string} [brandRelationship] - Not in use - reserved for future use
55
55
  * @property {string} [businessContactEmail] - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
56
+ * @property {Object} [tollFree] - Toll-Free editable fields, used when updating a Toll-Free brand. Optional sub-fields: legalEntityType, businessRegistrationType, taxId, countryCode, supportPhone, taxIdIssuingCountry, businessDBA. (Toll-Free brands sync to Infobip; only DCA_PENDING/DCA_ACTIVE brands are editable and subgroupId is immutable.)
57
+ */
58
+
59
+ /**
60
+ * @typedef {Object} TollFreeBrandDetails
61
+ * @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)
62
+ * @property {string} legalEntityType - The legal entity type (required, one of PRIVATE_COMPANY, PUBLIC_COMPANY, NON_PROFIT, GOVERNMENT, SOLE_PROPRIETOR)
63
+ * @property {string} taxId - The business tax identifier (required, at most 50 characters)
64
+ * @property {string} countryCode - The business country code (required, 2-letter ISO code)
65
+ * @property {string} supportPhone - The customer-support phone number (required, at most 20 characters)
66
+ * @property {string} [taxIdIssuingCountry] - The country that issued the tax ID (optional, 2-letter ISO code)
67
+ * @property {string} [businessDBA] - The business "doing business as" name (optional, at most 255 characters)
68
+ */
69
+
70
+ /**
71
+ * @typedef {Object} CreateTollFreeBrandData
72
+ * @property {string} subgroupId - The ID of the subgroup to create the brand under (required, exactly 8 characters)
73
+ * @property {string} displayName - The display name for the brand (required, at most 255 characters)
74
+ * @property {string} companyName - The company name for the brand (required, at most 255 characters)
75
+ * @property {string} street - The street address of the primary contact for the brand (required, at most 255 characters)
76
+ * @property {string} city - The city of the primary contact for the brand (required, at most 100 characters)
77
+ * @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")
78
+ * @property {string} postalCode - The postal code of the primary contact for the brand (required, at most 10 characters)
79
+ * @property {string} email - The email address of the primary contact for the brand (required, valid email, at most 100 characters)
80
+ * @property {string} firstName - The first name of the primary contact for the brand (required, at most 100 characters)
81
+ * @property {string} lastName - The last name of the primary contact for the brand (required, at most 100 characters)
82
+ * @property {string} website - The website URL for the brand (required, valid URL, at most 255 characters)
83
+ * @property {TollFreeBrandDetails} tollFree - The Toll-Free brand details (required)
84
+ * @property {string} [referenceId] - A unique reference for the brand (optional, at most 50 characters)
85
+ * @property {Array<string>} [tag] - An array of tags to associate with the brand (optional)
86
+ * @property {boolean} [mock] - Whether to create the brand in the mock environment (for testing purposes only)
87
+ * @property {string} [optInLink] - A URL linking to the opt-in flow for the brand (optional, valid URL, at most 255 characters)
88
+ * @property {string} [privacyPolicyLink] - A URL linking to the privacy policy for the brand (optional, valid URL, at most 255 characters)
89
+ * @property {string} [termsAndConditionsLink] - A URL linking to the terms and conditions for the brand (optional, valid URL, at most 255 characters)
90
+ * @property {string} [landingId] - The ID of the landing page associated with the brand (optional)
91
+ * @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)
56
92
  */
57
93
 
58
94
  export class Brands {
@@ -73,11 +109,12 @@ export class Brands {
73
109
  * @param {number} [params.page] - The page number for pagination
74
110
  * @param {number} [params.limit] - The number of items per page
75
111
  * @param {string} [params.status] - The status of the brand to filter by (PENDING_CREATION, PENDING_APPROVAL, UNVERIFIED, VERIFIED, VETTED_VERIFIED, PENDING_DELETE, DELETED)
112
+ * @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC" or "TOLL_FREE")
76
113
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
77
114
  * @returns {Promise<Array>} The response from the server
78
115
  */
79
- async getBrands({ id, subgroupId, groupId, page, limit, status, options = {} }) {
80
- const filters = { id, subgroupId, groupId, page, limit, status };
116
+ async getBrands({ id, subgroupId, groupId, page, limit, status, registrationType, options = {} }) {
117
+ const filters = { id, subgroupId, groupId, page, limit, status, registrationType };
81
118
  const queryString = this.client._getQueryString(filters);
82
119
  return this.client(`/brand${queryString}`, { method: "GET", ...options });
83
120
  }
@@ -113,6 +150,21 @@ export class Brands {
113
150
  return this.client(`/brand`, { method: "POST", body: brandData, ...options });
114
151
  }
115
152
 
153
+ /**
154
+ * Create a new Toll-Free (TFN) brand
155
+ * @async
156
+ * @roles api, admin, developer, billing, user
157
+ * @param {Object} params - The parameters for creating the toll-free brand
158
+ * @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)
159
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
160
+ * @throws {Error} Throws an error if the brandData parameter is missing
161
+ * @returns {Promise<Object>} The response from the server
162
+ */
163
+ async createTollFreeBrand({ brandData, options = {} }) {
164
+ this.client._require({ brandData });
165
+ return this.client(`/brand/toll-free`, { method: "POST", body: brandData, ...options });
166
+ }
167
+
116
168
  /**
117
169
  * Transfer one or more brands to a different subgroup
118
170
  * @async
@@ -64,6 +64,41 @@
64
64
  * @property {string} [privacyPolicyLink] - A URL linking to the privacy policy for the campaign (optional, must be at most 2048 characters if provided)
65
65
  * @property {string} [termsAndConditionsLink] - A URL linking to the terms and conditions for the campaign (optional, must be at most 2048 characters if provided)
66
66
  * @property {string} [embeddedLinkSample] - A sample of the embedded link used in the campaign (optional, must be at most 255 characters if provided)
67
+ * @property {Object} [tollFree] - Toll-Free editable fields, used when updating a Toll-Free campaign. Mirrors the CreateTollFreeCampaignData `tollFree` object with every field optional (useCase, messageVolume, programSummary (≤500), exampleMessage, customerCareEmail, optInImageURLs, optIns, additionalInformation (≤500)). Phone numbers cannot be changed via update — Toll-Free numbers are locked to their campaign.
68
+ */
69
+
70
+ /**
71
+ * @typedef {Object} TollFreeOptIn
72
+ * @property {string} [callToAction] - The opt-in call-to-action text for this channel (optional, at most 2048 characters)
73
+ * @property {string} [url] - The opt-in web URL (web channel only, optional, at most 2048 characters)
74
+ * @property {Array<string>} [keywords] - The opt-in keywords (keyword channel only, optional)
75
+ */
76
+
77
+ /**
78
+ * @typedef {Object} TollFreeCampaignDetails
79
+ * @property {string} useCase - The Toll-Free use case (required, e.g. TWO_FA, GENERAL_MARKETING, HEALTHCARE, MIXED — one of the Toll-Free use-case values)
80
+ * @property {string} messageVolume - The estimated monthly message volume tier (required, one of TEN, HUNDRED, THOUSAND, TEN_THOUSAND, HUNDRED_THOUSAND, TWO_HUNDRED_FIFTY_THOUSAND, FIVE_HUNDRED_THOUSAND, SEVEN_HUNDRED_FIFTY_THOUSAND, ONE_MILLION, FIVE_MILLION, TEN_MILLION_PLUS)
81
+ * @property {string} programSummary - A summary of the messaging program (required, at most 500 characters)
82
+ * @property {string} exampleMessage - An example message (required, at most 4096 characters; stored verbatim, no STOP/HELP appended by the server)
83
+ * @property {string} customerCareEmail - A customer-care contact email (required, valid email)
84
+ * @property {Array<string>} optInImageURLs - URLs to opt-in proof images (required, at least one, each at most 2048 characters)
85
+ * @property {Object} [optIns] - Opt-in method details. Each channel is optional.
86
+ * @property {TollFreeOptIn} [optIns.verbal] - Verbal opt-in details
87
+ * @property {TollFreeOptIn} [optIns.web] - Online (web) opt-in details
88
+ * @property {TollFreeOptIn} [optIns.keyword] - Keyword opt-in details
89
+ * @property {TollFreeOptIn} [optIns.interactiveVoiceResponse] - IVR opt-in details
90
+ * @property {string} [additionalInformation] - Free-text justification sent upstream to the carrier (optional, at most 500 characters). Required when more than one phone number is assigned to the campaign.
91
+ */
92
+
93
+ /**
94
+ * @typedef {Object} CreateTollFreeCampaignData
95
+ * @property {string} brandId - The ID of the Toll-Free brand associated with the campaign (required, at least 7 characters)
96
+ * @property {TollFreeCampaignDetails} tollFree - The Toll-Free campaign details (required)
97
+ * @property {string} [privacyPolicyLink] - A URL linking to the privacy policy (optional, at most 2048 characters)
98
+ * @property {string} [termsAndConditionsLink] - A URL linking to the terms and conditions (optional, at most 2048 characters)
99
+ * @property {string} [tag] - A tag for the campaign (optional, at most 255 characters)
100
+ * @property {boolean} [autoRenewal=true] - Whether the campaign should auto-renew (optional, defaults to true)
101
+ * @property {Array<string>} phoneNumbers - The Toll-Free numbers to assign to the campaign (required, at least 1 and at most 5, each at least 10 digits and digits only). Numbers are locked to the campaign once assigned and cannot be moved or added afterward.
67
102
  */
68
103
 
69
104
  export class Campaigns {
@@ -133,11 +168,12 @@ export class Campaigns {
133
168
  * @param {string} [params.search] - Search term to filter campaigns by campaignId or brandId
134
169
  * @param {string} [params.sortBy] - Field to sort by (e.g. "createdAt", "campaignId", "brandId", "groupId", "subgroupId", "usecase", "status")
135
170
  * @param {string} [params.sortOrder] - Sort direction ("asc" or "desc")
171
+ * @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC" or "TOLL_FREE")
136
172
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
137
173
  * @returns {Promise<Array|Object>} The response from the server - array when unpaginated, or { data, total, page, limit, totalPages } when paginated
138
174
  */
139
- async getCampaigns({ id, brandId, subgroupId, groupId, page, limit, status, search, sortBy, sortOrder, options = {} }) {
140
- const filters = { id, brandId, subgroupId, groupId, page, limit, status, search, sortBy, sortOrder };
175
+ async getCampaigns({ id, brandId, subgroupId, groupId, page, limit, status, search, sortBy, sortOrder, registrationType, options = {} }) {
176
+ const filters = { id, brandId, subgroupId, groupId, page, limit, status, search, sortBy, sortOrder, registrationType };
141
177
  const queryString = this.client._getQueryString(filters);
142
178
  return this.client(`/campaign${queryString}`, { method: "GET", ...options });
143
179
  }
@@ -157,6 +193,21 @@ export class Campaigns {
157
193
  return this.client(`/campaign`, { method: "POST", body: campaignData, ...options });
158
194
  }
159
195
 
196
+ /**
197
+ * Create a new Toll-Free (TFN) campaign and submit it for Signal House review
198
+ * @async
199
+ * @roles api, admin, developer, billing, user
200
+ * @param {Object} params - The parameters for creating the toll-free campaign
201
+ * @param {CreateTollFreeCampaignData} params.campaignData - The data for the toll-free campaign to be created (see CreateTollFreeCampaignData typedef for details)
202
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
203
+ * @throws {Error} Throws an error if the campaignData parameter is missing
204
+ * @returns {Promise<Object>} The response from the server
205
+ */
206
+ async createTollFreeCampaign({ campaignData, options = {} }) {
207
+ this.client._require({ campaignData });
208
+ return this.client(`/campaign/toll-free`, { method: "POST", body: campaignData, ...options });
209
+ }
210
+
160
211
  /**
161
212
  * Update an existing campaign
162
213
  * @async
@@ -111,6 +111,25 @@ export class Numbers {
111
111
  return this.client(`/number`, { method: "POST", body: { phoneNumbers, subgroupId }, ...options });
112
112
  }
113
113
 
114
+ /**
115
+ * Purchase one or more Toll-Free numbers via the asynchronous resource-request flow.
116
+ *
117
+ * Toll-Free numbers are ordered by quantity (not picked individually) and provisioned asynchronously;
118
+ * per-number completion is delivered via webhook/polling, not in this response.
119
+ * @async
120
+ * @roles api, admin, developer, billing, user
121
+ * @param {Object} params - The parameters for purchasing toll-free numbers
122
+ * @param {number} params.quantity - The number of toll-free numbers to purchase (1-10)
123
+ * @param {string} params.subgroupId - The subgroup the purchased numbers are assigned to
124
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
125
+ * @throws {Error} Throws an error if the quantity or subgroupId parameter is missing
126
+ * @returns {Promise<Object>} A promise that resolves to `{ message }` once the request is queued.
127
+ */
128
+ async purchaseTollFreeNumbers({ quantity, subgroupId, options = {} }) {
129
+ this.client._require({ quantity, subgroupId });
130
+ return this.client(`/number/toll-free`, { method: "POST", body: { quantity, subgroupId }, ...options });
131
+ }
132
+
114
133
  /**
115
134
  * Update an existing phone number's details (e.g., setting a friendly name)
116
135
  * @async