@signalhousellc/sdk 1.0.61 → 1.0.62
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 +1 -1
- package/src/domains/Brands.js +273 -205
- package/src/domains/Campaigns.js +417 -226
- package/src/domains/Messages.js +37 -1
- package/src/domains/Numbers.js +457 -378
- package/src/domains/voice/SipTrunks.js +37 -0
package/src/domains/Campaigns.js
CHANGED
|
@@ -101,243 +101,434 @@
|
|
|
101
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.
|
|
102
102
|
*/
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {Object} ShortCodeDetails
|
|
106
|
+
* @property {Array<string>} useCases - Selected use cases (required, at least 1; ALERTS, CHAT, DONATION, FRAUD_ALERTS, PROMOTIONAL_MARKETING, PUBLIC_SERVICE_ANNOUNCEMENT, SWEEPSTAKES_CONTEST, TWO_FACTOR_AUTHENTICATION, VOTING_POLLING, POLITICAL, EMERGENCY_NOTIFICATIONS, DELIVERY_NOTIFICATIONS, SECURITY_ALERTS)
|
|
107
|
+
* @property {Array<string>} optInMethods - Selected opt-in methods (required, at least 1; IVR_POS, WEB, TV, PRINT, KEYWORD, VERBAL, RADIO)
|
|
108
|
+
* @property {Object<string, string>} optInMethodDescriptions - Generated-but-editable description per selected opt-in method, keyed by the method value (each 20-2048 characters, required for every selected method)
|
|
109
|
+
* @property {string} messageFrequency - "RECURRING" or "SINGLE" (required)
|
|
110
|
+
* @property {string} pricingTier - "STANDARD" or "FTEU" (required)
|
|
111
|
+
* @property {boolean} [adultContent=false] - Whether the campaign contains adult (SHAFT) content
|
|
112
|
+
* @property {string} [doubleOptInMessage] - Required when adultContent is true (20-1024 characters)
|
|
113
|
+
* @property {string} programSummary - Generated-but-editable campaign/program summary (required, 40-2048 characters)
|
|
114
|
+
* @property {string} optInConfirmationMessage - The opt-in confirmation message (required, 20-1024 characters)
|
|
115
|
+
* @property {string} [optInUrl] - Public HTTPS URL for the live opt-in experience. When omitted, Signal House uses the brand's optInLink before capturing its screenshot asynchronously, retrying up to three times.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @typedef {Object} CreateShortCodeCampaignData
|
|
120
|
+
* @property {string} brandId - The ID of the approved (VERIFIED) Short Code brand (required, at least 7 characters)
|
|
121
|
+
* @property {string} privacyPolicyLink - A URL linking to the privacy policy (required, at most 2048 characters)
|
|
122
|
+
* @property {string} termsAndConditionsLink - A URL linking to the terms and conditions (required, at most 2048 characters)
|
|
123
|
+
* @property {string} optinMessage - Opt-in response message (required, 20-1024 characters)
|
|
124
|
+
* @property {string} optoutMessage - Opt-out response message (required, 20-1024 characters)
|
|
125
|
+
* @property {string} helpMessage - HELP response message (required, 20-1024 characters)
|
|
126
|
+
* @property {string} sample1 - Sample message 1 (required, 20-1024 characters)
|
|
127
|
+
* @property {string} sample2 - Sample message 2 (required, 20-1024 characters)
|
|
128
|
+
* @property {string} sample3 - Sample message 3 (required, 20-1024 characters)
|
|
129
|
+
* @property {boolean} [autoRenewal=true] - Whether the campaign should auto-renew (optional, defaults to true)
|
|
130
|
+
* @property {string} [tag] - A tag for the campaign (optional, at most 255 characters)
|
|
131
|
+
* @property {ShortCodeDetails} shortCode - The Short Code campaign details (required)
|
|
132
|
+
*/
|
|
133
|
+
|
|
104
134
|
export class Campaigns {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
135
|
+
constructor(client, multipartClient, enableAdmin) {
|
|
136
|
+
this.client = client;
|
|
137
|
+
this.multipartClient = multipartClient;
|
|
138
|
+
this.enableAdmin = enableAdmin;
|
|
139
|
+
|
|
140
|
+
if (enableAdmin) {
|
|
141
|
+
this.admin = {
|
|
142
|
+
/**
|
|
143
|
+
* Approve a campaign that is pending approval
|
|
144
|
+
* @async
|
|
145
|
+
* @roles signalhouse
|
|
146
|
+
* @param {Object} params - The parameters for approving the campaign
|
|
147
|
+
* @param {string} params.campaignId - The ID of the campaign to approve
|
|
148
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
149
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
150
|
+
* @returns {Promise<Object>} The response from the server
|
|
151
|
+
*/
|
|
152
|
+
approveCampaign: async ({ campaignId, options = {} }) => {
|
|
153
|
+
this.client._require({ campaignId });
|
|
154
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
155
|
+
return this.client(`/campaign/approve/${safeCampaignId}`, { method: 'POST', ...options });
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* Reject a campaign that is pending approval
|
|
159
|
+
* @async
|
|
160
|
+
* @roles signalhouse
|
|
161
|
+
* @param {Object} params - The parameters for rejecting the campaign
|
|
162
|
+
* @param {string} params.campaignId - The ID of the campaign to reject
|
|
163
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request (body should include { rejectionReason })
|
|
164
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
165
|
+
* @returns {Promise<Object>} The response from the server
|
|
166
|
+
*/
|
|
167
|
+
rejectCampaign: async ({ campaignId, options = {} }) => {
|
|
168
|
+
this.client._require({ campaignId });
|
|
169
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
170
|
+
return this.client(`/campaign/reject/${safeCampaignId}`, { method: 'POST', ...options });
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* Get CNP campaigns shared with Signal House
|
|
174
|
+
* @async
|
|
175
|
+
* @roles signalhouse
|
|
176
|
+
* @param {Object} params - The parameters for retrieving CNP campaigns
|
|
177
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
178
|
+
* @returns {Promise<Array>} The response from the server
|
|
179
|
+
*/
|
|
180
|
+
getCNPCampaigns: async ({ options = {} } = {}) => {
|
|
181
|
+
return this.client(`/campaign/cnp`, { method: 'GET', ...options });
|
|
182
|
+
},
|
|
183
|
+
/**
|
|
184
|
+
* Transition a Short Code campaign's review status (SHGHL-2225). A customer-visible reason is
|
|
185
|
+
* required for both rejection states ("REJECTED" = Signal House Rejected, "DCA_REJECTED" =
|
|
186
|
+
* Rejected). Fulfillment and carrier submission are separate staff operations.
|
|
187
|
+
* @async
|
|
188
|
+
* @roles signalhouse
|
|
189
|
+
* @param {Object} params - The parameters for the status transition
|
|
190
|
+
* @param {string} params.campaignId - The ID of the campaign to transition
|
|
191
|
+
* @param {string} params.status - The target status: "PENDING_REVIEW", "REJECTED", "PENDING_CREATION", "DCA_REJECTED", or "ACTIVE". Use submitShortCodeCampaignToCarrier for "PENDING_DCA_APPROVAL".
|
|
192
|
+
* @param {string} [params.rejectionReason] - Required for "REJECTED"/"DCA_REJECTED" (10-1024 characters)
|
|
193
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
194
|
+
* @throws {Error} Throws an error if the campaignId or status parameter is missing
|
|
195
|
+
* @returns {Promise<Object>} The updated campaign
|
|
196
|
+
*/
|
|
197
|
+
updateShortCodeCampaignStatus: async ({ campaignId, status, rejectionReason, options = {} }) => {
|
|
198
|
+
this.client._require({ campaignId, status });
|
|
199
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
200
|
+
return this.client(`/campaign/short-code/${safeCampaignId}/status`, {
|
|
201
|
+
method: 'PUT',
|
|
202
|
+
body: { status, rejectionReason },
|
|
203
|
+
...options,
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* Fulfill a campaign-bound Signal House Short Code request.
|
|
208
|
+
* @async
|
|
209
|
+
* @roles signalhouse
|
|
210
|
+
* @param {Object} params - Fulfillment parameters.
|
|
211
|
+
* @param {string} params.campaignId - Campaign identifier.
|
|
212
|
+
* @param {string} params.actualCode - Issued five- or six-digit Short Code.
|
|
213
|
+
* @param {string} [params.internalNotes] - Staff-only fulfillment notes.
|
|
214
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options.
|
|
215
|
+
* @returns {Promise<Object>} The updated campaign.
|
|
216
|
+
*/
|
|
217
|
+
fulfillShortCodeCampaign: async ({ campaignId, actualCode, internalNotes, options = {} }) => {
|
|
218
|
+
this.client._require({ campaignId, actualCode });
|
|
219
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
220
|
+
return this.client(`/campaign/short-code/${safeCampaignId}/fulfill`, {
|
|
221
|
+
method: 'POST',
|
|
222
|
+
body: { actualCode, internalNotes },
|
|
223
|
+
...options,
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* Submit an internally approved Short Code campaign to carrier review.
|
|
228
|
+
* @async
|
|
229
|
+
* @roles signalhouse
|
|
230
|
+
* @param {Object} params - Submission parameters.
|
|
231
|
+
* @param {string} params.campaignId - Campaign identifier.
|
|
232
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options.
|
|
233
|
+
* @returns {Promise<Object>} The updated campaign.
|
|
234
|
+
*/
|
|
235
|
+
submitShortCodeCampaignToCarrier: async ({ campaignId, options = {} }) => {
|
|
236
|
+
this.client._require({ campaignId });
|
|
237
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
238
|
+
return this.client(`/campaign/short-code/${safeCampaignId}/submit-to-carrier`, {
|
|
239
|
+
method: 'POST',
|
|
240
|
+
...options,
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Get a list of campaigns with optional filters
|
|
249
|
+
* @async
|
|
250
|
+
* @roles api, admin, developer, billing, user
|
|
251
|
+
* @param {Object} params - The parameters for filtering the campaigns
|
|
252
|
+
* @param {string} [params.id] - The ID of the campaign to filter by
|
|
253
|
+
* @param {string} [params.brandId] - The ID of the brand to filter by
|
|
254
|
+
* @param {string} [params.subgroupId] - The ID of the subgroup to filter by
|
|
255
|
+
* @param {string} [params.groupId] - The ID of the group to filter by
|
|
256
|
+
* @param {number} [params.page] - The page number for pagination
|
|
257
|
+
* @param {number} [params.limit] - The number of items per page
|
|
258
|
+
* @param {string} [params.status] - The status of the campaign to filter by
|
|
259
|
+
* @param {string} [params.search] - Search term to filter campaigns by campaignId or brandId
|
|
260
|
+
* @param {string} [params.sortBy] - Field to sort by (e.g. "createdAt", "campaignId", "brandId", "groupId", "subgroupId", "usecase", "status")
|
|
261
|
+
* @param {string} [params.sortOrder] - Sort direction ("asc" or "desc")
|
|
262
|
+
* @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC", "TOLL_FREE", or "SHORT_CODE")
|
|
263
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
264
|
+
* @returns {Promise<Array|Object>} The response from the server - array when unpaginated, or { data, total, page, limit, totalPages } when paginated
|
|
265
|
+
*/
|
|
266
|
+
async getCampaigns({
|
|
267
|
+
id,
|
|
268
|
+
brandId,
|
|
269
|
+
subgroupId,
|
|
270
|
+
groupId,
|
|
271
|
+
page,
|
|
272
|
+
limit,
|
|
273
|
+
status,
|
|
274
|
+
search,
|
|
275
|
+
sortBy,
|
|
276
|
+
sortOrder,
|
|
277
|
+
registrationType,
|
|
278
|
+
options = {},
|
|
279
|
+
}) {
|
|
280
|
+
const filters = {
|
|
281
|
+
id,
|
|
282
|
+
brandId,
|
|
283
|
+
subgroupId,
|
|
284
|
+
groupId,
|
|
285
|
+
page,
|
|
286
|
+
limit,
|
|
287
|
+
status,
|
|
288
|
+
search,
|
|
289
|
+
sortBy,
|
|
290
|
+
sortOrder,
|
|
291
|
+
registrationType,
|
|
292
|
+
};
|
|
293
|
+
const queryString = this.client._getQueryString(filters);
|
|
294
|
+
return this.client(`/campaign${queryString}`, { method: 'GET', ...options });
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Get aggregated campaign health (7-day and 30-day windows) for a campaign.
|
|
299
|
+
* @async
|
|
300
|
+
* @roles api, admin, developer, billing, user
|
|
301
|
+
* @param {Object} params - Parameters for reading campaign health
|
|
302
|
+
* @param {string} params.campaignId - Campaign identifier
|
|
303
|
+
* @param {boolean} [params.includeNumbers=false] - When true, include per-number health entries
|
|
304
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional request options
|
|
305
|
+
* @returns {Promise<Object>} A promise that resolves to `{ campaignId, sevenDay, thirtyDay, numbers? }`
|
|
306
|
+
*/
|
|
307
|
+
async getCampaignHealth({ campaignId, includeNumbers = false, options = {} }) {
|
|
308
|
+
this.client._require({ campaignId });
|
|
309
|
+
const queryString = this.client._getQueryString({ campaignId, includeNumbers });
|
|
310
|
+
return this.client(`/campaign/health${queryString}`, { method: 'GET', ...options });
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Create a new campaign
|
|
315
|
+
* @async
|
|
316
|
+
* @roles api, admin, developer, billing, user
|
|
317
|
+
* @param {Object} params - The parameters for creating the campaign (see CreateCampaignData typedef for details)
|
|
318
|
+
* @param {CreateCampaignData} params.campaignData - The data for the campaign to be created (see CreateCampaignData typedef for details)
|
|
319
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
320
|
+
* @throws {Error} Throws an error if the campaignData parameter is missing or if required fields in campaignData are missing
|
|
321
|
+
* @returns {Promise<Object>} The response from the server
|
|
322
|
+
*/
|
|
323
|
+
async createCampaign({ campaignData, options = {} }) {
|
|
324
|
+
this.client._require({ campaignData: campaignData });
|
|
325
|
+
return this.client(`/campaign`, { method: 'POST', body: campaignData, ...options });
|
|
326
|
+
}
|
|
109
327
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const safeCampaignId = encodeURIComponent(campaignId);
|
|
125
|
-
return this.client(`/campaign/approve/${safeCampaignId}`, { method: "POST", ...options });
|
|
126
|
-
},
|
|
127
|
-
/**
|
|
128
|
-
* Reject a campaign that is pending approval
|
|
129
|
-
* @async
|
|
130
|
-
* @roles signalhouse
|
|
131
|
-
* @param {Object} params - The parameters for rejecting the campaign
|
|
132
|
-
* @param {string} params.campaignId - The ID of the campaign to reject
|
|
133
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request (body should include { rejectionReason })
|
|
134
|
-
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
135
|
-
* @returns {Promise<Object>} The response from the server
|
|
136
|
-
*/
|
|
137
|
-
rejectCampaign: async ({ campaignId, options = {} }) => {
|
|
138
|
-
this.client._require({ campaignId });
|
|
139
|
-
const safeCampaignId = encodeURIComponent(campaignId);
|
|
140
|
-
return this.client(`/campaign/reject/${safeCampaignId}`, { method: "POST", ...options });
|
|
141
|
-
},
|
|
142
|
-
/**
|
|
143
|
-
* Get CNP campaigns shared with Signal House
|
|
144
|
-
* @async
|
|
145
|
-
* @roles signalhouse
|
|
146
|
-
* @param {Object} params - The parameters for retrieving CNP campaigns
|
|
147
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
148
|
-
* @returns {Promise<Array>} The response from the server
|
|
149
|
-
*/
|
|
150
|
-
getCNPCampaigns: async ({ options = {} } = {}) => {
|
|
151
|
-
return this.client(`/campaign/cnp`, { method: "GET", ...options });
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
328
|
+
/**
|
|
329
|
+
* Create a new Toll-Free (TFN) campaign and submit it for Signal House review
|
|
330
|
+
* @async
|
|
331
|
+
* @roles api, admin, developer, user
|
|
332
|
+
* @param {Object} params - The parameters for creating the toll-free campaign
|
|
333
|
+
* @param {CreateTollFreeCampaignData} params.campaignData - The data for the toll-free campaign to be created (see CreateTollFreeCampaignData typedef for details)
|
|
334
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
335
|
+
* @throws {Error} Throws an error if the campaignData parameter is missing
|
|
336
|
+
* @returns {Promise<Object>} The response from the server
|
|
337
|
+
*/
|
|
338
|
+
async createTollFreeCampaign({ campaignData, options = {} }) {
|
|
339
|
+
this.client._require({ campaignData });
|
|
340
|
+
return this.client(`/campaign/toll-free`, { method: 'POST', body: campaignData, ...options });
|
|
341
|
+
}
|
|
156
342
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
async getCampaigns({ id, brandId, subgroupId, groupId, page, limit, status, search, sortBy, sortOrder, registrationType, options = {} }) {
|
|
177
|
-
const filters = { id, brandId, subgroupId, groupId, page, limit, status, search, sortBy, sortOrder, registrationType };
|
|
178
|
-
const queryString = this.client._getQueryString(filters);
|
|
179
|
-
return this.client(`/campaign${queryString}`, { method: "GET", ...options });
|
|
180
|
-
}
|
|
343
|
+
/**
|
|
344
|
+
* Create a new Short Code campaign and submit it for Signal House review (SHGHL-2225). Requires an
|
|
345
|
+
* approved (VERIFIED) Short Code brand. `campaignData.shortCode.optInUrl` is optional; Signal House
|
|
346
|
+
* uses the brand's `optInLink` when it is omitted, then captures its screenshot asynchronously, retrying up to three times. Request or register the
|
|
347
|
+
* campaign's Short Code separately through `numbers.requestShortCodeAcquisition` after creation.
|
|
348
|
+
* @async
|
|
349
|
+
* @roles api, admin, developer, user
|
|
350
|
+
* @param {Object} params - The parameters for creating the Short Code campaign
|
|
351
|
+
* @param {CreateShortCodeCampaignData} params.campaignData - The Short Code campaign data (see CreateShortCodeCampaignData typedef for details)
|
|
352
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
353
|
+
* @throws {Error} Throws an error if the campaignData parameter is missing
|
|
354
|
+
* @returns {Promise<Object>} The response from the server
|
|
355
|
+
*/
|
|
356
|
+
async createShortCodeCampaign({ campaignData, options = {} }) {
|
|
357
|
+
this.client._require({ campaignData });
|
|
358
|
+
const formData = new FormData();
|
|
359
|
+
formData.append('campaignData', JSON.stringify(campaignData));
|
|
360
|
+
return this.multipartClient(`/campaign/short-code`, { method: 'POST', body: formData, ...options });
|
|
361
|
+
}
|
|
181
362
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Update a Short Code campaign's editable fields (SHGHL-2225). Only permitted while the campaign is in
|
|
365
|
+
* Signal House Review or Signal House Rejected status; the number source cannot be changed once submitted.
|
|
366
|
+
* @async
|
|
367
|
+
* @roles api, admin, developer, user
|
|
368
|
+
* @param {Object} params - The parameters for updating the Short Code campaign
|
|
369
|
+
* @param {string} params.campaignId - The ID of the campaign to update
|
|
370
|
+
* @param {Object} params.updateData - The fields to update (top-level campaign fields plus an optional `shortCode` object of editable Short Code fields)
|
|
371
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
372
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
373
|
+
* @returns {Promise<Object>} The updated campaign
|
|
374
|
+
*/
|
|
375
|
+
async updateShortCodeCampaign({ campaignId, updateData, options = {} }) {
|
|
376
|
+
this.client._require({ campaignId });
|
|
377
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
378
|
+
return this.client(`/campaign/short-code/${safeCampaignId}`, { method: 'PUT', body: updateData, ...options });
|
|
379
|
+
}
|
|
197
380
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
381
|
+
/**
|
|
382
|
+
* Cancel a Short Code campaign (SHGHL-2225). Customers may cancel only while the campaign is in Signal
|
|
383
|
+
* House Review or Signal House Rejected status; Signal House staff may cancel from any non-terminal
|
|
384
|
+
* status. Persists as "EXPIRED" (displayed as "Cancelled"). A real Registry lease (external or an
|
|
385
|
+
* already-fulfilled Signal House request) is never auto-released — see SHGHL-2228 for offboarding.
|
|
386
|
+
* @async
|
|
387
|
+
* @roles api, admin, developer, user
|
|
388
|
+
* @param {Object} params - The parameters for cancelling the campaign
|
|
389
|
+
* @param {string} params.campaignId - The ID of the campaign to cancel
|
|
390
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
391
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
392
|
+
* @returns {Promise<Object>} The cancelled campaign
|
|
393
|
+
*/
|
|
394
|
+
async cancelShortCodeCampaign({ campaignId, options = {} }) {
|
|
395
|
+
this.client._require({ campaignId });
|
|
396
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
397
|
+
return this.client(`/campaign/short-code/${safeCampaignId}/cancel`, { method: 'POST', ...options });
|
|
398
|
+
}
|
|
212
399
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
400
|
+
/**
|
|
401
|
+
* Download a private Short Code external lease receipt. Opt-in screenshots are public at the
|
|
402
|
+
* `shortCode.screenshotUrl` returned on the campaign. Authorized receipt users should pass
|
|
403
|
+
* `options: { responseType: "blob" }` (browser) or an equivalent binary response type for your HTTP
|
|
404
|
+
* client to receive the raw file bytes instead of attempting to parse them as JSON.
|
|
405
|
+
* @async
|
|
406
|
+
* @roles api, admin, developer, user
|
|
407
|
+
* @param {Object} params - The parameters for downloading the artifact
|
|
408
|
+
* @param {string} params.artifactId - The receipt identifier from `numberSource.externalLease.receiptArtifactId`
|
|
409
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
410
|
+
* @throws {Error} Throws an error if the artifactId parameter is missing
|
|
411
|
+
* @returns {Promise<Object>} The response from the server (raw file bytes as `data` when a binary responseType is used)
|
|
412
|
+
*/
|
|
413
|
+
async readCampaignArtifact({ artifactId, options = {} }) {
|
|
414
|
+
this.client._require({ artifactId });
|
|
415
|
+
const safeArtifactId = encodeURIComponent(artifactId);
|
|
416
|
+
return this.client(`/campaign/short-code/artifact/${safeArtifactId}`, { method: 'GET', ...options });
|
|
417
|
+
}
|
|
227
418
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Upload an opt-in proof image to be hosted on-platform, returning a publicly-fetchable URL suitable for a
|
|
421
|
+
* Toll-Free campaign's optInImageURLs
|
|
422
|
+
* @async
|
|
423
|
+
* @roles api, admin, developer, user
|
|
424
|
+
* @param {Object} params - The parameters for uploading the opt-in image
|
|
425
|
+
* @param {Buffer|Blob|File} params.file - The image file to upload, provided as a Buffer/Blob/File
|
|
426
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
427
|
+
* @throws {Error} Throws an error if the file parameter is missing
|
|
428
|
+
* @returns {Promise<Object>} The response from the server containing the hosted image's id and URL
|
|
429
|
+
*/
|
|
430
|
+
async uploadOptInImage({ file, options = {} }) {
|
|
431
|
+
this.client._require({ file });
|
|
432
|
+
const formData = new FormData();
|
|
433
|
+
formData.append('file', file);
|
|
434
|
+
return this.multipartClient(`/campaign/opt-in-image`, { method: 'POST', body: formData, ...options });
|
|
435
|
+
}
|
|
245
436
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
437
|
+
/**
|
|
438
|
+
* Auto-capture an opt-in proof image from a brand's generated landing page and host it on-platform,
|
|
439
|
+
* returning a publicly-fetchable URL suitable for a Toll-Free campaign's optInImageURLs
|
|
440
|
+
* @async
|
|
441
|
+
* @roles api, admin, developer, user
|
|
442
|
+
* @param {Object} params - The parameters for capturing the opt-in image
|
|
443
|
+
* @param {string} params.brandId - The ID of the brand whose generated landing page should be captured
|
|
444
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
445
|
+
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
446
|
+
* @returns {Promise<Object>} The response from the server containing the hosted image's id and URL
|
|
447
|
+
*/
|
|
448
|
+
async captureOptInImageFromLanding({ brandId, options = {} }) {
|
|
449
|
+
this.client._require({ brandId });
|
|
450
|
+
return this.client(`/campaign/opt-in-image/from-landing`, { method: 'POST', body: { brandId }, ...options });
|
|
451
|
+
}
|
|
261
452
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
453
|
+
/**
|
|
454
|
+
* Update an existing campaign
|
|
455
|
+
* @async
|
|
456
|
+
* @roles api, admin, developer, billing, user
|
|
457
|
+
* @param {Object} params - The parameters for updating the campaign (see UpdateCampaignData typedef for details)
|
|
458
|
+
* @param {string} params.campaignId - The ID of the campaign to update
|
|
459
|
+
* @param {UpdateCampaignData} params.campaignData - The data for the campaign to be updated (see UpdateCampaignData typedef for details)
|
|
460
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
461
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing or if required fields in campaignData are missing
|
|
462
|
+
* @returns {Promise<Object>} The response from the server
|
|
463
|
+
*/
|
|
464
|
+
async updateCampaign({ campaignId, campaignData, options = {} }) {
|
|
465
|
+
this.client._require({ campaignId: campaignId });
|
|
466
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
467
|
+
return this.client(`/campaign/${safeCampaignId}`, { method: 'PUT', body: campaignData, ...options });
|
|
468
|
+
}
|
|
278
469
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
470
|
+
/**
|
|
471
|
+
* Add an internal comment/note to a campaign
|
|
472
|
+
* @async
|
|
473
|
+
* @roles signalhouse_admin, signalhouse_user
|
|
474
|
+
* @param {Object} params - The parameters for adding the comment
|
|
475
|
+
* @param {string} params.campaignId - The ID of the campaign
|
|
476
|
+
* @param {string} params.comment - The comment/note text
|
|
477
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
478
|
+
* @throws {Error} Throws an error if the campaignId or comment parameter is missing
|
|
479
|
+
* @returns {Promise<Object>} The updated campaign object
|
|
480
|
+
*/
|
|
481
|
+
async addCampaignComment({ campaignId, comment, options = {} }) {
|
|
482
|
+
this.client._require({ campaignId, comment });
|
|
483
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
484
|
+
return this.client(`/campaign/${safeCampaignId}/comments`, { method: 'POST', body: { comment }, ...options });
|
|
485
|
+
}
|
|
295
486
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
487
|
+
/**
|
|
488
|
+
* Delete an existing campaign (mark it as EXPIRED). The campaign will still be retrievable
|
|
489
|
+
* @async
|
|
490
|
+
* @roles api, admin, developer, billing, user
|
|
491
|
+
* @param {Object} params - The parameters for deleting the campaign
|
|
492
|
+
* @param {string} params.campaignId - The ID of the campaign to delete
|
|
493
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
494
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
495
|
+
* @returns {Promise<Object>} The response from the server
|
|
496
|
+
*/
|
|
497
|
+
async deleteCampaign({ campaignId, options = {} }) {
|
|
498
|
+
this.client._require({ campaignId: campaignId });
|
|
499
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
500
|
+
return this.client(`/campaign/${safeCampaignId}`, { method: 'DELETE', ...options });
|
|
501
|
+
}
|
|
311
502
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
503
|
+
/**
|
|
504
|
+
* Appeal a DCA-rejected campaign
|
|
505
|
+
* @async
|
|
506
|
+
* @roles api, admin, developer, billing, user
|
|
507
|
+
* @param {Object} params - The parameters for appealing the campaign rejection
|
|
508
|
+
* @param {string} params.campaignId - The ID of the campaign to appeal
|
|
509
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request (body should include { reason })
|
|
510
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
511
|
+
* @returns {Promise<Object>} The response from the server
|
|
512
|
+
*/
|
|
513
|
+
async appealDcaRejection({ campaignId, options = {} }) {
|
|
514
|
+
this.client._require({ campaignId: campaignId });
|
|
515
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
516
|
+
return this.client(`/campaign/appealDcaRejection/${safeCampaignId}`, { method: 'POST', ...options });
|
|
517
|
+
}
|
|
327
518
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
519
|
+
/**
|
|
520
|
+
* Nudge a connectivity partner to prioritize review of a campaign in PENDING_DCA_APPROVAL status
|
|
521
|
+
* @async
|
|
522
|
+
* @roles api, admin, developer, billing, user
|
|
523
|
+
* @param {Object} params - The parameters for nudging the campaign
|
|
524
|
+
* @param {string} params.campaignId - The ID of the campaign to nudge
|
|
525
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
526
|
+
* @throws {Error} Throws an error if the campaignId parameter is missing
|
|
527
|
+
* @returns {Promise<Object>} The response from the server
|
|
528
|
+
*/
|
|
529
|
+
async nudgeDcaForCampaign({ campaignId, options = {} }) {
|
|
530
|
+
this.client._require({ campaignId: campaignId });
|
|
531
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
532
|
+
return this.client(`/campaign/nudge/${safeCampaignId}`, { method: 'POST', ...options });
|
|
533
|
+
}
|
|
343
534
|
}
|