@signalhousellc/sdk 1.0.61 → 1.0.63

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.
@@ -53,6 +53,24 @@ export class Groups {
53
53
  return this.client(`/group/${safeGroupId}`, { method: "DELETE", ...options });
54
54
  },
55
55
 
56
+ /**
57
+ * Set a group's KYC complianceStatus (SHGHL-2740). Only flips the field — it does not
58
+ * trigger any lockout side effects (halted sends, revoked API keys, etc.) for "rejected".
59
+ * @async
60
+ * @roles signalhouse
61
+ * @param {Object} params - The parameters for updating a group's compliance status
62
+ * @param {string} params.groupId - The ID of the group to update
63
+ * @param {string} params.complianceStatus - One of "unverified", "pending", "verified", "rejected"
64
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
65
+ * @throws {Error} Throws an error if the groupId or complianceStatus parameter is missing
66
+ * @returns {Promise<Object>} - The updated group object returned from the server
67
+ */
68
+ updateComplianceStatus: async ({ groupId, complianceStatus, options = {} }) => {
69
+ this.client._require({ groupId, complianceStatus });
70
+ const safeGroupId = encodeURIComponent(groupId);
71
+ return this.client(`/group/${safeGroupId}/compliance-status`, { method: "PUT", body: { complianceStatus }, ...options });
72
+ },
73
+
56
74
  /**
57
75
  * Link an external tenant (GHL/Shopify) to a V2 group (server-to-server). Exchanges a
58
76
  * single-use link token for a canonical group, adopting an empty portal group, repointing
@@ -247,6 +247,16 @@ export class Messages {
247
247
 
248
248
  /**
249
249
  * Send an SMS message to one or more recipient phone numbers
250
+ *
251
+ * The response reports the send outcome with three fields so callers do not have to inspect
252
+ * insertedMessages: requestedRecipientCount, enqueuedCount, and failedCount. enqueuedCount is the
253
+ * number of recipients accepted for delivery and is 0 when the send was fully blocked (by the
254
+ * moderation filter or a campaign opt-out); the request still resolves successfully in that case, so
255
+ * treat enqueuedCount, not the HTTP status, as the signal that a message was accepted. Blocked
256
+ * recipients are returned in insertedMessages with status "FAILED"; recipients on the global Do Not
257
+ * Contact list are reported in dncBlockedNumbers with no message record. Each FAILED message carries
258
+ * errorCode, a stable machine-readable cause (campaign opt-out is "OUT"; null on success or on
259
+ * failures with no assigned code) that is also included on the FAILED status-callback payload.
250
260
  * @async
251
261
  * @roles api, admin, developer, billing, user
252
262
  * @param {Object} params - The parameters for sending an SMS message
@@ -276,16 +286,22 @@ export class Messages {
276
286
  * @param {string[]} params.recipientPhoneNumbers - The phone number(s) to send the message to
277
287
  * @param {string} params.messageBody - The body of the P2P message
278
288
  * @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
289
+ * @param {string} [params.groupId] - Explicit group to send from. Defaults to the group in your auth context.
290
+ * @param {string} [params.subgroupId] - Explicit subgroup to attribute the send (and its inbound reply) to.
291
+ * P2P has no dedicated sender number, so pass this to record the send against a specific subgroup; it also
292
+ * resolves the group. Defaults to the group's oldest subgroup.
279
293
  * @param {boolean} [params.useSignalHouseShortlinks] - When false, SignalHouse applies no link-shortening
280
294
  * or text-spin and your pre-spun links/content are sent verbatim (bring-your-own spinner). Defaults to
281
295
  * true server-side (the SignalHouse shortlink system, which mints unique per-recipient links).
282
296
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
283
297
  * @returns {Promise<Object>} - A promise that resolves to the response data from the server
284
298
  */
285
- async sendP2P({ recipientPhoneNumbers, messageBody, statusCallbackUrl, useSignalHouseShortlinks, options = {} }) {
299
+ async sendP2P({ recipientPhoneNumbers, messageBody, statusCallbackUrl, groupId, subgroupId, useSignalHouseShortlinks, options = {} }) {
286
300
  this.client._require({ recipientPhoneNumbers, messageBody });
287
301
  const body = { recipientPhoneNumber: recipientPhoneNumbers, messageBody };
288
302
  if (statusCallbackUrl) body.statusCallbackUrl = statusCallbackUrl;
303
+ if (groupId) body.groupId = groupId;
304
+ if (subgroupId) body.subgroupId = subgroupId;
289
305
  if (typeof useSignalHouseShortlinks === "boolean") body.useSignalHouseShortlinks = useSignalHouseShortlinks;
290
306
  return this.client(`/message/p2p`, {
291
307
  method: "POST",
@@ -312,6 +328,16 @@ export class Messages {
312
328
 
313
329
  /**
314
330
  * Send an MMS message to one or more recipient phone numbers, with optional media attachments and status callback
331
+ *
332
+ * The response reports the send outcome with three fields so callers do not have to inspect
333
+ * insertedMessages: requestedRecipientCount, enqueuedCount, and failedCount. enqueuedCount is the
334
+ * number of recipients accepted for delivery and is 0 when the send was fully blocked (by the
335
+ * moderation filter or a campaign opt-out); the request still resolves successfully in that case, so
336
+ * treat enqueuedCount, not the HTTP status, as the signal that a message was accepted. Blocked
337
+ * recipients are returned in insertedMessages with status "FAILED"; recipients on the global Do Not
338
+ * Contact list are reported in dncBlockedNumbers with no message record. Each FAILED message carries
339
+ * errorCode, a stable machine-readable cause (campaign opt-out is "OUT"; null on success or on
340
+ * failures with no assigned code) that is also included on the FAILED status-callback payload.
315
341
  * @async
316
342
  * @roles api, admin, developer, billing, user
317
343
  * @param {Object} params - The parameters for sending an MMS message
@@ -371,6 +397,16 @@ export class Messages {
371
397
 
372
398
  /**
373
399
  * Send a group MMS message to one or more recipient phone numbers, with optional media attachments and status callback
400
+ *
401
+ * The response reports the send outcome with three fields so callers do not have to inspect
402
+ * insertedMessages: requestedRecipientCount, enqueuedCount, and failedCount. enqueuedCount is the
403
+ * number of recipients accepted for delivery and is 0 when the send was fully blocked (by the
404
+ * moderation filter or a campaign opt-out); the request still resolves successfully in that case, so
405
+ * treat enqueuedCount, not the HTTP status, as the signal that a message was accepted. Blocked
406
+ * recipients are returned in insertedMessages with status "FAILED"; recipients on the global Do Not
407
+ * Contact list are reported in dncBlockedNumbers with no message record. Each FAILED message carries
408
+ * errorCode, a stable machine-readable cause (campaign opt-out is "OUT"; null on success or on
409
+ * failures with no assigned code) that is also included on the FAILED status-callback payload.
374
410
  * @async
375
411
  * @roles api, admin, developer, billing, user
376
412
  * @param {Object} params - The parameters for sending an MMS message