@signalhousellc/sdk 1.0.39 → 1.0.42

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.39",
3
+ "version": "1.0.42",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -15,6 +15,7 @@ import { Groups } from "./domains/Groups.js";
15
15
  import { Landings } from "./domains/Landings.js";
16
16
  import { Messages } from "./domains/Messages.js";
17
17
  import { Numbers } from "./domains/Numbers.js";
18
+ import { Onboarding } from "./domains/Onboarding.js";
18
19
  import { Shortlinks } from "./domains/Shortlinks.js";
19
20
  import { Subgroups } from "./domains/Subgroups.js";
20
21
  import { Subscriptions } from "./domains/Subscriptions.js";
@@ -58,6 +59,7 @@ export class SignalHouseSDK {
58
59
  this.landings = new Landings(client, multipartClient, this.enableAdmin);
59
60
  this.messages = new Messages(client, multipartClient, this.enableAdmin);
60
61
  this.numbers = new Numbers(client, this.enableAdmin);
62
+ this.onboarding = new Onboarding(client, this.enableAdmin);
61
63
  this.shortlinks = new Shortlinks(client, this.enableAdmin);
62
64
  this.subgroups = new Subgroups(client, this.enableAdmin);
63
65
  this.subscriptions = new Subscriptions(client, this.enableAdmin);
@@ -62,8 +62,8 @@ export class Billing {
62
62
  * @param {string} [params.campaignId] - The campaign ID to filter by
63
63
  * @param {string} [params.entryType] - The type of entry to filter by
64
64
  * @param {string} [params.transactionType] - The type of transaction to filter by
65
- * @param {string} [params.startDate] - The start date for the filter
66
- * @param {string} [params.endDate] - The end date for the filter
65
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
66
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
67
67
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
68
68
  * @returns {Promise<Array>} The response from the server
69
69
  */
@@ -190,8 +190,8 @@ export class Billing {
190
190
  * @param {Object} params - The parameters for filtering the invoice details
191
191
  * @param {string} [params.groupId] - The ID of the group to filter by
192
192
  * @param {string} [params.subgroupId] - The ID of the subgroup to filter by
193
- * @param {string} [params.startDate] - The start date for the filter
194
- * @param {string} [params.endDate] - The end date for the filter
193
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
194
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
195
195
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
196
196
  * @returns {Promise<Object>} The response from the server
197
197
  */
@@ -21,8 +21,8 @@ export class Messages {
21
21
  * @param {string} [params.carrier] - Filter messages by the carrier used for sending
22
22
  * @param {string} [params.senderPhoneNumber] - Filter messages by the sender's phone number
23
23
  * @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
24
- * @param {string} [params.startDate] - Filter messages by their start date
25
- * @param {string} [params.endDate] - Filter messages by their end date
24
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
25
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
26
26
  * @param {string} [params.sortField] - The field to sort the messages by
27
27
  * @param {string} [params.sortOrder] - The order to sort the messages (asc, desc)
28
28
  * @param {number} [params.page] - The page number for pagination
@@ -67,8 +67,8 @@ export class Messages {
67
67
  * @param {string} [params.campaignId] - Filter analytics by the ID of the associated campaign
68
68
  * @param {string} [params.phoneNumber] - Filter analytics by the phone number involved in the messages
69
69
  * @param {string} [params.carrier] - Filter analytics by the carrier used for sending
70
- * @param {string} [params.startDate] - Filter analytics by the start date of the messages
71
- * @param {string} [params.endDate] - Filter analytics by the end date of the messages
70
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
71
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
72
72
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
73
73
  * @returns {Promise<Object>} - A promise that resolves to the analytics data
74
74
  */
@@ -89,8 +89,8 @@ export class Messages {
89
89
  * @param {string} [params.campaignId] - Filter analytics by the ID of the associated campaign
90
90
  * @param {string} [params.phoneNumber] - Filter analytics by the phone number involved in the messages
91
91
  * @param {string} [params.carrier] - Filter analytics by the carrier used for sending
92
- * @param {string} [params.startDate] - Filter analytics by the start date of the messages
93
- * @param {string} [params.endDate] - Filter analytics by the end date of the messages
92
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
93
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
94
94
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
95
95
  * @returns {Promise<Array>} - A promise that resolves to an array of analytics snapshot records
96
96
  */
@@ -111,8 +111,8 @@ export class Messages {
111
111
  * @param {string} [params.campaignId] - Filter by the ID of the associated campaign
112
112
  * @param {string} [params.phoneNumber] - Filter by the phone number
113
113
  * @param {string} [params.carrier] - Filter by the carrier
114
- * @param {string} [params.startDate] - Filter by start date
115
- * @param {string} [params.endDate] - Filter by end date
114
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
115
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
116
116
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
117
117
  * @returns {Promise<Object>} - A promise that resolves to the DNC analytics data (totals, byDate, byPhoneNumber, byCarrier)
118
118
  */
@@ -133,8 +133,8 @@ export class Messages {
133
133
  * @param {string} [params.campaignId] - Filter by the ID of the associated campaign
134
134
  * @param {string} [params.phoneNumber] - Filter by the phone number
135
135
  * @param {string} [params.carrier] - Filter by the carrier
136
- * @param {string} [params.startDate] - Filter by start date
137
- * @param {string} [params.endDate] - Filter by end date
136
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
137
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
138
138
  * @param {number} [params.page] - Page number for pagination
139
139
  * @param {number} [params.limit] - Number of records per page
140
140
  * @param {string} [params.sortField] - Field to sort by
@@ -197,7 +197,7 @@ export class Messages {
197
197
  images,
198
198
  options = {},
199
199
  }) {
200
- this.client._require({ senderPhoneNumber, recipientPhoneNumbers, messageBody });
200
+ this.client._require({ senderPhoneNumber, recipientPhoneNumbers });
201
201
 
202
202
  const formData = new FormData();
203
203
 
@@ -210,7 +210,7 @@ export class Messages {
210
210
  formData.append("senderPhoneNumber", senderPhoneNumber);
211
211
 
212
212
  formData.append("recipientPhoneNumber", Array.isArray(recipientPhoneNumbers) ? JSON.stringify(recipientPhoneNumbers) : recipientPhoneNumbers);
213
- formData.append("messageBody", messageBody);
213
+ if (messageBody) formData.append("messageBody", messageBody);
214
214
 
215
215
  if (mediaUrls && mediaUrls.length > 0) {
216
216
  formData.append("mediaUrls", JSON.stringify(mediaUrls));
@@ -253,7 +253,7 @@ export class Messages {
253
253
  images,
254
254
  options = {},
255
255
  }) {
256
- this.client._require({ senderPhoneNumber, recipientPhoneNumbers, messageBody });
256
+ this.client._require({ senderPhoneNumber, recipientPhoneNumbers });
257
257
 
258
258
  const formData = new FormData();
259
259
 
@@ -266,7 +266,7 @@ export class Messages {
266
266
  formData.append("senderPhoneNumber", senderPhoneNumber);
267
267
 
268
268
  formData.append("recipientPhoneNumber", Array.isArray(recipientPhoneNumbers) ? JSON.stringify(recipientPhoneNumbers) : recipientPhoneNumbers);
269
- formData.append("messageBody", messageBody);
269
+ if (messageBody) formData.append("messageBody", messageBody);
270
270
 
271
271
  if (mediaUrls && mediaUrls.length > 0) {
272
272
  formData.append("mediaUrls", JSON.stringify(mediaUrls));
@@ -95,17 +95,16 @@ export class Numbers {
95
95
  /**
96
96
  * Purchase phone numbers by providing a list of phone numbers and the subgroup ID to assign them to.
97
97
  *
98
- * Numbers already owned (by this subgroup or another) are skipped; only the remaining numbers are queued
99
- * for purchase and the response `message` names each skipped number and its reason. The request fails
100
- * with an error ONLY when every requested number is already owned.
98
+ * Each requested number is queued and processed independently. Per-number success or failure is
99
+ * delivered via `NUMBER_PURCHASE_SUCCESSFUL` / `NUMBER_PURCHASE_FAILED` webhooks not in this response.
101
100
  * @async
102
101
  * @roles api, admin, developer, billing, user
103
102
  * @param {Object} params - The parameters for purchasing phone numbers
104
103
  * @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
105
104
  * @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
106
105
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
107
- * @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing, or if every requested number is already owned
108
- * @returns {Promise<Object>} A promise that resolves to `{ message }`. The message describes any skipped numbers when some requested numbers were already owned.
106
+ * @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
107
+ * @returns {Promise<Object>} A promise that resolves to `{ message }` once the request is queued.
109
108
  */
110
109
  async purchasePhoneNumber({ phoneNumbers, subgroupId, options = {} }) {
111
110
  this.client._require({ phoneNumbers, subgroupId });
@@ -0,0 +1,39 @@
1
+ export class Onboarding {
2
+ constructor(client, enableAdmin) {
3
+ this.client = client;
4
+ this.enableAdmin = enableAdmin;
5
+
6
+ // Hidden Admin namespace INSIDE the domain
7
+ if (enableAdmin) {
8
+ this.admin = {
9
+ /**
10
+ * Get all onboarding records (one per group). Staff-only.
11
+ * @async
12
+ * @roles signalhouse
13
+ * @param {Object} [params] - Optional parameters
14
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
+ * @returns {Promise<Object>} - Array of onboarding records
16
+ */
17
+ getOnboardings: async ({ options = {} } = {}) => {
18
+ return this.client(`/group/onboarding`, { method: "GET", ...options });
19
+ },
20
+
21
+ /**
22
+ * Get a single onboarding record by group ID. Staff-only.
23
+ * @async
24
+ * @roles signalhouse
25
+ * @param {Object} params
26
+ * @param {string} params.groupId - The group ID whose onboarding record to retrieve
27
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
28
+ * @throws {Error} Throws an error if the groupId parameter is missing
29
+ * @returns {Promise<Object>} - The onboarding record
30
+ */
31
+ getOnboarding: async ({ groupId, options = {} }) => {
32
+ this.client._require({ groupId });
33
+ const safeGroupId = encodeURIComponent(groupId);
34
+ return this.client(`/group/onboarding/${safeGroupId}`, { method: "GET", ...options });
35
+ },
36
+ };
37
+ }
38
+ }
39
+ }