@signalhousellc/sdk 1.0.67 → 1.0.69

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.
Files changed (40) hide show
  1. package/README.md +0 -10
  2. package/package.json +11 -3
  3. package/skills/VENDORED.json +8 -8
  4. package/skills/signalhouse-10dlc/SKILL.md +5 -9
  5. package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +5 -12
  6. package/skills/signalhouse-advisor/SKILL.md +3 -3
  7. package/skills/signalhouse-numbers/SKILL.md +1 -2
  8. package/skills/signalhouse-setup/SKILL.md +41 -11
  9. package/skills/signalhouse-sms/SKILL.md +4 -4
  10. package/skills/signalhouse-webhooks/SKILL.md +76 -56
  11. package/src/SignalHouseSDK.js +26 -13
  12. package/src/domains/Agents.js +204 -55
  13. package/src/domains/Auth.js +30 -24
  14. package/src/domains/Billing.js +32 -26
  15. package/src/domains/Brands.js +45 -34
  16. package/src/domains/Campaigns.js +106 -47
  17. package/src/domains/Dnc.js +168 -0
  18. package/src/domains/Groups.js +53 -16
  19. package/src/domains/Landings.js +36 -30
  20. package/src/domains/Messages.js +110 -65
  21. package/src/domains/Notifications.js +12 -6
  22. package/src/domains/Numbers.js +58 -52
  23. package/src/domains/Onboarding.js +14 -8
  24. package/src/domains/Shortlinks.js +10 -4
  25. package/src/domains/Subgroups.js +16 -10
  26. package/src/domains/Subscriptions.js +22 -16
  27. package/src/domains/Tickets.js +18 -12
  28. package/src/domains/Users.js +32 -22
  29. package/src/domains/Webhooks.js +45 -13
  30. package/src/domains/voice/Analytics.js +8 -2
  31. package/src/domains/voice/CallLogs.js +14 -8
  32. package/src/domains/voice/Calls.js +14 -8
  33. package/src/domains/voice/GlobalVoiceSettings.js +10 -4
  34. package/src/domains/voice/ProgrammableVoiceProfiles.js +22 -16
  35. package/src/domains/voice/SipProfiles.js +24 -18
  36. package/src/domains/voice/SipTrunks.js +26 -20
  37. package/src/domains/voice/Tokens.js +10 -4
  38. package/src/domains/voice/browser/Call.js +2 -0
  39. package/src/domains/voice/browser/Device.js +23 -11
  40. package/src/webhooks/verifySignature.js +66 -0
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  export class Groups {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -15,8 +21,8 @@ export class Groups {
15
21
  * @param {string} [params.groupId] - Restrict results to a group.
16
22
  * @param {number} [params.limit] - Maximum rows to return.
17
23
  * @param {number} [params.offset] - Rows to skip; requires limit.
18
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
19
- * @returns {Promise<Object>} - Group-level resource count rows.
24
+ * @param {RequestOptions} [params.options] - Additional options for the request.
25
+ * @returns {Promise<SdkResponse<any>>} - Group-level resource count rows.
20
26
  */
21
27
  getGroupCounts: async ({ groupId, limit, offset, options = {} } = {}) => {
22
28
  const queryString = this.client._getQueryString({ groupId, limit, offset });
@@ -30,8 +36,8 @@ export class Groups {
30
36
  * @param {Object} params - The parameters for getting groups
31
37
  * @param {number} [params.page] - The page number for pagination
32
38
  * @param {number} [params.limit] - The number of items per page
33
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
34
- * @returns {Promise<Object>} - The list of groups returned from the server
39
+ * @param {RequestOptions} [params.options] - Additional options for the request
40
+ * @returns {Promise<SdkResponse<any>>} - The list of groups returned from the server
35
41
  */
36
42
  getGroups: async ({ page, limit, options = {} }) => {
37
43
  const filters = { page, limit };
@@ -45,24 +51,55 @@ export class Groups {
45
51
  * @roles signalhouse
46
52
  * @param {Object} params - The parameters for creating a new group
47
53
  * @param {Object} params.groupData - The data for the new group, including required fields such as groupName. Optionally accepts `psPartnerKey` and `ownerEmail` to credit a referring partner.
48
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
54
+ * @param {RequestOptions} [params.options] - Additional options for the request
49
55
  * @throws {Error} Throws an error if the groupData parameter is missing or if required fields within groupData are missing
50
- * @returns {Promise<Object>} - The created group object returned from the server
56
+ * @returns {Promise<SdkResponse<any>>} - The created group object returned from the server
51
57
  */
52
58
  createGroup: async ({ groupData, options = {} }) => {
53
59
  this.client._require({ groupData: groupData });
54
60
  return this.client(`/group`, { method: "POST", body: groupData, ...options });
55
61
  },
56
62
 
63
+ /**
64
+ * Record a GHL-app or Shopify-app install's registration for the per-surface
65
+ * customer-lifecycle webhook system. Call this right after admin.createGroup when
66
+ * provisioning a group outside the Portal's self-registration flow (which records
67
+ * itself automatically) — without it, the group never fires a registration webhook and
68
+ * is never eligible for the "registered but no brand submitted" staleness webhook.
69
+ * Internal-only: not documented in the public API reference (deliberate exception, see
70
+ * CLAUDE.md's API Change Propagation Rules — mirrors the /oauth exception).
71
+ * @async
72
+ * @roles signalhouse_api, signalhouse_admin
73
+ * @param {Object} params - The parameters for recording a registration
74
+ * @param {string} params.groupId - The just-provisioned group's ID
75
+ * @param {string} params.registrationSource - Which surface provisioned this group ("ghl" or "shopify")
76
+ * @param {string} [params.firstName] - The account owner's first name
77
+ * @param {string} [params.fullName] - The account owner's full name
78
+ * @param {string} [params.email] - The account owner's email
79
+ * @param {string} [params.phone] - The account owner's phone number
80
+ * @param {string} [params.estimatedVolume] - Estimated monthly message volume
81
+ * @param {RequestOptions} [params.options] - Additional options for the request
82
+ * @throws {Error} Throws an error if the groupId or registrationSource parameter is missing
83
+ * @returns {Promise<SdkResponse<any>>} - `{ success: true }`
84
+ */
85
+ recordLifecycleRegistration: async ({ groupId, registrationSource, firstName, fullName, email, phone, estimatedVolume, options = {} }) => {
86
+ this.client._require({ groupId, registrationSource });
87
+ return this.client(`/group/lifecycle/registration`, {
88
+ method: "POST",
89
+ body: { groupId, registrationSource, firstName, fullName, email, phone, estimatedVolume },
90
+ ...options,
91
+ });
92
+ },
93
+
57
94
  /**
58
95
  * Delete a group with the specified group ID
59
96
  * @async
60
97
  * @roles signalhouse
61
98
  * @param {Object} params - The parameters for deleting a group
62
99
  * @param {string} params.groupId - The ID of the group to delete
63
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
100
+ * @param {RequestOptions} [params.options] - Additional options for the request
64
101
  * @throws {Error} Throws an error if the groupId parameter is missing
65
- * @returns {Promise<Object>} - The deleted group object returned from the server
102
+ * @returns {Promise<SdkResponse<any>>} - The deleted group object returned from the server
66
103
  */
67
104
  deleteGroup: async ({ groupId, options = {} }) => {
68
105
  this.client._require({ groupId });
@@ -78,9 +115,9 @@ export class Groups {
78
115
  * @param {Object} params - The parameters for updating a group's compliance status
79
116
  * @param {string} params.groupId - The ID of the group to update
80
117
  * @param {string} params.complianceStatus - One of "unverified", "pending", "verified", "rejected"
81
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
118
+ * @param {RequestOptions} [params.options] - Additional options for the request
82
119
  * @throws {Error} Throws an error if the groupId or complianceStatus parameter is missing
83
- * @returns {Promise<Object>} - The updated group object returned from the server
120
+ * @returns {Promise<SdkResponse<any>>} - The updated group object returned from the server
84
121
  */
85
122
  updateComplianceStatus: async ({ groupId, complianceStatus, options = {} }) => {
86
123
  this.client._require({ groupId, complianceStatus });
@@ -99,9 +136,9 @@ export class Groups {
99
136
  * @param {string} params.externalSystem - The external system ("ghl" or "shopify")
100
137
  * @param {string} params.externalId - The external tenant identifier
101
138
  * @param {string} [params.existingGroupId] - An existing V2 group ID to repoint to, if any
102
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
139
+ * @param {RequestOptions} [params.options] - Additional options for the request
103
140
  * @throws {Error} Throws an error if linkToken, externalSystem, or externalId is missing
104
- * @returns {Promise<Object>} - The link outcome ({ status, canonicalGroupId, ... })
141
+ * @returns {Promise<SdkResponse<any>>} - The link outcome ({ status, canonicalGroupId, ... })
105
142
  */
106
143
  linkExternal: async ({ linkToken, externalSystem, externalId, existingGroupId, options = {} }) => {
107
144
  this.client._require({ linkToken, externalSystem, externalId });
@@ -121,8 +158,8 @@ export class Groups {
121
158
  * @roles api, admin, developer, billing, user
122
159
  * @param {Object} params - The parameters for getting a group
123
160
  * @param {string} params.id - The ID of the group to retrieve
124
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
125
- * @returns {Promise<Object>} - The group object returned from the server
161
+ * @param {RequestOptions} [params.options] - Additional options for the request
162
+ * @returns {Promise<SdkResponse<any>>} - The group object returned from the server
126
163
  */
127
164
  async getGroup({ id, options = {} }) {
128
165
  const filters = { id };
@@ -138,9 +175,9 @@ export class Groups {
138
175
  * @param {string} params.id - The ID of the group to update
139
176
  * @param {Object} params.groupData - The data for the group, including required fields such as groupName.
140
177
  * Optional CNP fields: cspId (string|null), defaultCnpSubgroupId (string|null)
141
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
178
+ * @param {RequestOptions} [params.options] - Additional options for the request
142
179
  * @throws {Error} Throws an error if the id or groupData parameter is missing
143
- * @returns {Promise<Object>} - The updated group object returned from the server
180
+ * @returns {Promise<SdkResponse<any>>} - The updated group object returned from the server
144
181
  */
145
182
  async updateGroup({ id, groupData, options = {} }) {
146
183
  this.client._require({ id, groupData: groupData });
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  /**
2
8
  * @typedef {Object} TollFreeConsentBox
3
9
  * @property {string} useCase - The use case the checkbox covers
@@ -67,9 +73,9 @@ export class Landings {
67
73
  * @roles api, admin, developer, billing, user
68
74
  * @param {Object} params - The parameters for getting a landing page
69
75
  * @param {string} params.landingId - The ID of the landing page to retrieve
70
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
76
+ * @param {RequestOptions} [params.options] - Additional options for the request
71
77
  * @throws {Error} Throws an error if the landingId parameter is missing
72
- * @returns {Promise<Object>} - The landing page object returned from the server
78
+ * @returns {Promise<SdkResponse<any>>} - The landing page object returned from the server
73
79
  */
74
80
  async getLandings({ landingId, options = {} }) {
75
81
  this.client._require({ landingId });
@@ -82,9 +88,9 @@ export class Landings {
82
88
  * @async
83
89
  * @param {Object} params - The parameters for getting a public landing page
84
90
  * @param {string} params.landingId - The ID of the public landing page to retrieve
85
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
91
+ * @param {RequestOptions} [params.options] - Additional options for the request
86
92
  * @throws {Error} Throws an error if the landingId parameter is missing
87
- * @returns {Promise<Object>} - The public landing page object returned from the server
93
+ * @returns {Promise<SdkResponse<any>>} - The public landing page object returned from the server
88
94
  */
89
95
  async getPublicLanding({ landingId, options = {} }) {
90
96
  this.client._require({ landingId });
@@ -98,9 +104,9 @@ export class Landings {
98
104
  * @roles api, admin, developer, billing, user
99
105
  * @param {Object} params - The parameters for creating a new landing page (see CreateLandingData typedef for details)
100
106
  * @param {CreateLandingData} params.landingData - The data for the new landing page, including required fields such as brandId and description
101
- * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
102
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
103
- * @returns {Promise<Object>} - The newly created landing page object returned from the server
107
+ * @param {Blob|File} params.file - A logo image file for the landing page, provided as a Blob/File
108
+ * @param {RequestOptions} [params.options] - Additional options for the request
109
+ * @returns {Promise<SdkResponse<any>>} - The newly created landing page object returned from the server
104
110
  */
105
111
  async createLanding({ landingData, file, options = {} }) {
106
112
  const formData = new FormData();
@@ -111,7 +117,7 @@ export class Landings {
111
117
 
112
118
  Object.entries(landingData).forEach(([key, value]) => {
113
119
  if (value !== undefined) {
114
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
120
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
115
121
  }
116
122
  });
117
123
 
@@ -125,10 +131,10 @@ export class Landings {
125
131
  * @param {Object} params - The parameters for updating a landing page (see UpdateLandingData typedef for details)
126
132
  * @param {string} params.landingId - The ID of the landing page to update
127
133
  * @param {UpdateLandingData} params.landingData - The data for the landing page, including required fields such as brandId and description
128
- * @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
129
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
134
+ * @param {Blob|File} params.file - A logo image file for the landing page, provided as a Blob/File
135
+ * @param {RequestOptions} [params.options] - Additional options for the request
130
136
  * @throws {Error} Throws an error if the landingId parameter is missing
131
- * @returns {Promise<Object>} - The updated landing page object returned from the server
137
+ * @returns {Promise<SdkResponse<any>>} - The updated landing page object returned from the server
132
138
  */
133
139
  async updateLanding({ landingId, landingData, file, options = {} }) {
134
140
  this.client._require({ landingId });
@@ -141,32 +147,22 @@ export class Landings {
141
147
 
142
148
  Object.entries(landingData).forEach(([key, value]) => {
143
149
  if (value !== undefined) {
144
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
150
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
145
151
  }
146
152
  });
147
153
 
148
154
  return this.multipartClient(`/landing/${safeLandingId}`, { method: "PUT", body: formData, ...options });
149
155
  }
150
156
 
151
- /**
152
- * Delete a landing page by its ID
153
- * @async
154
- * @roles api, admin, developer, billing, user
155
- * @param {Object} params - The parameters for deleting a landing page
156
- * @param {string} params.landingId - The ID of the landing page to delete
157
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
158
- * @throws {Error} Throws an error if the landingId parameter is missing
159
- * @returns {Promise<Object>} - The response from the server after deleting the landing page
160
- */
161
157
  /**
162
158
  * Get a landing page by its associated brand ID
163
159
  * @async
164
160
  * @roles api, admin, developer, billing, user
165
161
  * @param {Object} params - The parameters for getting a landing page by brand
166
162
  * @param {string} params.brandId - The brand ID to look up the landing page for
167
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
163
+ * @param {RequestOptions} [params.options] - Additional options for the request
168
164
  * @throws {Error} Throws an error if the brandId parameter is missing
169
- * @returns {Promise<Object>} - The landing page object returned from the server
165
+ * @returns {Promise<SdkResponse<any>>} - The landing page object returned from the server
170
166
  */
171
167
  async getLandingByBrandId({ brandId, options = {} }) {
172
168
  this.client._require({ brandId });
@@ -181,9 +177,9 @@ export class Landings {
181
177
  * @roles api, admin, developer, billing, user
182
178
  * @param {Object} params - The parameters for getting a landing page template
183
179
  * @param {string} params.brandId - The brand ID to look up the template for
184
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
180
+ * @param {RequestOptions} [params.options] - Additional options for the request
185
181
  * @throws {Error} Throws an error if the brandId parameter is missing
186
- * @returns {Promise<Object>} - The template returned from the server
182
+ * @returns {Promise<SdkResponse<any>>} - The template returned from the server
187
183
  */
188
184
  async getLandingTemplate({ brandId, options = {} }) {
189
185
  this.client._require({ brandId });
@@ -199,11 +195,11 @@ export class Landings {
199
195
  * @param {Object} params - The parameters for saving a landing page template
200
196
  * @param {string} params.brandId - The brand the template belongs to
201
197
  * @param {LandingTemplateData} params.templateData - The template fields (see LandingTemplateData typedef)
202
- * @param {Buffer} [params.file] - A logo image file, provided as a Buffer. Required the first time only;
198
+ * @param {Blob|File} [params.file] - A logo image file, provided as a Blob/File. Required the first time only;
203
199
  * omit it on a later save to keep the stored logo
204
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
200
+ * @param {RequestOptions} [params.options] - Additional options for the request
205
201
  * @throws {Error} Throws an error if the brandId parameter is missing
206
- * @returns {Promise<Object>} - The saved template returned from the server
202
+ * @returns {Promise<SdkResponse<any>>} - The saved template returned from the server
207
203
  */
208
204
  async upsertLandingTemplate({ brandId, templateData, file, options = {} }) {
209
205
  this.client._require({ brandId });
@@ -216,13 +212,23 @@ export class Landings {
216
212
 
217
213
  Object.entries(templateData).forEach(([key, value]) => {
218
214
  if (value !== undefined) {
219
- formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
215
+ formData.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
220
216
  }
221
217
  });
222
218
 
223
219
  return this.multipartClient(`/landing/template/${safeBrandId}`, { method: "PUT", body: formData, ...options });
224
220
  }
225
221
 
222
+ /**
223
+ * Delete a landing page by its ID
224
+ * @async
225
+ * @roles api, admin, developer, billing, user
226
+ * @param {Object} params - The parameters for deleting a landing page
227
+ * @param {string} params.landingId - The ID of the landing page to delete
228
+ * @param {RequestOptions} [params.options] - Additional options for the request
229
+ * @throws {Error} Throws an error if the landingId parameter is missing
230
+ * @returns {Promise<SdkResponse<any>>} - The response from the server after deleting the landing page
231
+ */
226
232
  async deleteLanding({ landingId, options = {} }) {
227
233
  this.client._require({ landingId });
228
234
  const safeLandingId = encodeURIComponent(landingId);