@signalhousellc/sdk 1.0.63 → 1.0.64

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.63",
3
+ "version": "1.0.64",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -18,10 +18,10 @@ export class Messages {
18
18
  * @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED)
19
19
  * @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
20
20
  * @param {string|string[]} [params.messageType] - Filter messages by their type. Accepts a single value or an array (e.g. ["SMS", "MMS"]). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types.
21
- * @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, tollFree, p2p. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
21
+ * @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, tollFree, shortCode, p2p. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
22
22
  * @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (a message matches ANY of them) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
23
23
  * @param {string} [params.carrier] - Filter messages by the carrier used for sending
24
- * @param {string} [params.senderPhoneNumber] - Filter messages by the sender's phone number
24
+ * @param {string} [params.senderPhoneNumber] - Filter messages by the sender's 5-6 digit Short Code or 10+ digit phone number
25
25
  * @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
26
26
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
27
27
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
@@ -94,7 +94,7 @@ export class Messages {
94
94
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
95
95
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
96
96
  * @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (match ANY) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
97
- * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here (matched by carrier). Accepts a single value or an array. Ignored when matchAny is true (matchAny takes precedence).
97
+ * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here (matched by carrier). Accepts a single value or an array. Ignored when matchAny is true (matchAny takes precedence).
98
98
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
99
99
  * @returns {Promise<Object>} - A promise that resolves to the analytics data
100
100
  */
@@ -117,7 +117,7 @@ export class Messages {
117
117
  * @param {string} [params.carrier] - Filter analytics by the carrier used for sending
118
118
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
119
119
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
120
- * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here. Accepts a single value or an array.
120
+ * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here. Accepts a single value or an array.
121
121
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
122
122
  * @returns {Promise<Array>} - A promise that resolves to an array of analytics snapshot records
123
123
  */
@@ -159,7 +159,7 @@ export class Messages {
159
159
  * @param {string} [params.endDate]
160
160
  * @param {number} [params.page=1]
161
161
  * @param {number} [params.limit=50] - max 50 per page
162
- * @param {("tenDLC"|"tollFree"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means all activity. tenDLC/tollFree/p2p (single value or array) limit to the selected channel(s); toll-free is kept separate from 10DLC using the stored channel column.
162
+ * @param {("tenDLC"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means all activity. tenDLC/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s).
163
163
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options]
164
164
  * @returns {Promise<Object>} - { rows, totalCount, page, limit }. Each row carries sms/mms/p2p metric columns plus `smsOptOuts` and `mmsOptOuts` from the DNC analytics MV (P2P has no opt-outs).
165
165
  */
@@ -185,7 +185,7 @@ export class Messages {
185
185
  * @param {string} [params.endDate]
186
186
  * @param {number} [params.page=1]
187
187
  * @param {number} [params.limit=50] - max 50 per page
188
- * @param {("tenDLC"|"tollFree"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means every code. tenDLC/tollFree/p2p (single value or array) limit to the selected channel(s); when one channel is selected, totalErrors reflects only that channel.
188
+ * @param {("tenDLC"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means every code. tenDLC/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s); when one channel is selected, totalErrors reflects only that channel.
189
189
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options]
190
190
  * @returns {Promise<Object>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
191
191
  */
@@ -208,7 +208,7 @@ export class Messages {
208
208
  * @param {string} [params.carrier] - Filter by the carrier
209
209
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
210
210
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
211
- * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
211
+ * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
212
212
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
213
213
  * @returns {Promise<Object>} - A promise that resolves to the DNC analytics data (totals, byDate, byPhoneNumber, byCarrier)
214
214
  */
@@ -235,7 +235,7 @@ export class Messages {
235
235
  * @param {number} [params.limit] - Number of records per page
236
236
  * @param {string} [params.sortField] - Field to sort by
237
237
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
238
- * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
238
+ * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
239
239
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
240
240
  * @returns {Promise<Object>} - A promise that resolves to the paginated DNC records
241
241
  */
@@ -260,7 +260,7 @@ export class Messages {
260
260
  * @async
261
261
  * @roles api, admin, developer, billing, user
262
262
  * @param {Object} params - The parameters for sending an SMS message
263
- * @param {string} params.senderPhoneNumber - The phone number to send the message from
263
+ * @param {string} params.senderPhoneNumber - The 5-6 digit Short Code or 10+ digit phone number to send the message from
264
264
  * @param {string|string[]} params.recipientPhoneNumbers - The phone number(s) to send the message to
265
265
  * @param {string} params.messageBody - The body of the SMS message
266
266
  * @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
@@ -341,7 +341,7 @@ export class Messages {
341
341
  * @async
342
342
  * @roles api, admin, developer, billing, user
343
343
  * @param {Object} params - The parameters for sending an MMS message
344
- * @param {string} params.senderPhoneNumber - The phone number to send the message from
344
+ * @param {string} params.senderPhoneNumber - The 5-6 digit Short Code or 10+ digit phone number to send the message from
345
345
  * @param {string[]} params.recipientPhoneNumbers - The phone number(s) to send the message to
346
346
  * @param {string} params.messageBody - The body of the MMS message
347
347
  * @param {string[]} [params.mediaUrls] - The URLs of the media attachments
@@ -147,44 +147,50 @@ export class SipProfiles {
147
147
  }
148
148
 
149
149
  /**
150
- * Assign a phone number to this SIP profile (routes inbound calls on that
151
- * number to the endpoint).
150
+ * Assign a phone number to this SIP profile — routes inbound calls on that
151
+ * number to the endpoint. Prefer `e164` (numbers are Mongo-authoritative); the
152
+ * legacy `phoneNumberId` (a voice-backend phone-number UUID) is still accepted.
152
153
  * @async
153
154
  * @roles api, admin, developer, billing, user
154
155
  * @param {Object} params - Request parameters.
155
156
  * @param {string} params.id - The SIP profile UUID.
156
- * @param {string} params.phoneNumberId - The phone number UUID to assign.
157
+ * @param {string} [params.e164] - The phone number in E.164 to assign (preferred).
158
+ * @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
157
159
  * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
158
- * @throws {Error} If id or phoneNumberId is missing.
160
+ * @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
159
161
  * @returns {Promise<Object>} `{ sipProfile: {...} }`.
160
162
  */
161
- async assignNumber({ id, phoneNumberId, options = {} }) {
162
- this.client._require({ id, phoneNumberId });
163
+ async assignNumber({ id, e164, phoneNumberId, options = {} }) {
164
+ this.client._require({ id });
165
+ if (!e164 && !phoneNumberId) this.client._require({ e164 });
163
166
  const safeId = encodeURIComponent(id);
164
167
  return this.client(`/voice/sip-profiles/${safeId}/assign-number`, {
165
168
  method: "POST",
166
- body: { phoneNumberId },
169
+ body: e164 ? { e164 } : { phoneNumberId },
167
170
  ...options,
168
171
  });
169
172
  }
170
173
 
171
174
  /**
172
- * Unassign a phone number from this SIP profile.
175
+ * Unassign a phone number from this SIP profile. Prefer `e164`; the legacy
176
+ * `phoneNumberId` (a voice-backend phone-number UUID) is still accepted.
173
177
  * @async
174
178
  * @roles api, admin, developer, billing, user
175
179
  * @param {Object} params - Request parameters.
176
180
  * @param {string} params.id - The SIP profile UUID.
177
- * @param {string} params.phoneNumberId - The phone number UUID to unassign.
181
+ * @param {string} [params.e164] - The phone number in E.164 to unassign (preferred).
182
+ * @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
178
183
  * @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
179
- * @throws {Error} If id or phoneNumberId is missing.
184
+ * @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
180
185
  * @returns {Promise<Object>} `{ sipProfile: {...} }`.
181
186
  */
182
- async unassignNumber({ id, phoneNumberId, options = {} }) {
183
- this.client._require({ id, phoneNumberId });
187
+ async unassignNumber({ id, e164, phoneNumberId, options = {} }) {
188
+ this.client._require({ id });
189
+ if (!e164 && !phoneNumberId) this.client._require({ e164 });
184
190
  const safeId = encodeURIComponent(id);
185
191
  return this.client(`/voice/sip-profiles/${safeId}/unassign-number`, {
186
192
  method: "POST",
187
- body: { phoneNumberId },
193
+ body: e164 ? { e164 } : { phoneNumberId },
188
194
  ...options,
189
195
  });
190
196
  }