@signalhouse-sms/sdk 1.12.0 → 1.13.0

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": "@signalhouse-sms/sdk",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -47,6 +47,8 @@ import { Notifications } from "./domains/Notifications.js";
47
47
  import { Webhooks } from "./domains/Webhooks.js";
48
48
  import { Voice } from "./domains/Voice.js";
49
49
  import { Agents } from "./domains/Agents.js";
50
+ import { Audit } from "./domains/Audit.js";
51
+ import { Verify } from "./domains/Verify.js";
50
52
 
51
53
  export class SignalHouseSDK {
52
54
  /**
@@ -98,6 +100,9 @@ export class SignalHouseSDK {
98
100
  this.voice = new Voice(client, this.enableAdmin);
99
101
  // AI Agents domain — customer-facing agent config under /agent.
100
102
  this.agents = new Agents(client, this.enableAdmin);
103
+ this.audit = new Audit(client, this.enableAdmin);
104
+ // Carrier phone-number checks (SIM Swap, Number Verify) under /verify.
105
+ this.verify = new Verify(client, this.enableAdmin);
101
106
  }
102
107
 
103
108
  /**
@@ -0,0 +1,39 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
7
+ /**
8
+ * Audit domain: the staff read of who changed a registration or a message template, and what changed. Every method lives
9
+ * under the admin namespace, present only when the SDK is created with `enableAdmin: true`.
10
+ */
11
+ export class Audit {
12
+ constructor(client, enableAdmin) {
13
+ this.client = client;
14
+ this.enableAdmin = enableAdmin;
15
+
16
+ // Hidden Admin namespace INSIDE the domain
17
+ if (enableAdmin) {
18
+ this.admin = {
19
+ /**
20
+ * Get audit events, newest first: one registration's or template's, or a group's. Staff-only.
21
+ * @async
22
+ * @roles signalhouse
23
+ * @param {Object} params
24
+ * @param {("registration"|"template")} [params.entityType] - The entity type; required with entityId
25
+ * @param {string} [params.entityId] - The registration id or template id
26
+ * @param {string} [params.groupId] - The owning group; required when entityId is omitted
27
+ * @param {number} [params.page] - Page number (default 1)
28
+ * @param {number} [params.limit] - Events per page (default 25, max 100)
29
+ * @param {RequestOptions} [params.options] - Additional options for the request
30
+ * @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`; each event is `{ _id, occurredAt, actor: { type, userId, role }, entity: { type, id, groupId }, action, changes: [{ path, from, to }] }`
31
+ */
32
+ getAuditEvents: async ({ entityType, entityId, groupId, page, limit, options = {} } = {}) => {
33
+ const queryString = this.client._getQueryString({ entityType, entityId, groupId, page, limit });
34
+ return this.client(`/audit${queryString}`, { method: "GET", ...options });
35
+ },
36
+ };
37
+ }
38
+ }
39
+ }
@@ -142,7 +142,7 @@ export class Messages {
142
142
  * @param {string} params.id - The message ID
143
143
  * @param {RequestOptions} [params.options] - Additional options for the request
144
144
  * @throws {Error} Throws an error if the id parameter is missing
145
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404. An RCS message and its fallback leg also carry `costBreakdown`: `{ legs: [{ messageId, channel, billed, billingClass, segments, baseMicros, carrierMicros, rated }] }`, null when it cannot be computed
145
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404. An RCS message and its fallback leg also carry `costBreakdown`: `{ legs: [{ messageId, channel, billed, billingClass, segments, baseMicros, carrierMicros, rated }] }`, null when it cannot be computed. A settled RCS message also carries `carrierFeeMicros`: the carrier pass-through and media surcharge it was charged
146
146
  */
147
147
  async getMessage({ id, options = {} }) {
148
148
  this.client._require({ id });
@@ -427,6 +427,28 @@ export class Messages {
427
427
  return this.client(`/message/dnc${queryString}`, { method: "GET", ...options });
428
428
  }
429
429
 
430
+ /**
431
+ * Export the group's consent ledger, newest first: one append-only record per opt-out or opt-in a recipient gave (a STOP
432
+ * or START keyword, or the confirmation of an opt-out link). It records only; sends do not read it.
433
+ * @async
434
+ * @roles api, admin, developer, billing, user
435
+ * @param {Object} params - The parameters for exporting consent records
436
+ * @param {string} params.groupId - The group whose records to read
437
+ * @param {string} [params.recipientPhoneNumber] - One handset, in any spelling; matched on its digits
438
+ * @param {string} [params.startDate] - Earliest occurredAt, ISO-8601; a bare date is its whole UTC day, a timestamp is bound as sent
439
+ * @param {string} [params.endDate] - Latest occurredAt, ISO-8601; a bare date is its whole UTC day, a timestamp is bound as sent
440
+ * @param {number} [params.page] - Page number (default 1)
441
+ * @param {number} [params.limit] - Records per page (default 100, max 500)
442
+ * @param {RequestOptions} [params.options] - Additional options for the request
443
+ * @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`. Each record carries groupId, subgroupId, recipientPhoneNumber (the handset),
444
+ * phoneNumber (the business number or RCS agent id that received it), scope `{ type: CAMPAIGN|AGENT|SUBGROUP, id }`,
445
+ * clearedScopes (for OPT_IN, every `{ type, id }` the START cleared; empty for OPT_OUT), action (OPT_OUT or OPT_IN), source (KEYWORD or LINK), keyword, messageType (SMS, MMS or RCS), messageId, actor `{ type: "RECIPIENT" }`, occurredAt and createdAt.
446
+ */
447
+ async getConsentRecords({ groupId, recipientPhoneNumber, startDate, endDate, page, limit, options = {} }) {
448
+ const queryString = this.client._getQueryString({ groupId, recipientPhoneNumber, startDate, endDate, page, limit });
449
+ return this.client(`/message/dnc/consent-records${queryString}`, { method: "GET", ...options });
450
+ }
451
+
430
452
  /**
431
453
  * Send an SMS message to one or more recipient phone numbers
432
454
  *
@@ -47,6 +47,16 @@
47
47
  * @property {string} [mobile] - Mobile number, E.164
48
48
  */
49
49
 
50
+ /**
51
+ * Where one prefilled field's value came from. The agent's `autofill` holds one per field, keyed by its path
52
+ * (`consent.optInDetails`); the API marks a field `edited` once its value changes.
53
+ * @typedef {Object} RcsAgentAutofillMarker
54
+ * @property {("brand"|"campaign"|"landing")} source - The record the value came from
55
+ * @property {string|null} [sourceId] - That record's id (brand ID, campaign ID or landing page ID)
56
+ * @property {string} [at] - When the field was filled (ISO 8601; default now)
57
+ * @property {boolean} [edited] - Whether the value changed since (default false)
58
+ */
59
+
50
60
  /**
51
61
  * One recipient of an RCS send.
52
62
  * @typedef {Object} RcsRecipient
@@ -111,14 +121,15 @@ export class RcsAgents {
111
121
  * @param {{ mode?: string, channel?: string, from?: string }|null} [params.defaultFallback] - Fallback mode (auto, rcs_only, sms_only, none), channel (auto, sms, mms) and from, a number on the linked campaign
112
122
  * @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
113
123
  * @param {string[]} [params.testers] - Tester numbers (up to 200), invited once the agent exists at the carrier
124
+ * @param {Object<string, RcsAgentAutofillMarker>} [params.autofill] - Where the fields you prefilled came from, by path (`consent.optInDetails`); the API adds its own for what it fills
114
125
  * @param {RequestOptions} [params.options] - Additional options for the request
115
126
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status DRAFT)
116
127
  */
117
- async create({ brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options = {} }) {
128
+ async create({ brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, autofill, options = {} }) {
118
129
  this.client._require({ brandId });
119
130
  return this.client("/rcs/agent", {
120
131
  method: "POST",
121
- body: { brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers },
132
+ body: { brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, autofill },
122
133
  ...options,
123
134
  });
124
135
  }
@@ -150,7 +161,7 @@ export class RcsAgents {
150
161
  * @param {Object} params - The lookup
151
162
  * @param {string} params.agentId - The agent ID (e.g. RCSA7K2M1QZ8RP)
152
163
  * @param {RequestOptions} [params.options] - Additional options for the request
153
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
164
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent; googleAgentId is Google's id for it, null until Google has created the agent
154
165
  */
155
166
  async get({ agentId, options = {} }) {
156
167
  this.client._require({ agentId });
@@ -159,9 +170,11 @@ export class RcsAgents {
159
170
 
160
171
  /**
161
172
  * Edit an agent while it may change: a draft, a Signal House rejection, a request for changes, or an agent in
162
- * testing (the change is pushed to the carrier partner). `agent`, `consent` and `contact` merge field by field;
163
- * every other key replaces; campaignId: null unlinks the campaign. 409 in any other status; brandId is locked once
164
- * the agent exists at the partner and billingCategory once a launch was requested.
173
+ * testing (the change is pushed to the carrier partner). After a carrier rejected a launch other carriers took
174
+ * (PARTIALLY_LAUNCHED with a REJECTED carrier), only `consent` and `contact` may change, and nothing is pushed: send
175
+ * them with requestCarrierUpdate. `agent`, `consent` and `contact` merge field by field; every other key replaces;
176
+ * campaignId: null unlinks the campaign. 409 in any other status; brandId is locked once the agent exists at the
177
+ * partner and billingCategory once a launch was requested.
165
178
  * @async
166
179
  * @roles api, admin, developer, billing, user
167
180
  * @param {Object} params - The edit
@@ -176,14 +189,15 @@ export class RcsAgents {
176
189
  * @param {Object|null} [params.defaultFallback] - The fallback
177
190
  * @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
178
191
  * @param {string[]} [params.testers] - Tester numbers
192
+ * @param {Object<string, RcsAgentAutofillMarker>} [params.autofill] - Replaces the prefill markers; omitted, the stored ones are kept and a changed field's marker turns edited
179
193
  * @param {RequestOptions} [params.options] - Additional options for the request
180
194
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
181
195
  */
182
- async update({ agentId, brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options = {} }) {
196
+ async update({ agentId, brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, autofill, options = {} }) {
183
197
  this.client._require({ agentId });
184
198
  return this.client(`/rcs/agent/${encodeURIComponent(agentId)}`, {
185
199
  method: "PUT",
186
- body: { brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers },
200
+ body: { brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, autofill },
187
201
  ...options,
188
202
  });
189
203
  }
@@ -192,6 +206,8 @@ export class RcsAgents {
192
206
  * Check an agent against the next gate on its path without writing: before it exists at the carrier partner, what
193
207
  * creating it needs (the full profile, useCase, a billingCategory); after that, what the launch request needs
194
208
  * (a VERIFIED brand, the campaign, the full consent with the video, the contact)
209
+ * The launch gate also runs the carriers' copy rules; each error carries the carrier partner's key as `code`, for
210
+ * example OPT_IN_MSG_RATE_DISCL_MISSING.
195
211
  * @async
196
212
  * @roles api, admin, developer, billing, user
197
213
  * @param {Object} params - The lookup
@@ -208,6 +224,8 @@ export class RcsAgents {
208
224
  * Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a
209
225
  * useCase and a billingCategory; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
210
226
  * errors, warnings }. The agent moves to AGENT_CREATING, then IN_TESTING once the partner reports it ready.
227
+ * A group that has not finished account verification gets a 403 with code GROUP_UNVERIFIED, and a rejected one a 403
228
+ * with code GROUP_REJECTED; a pending verification passes.
211
229
  * @async
212
230
  * @roles api, admin, developer, billing, user
213
231
  * @param {Object} params - The submission
@@ -224,7 +242,9 @@ export class RcsAgents {
224
242
  * Request the agent's launch: the launch requirements are checked and the agent goes to Signal House review (status
225
243
  * PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
226
244
  * CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
227
- * "REGISTRATION_INCOMPLETE", errors, warnings }. Sends POST /registration/:agentId/launch: the agent is a registration.
245
+ * "REGISTRATION_INCOMPLETE", errors, warnings }, and a copy-rule error carries the carrier partner's key as its `code`
246
+ * (for example OPT_IN_MSG_RATE_DISCL_MISSING). A group that has not finished account verification gets a 403 with code
247
+ * GROUP_UNVERIFIED, and a rejected one a 403 with code GROUP_REJECTED. Sends POST /registration/:agentId/launch: the agent is a registration.
228
248
  * The request charges the agent's launch fees: a wallet that cannot cover them gets a 402, and the agent stays where it is. When any fee is due the request must set acknowledgeFees: true, or it gets a 400 with code FEE_ACKNOWLEDGEMENT_REQUIRED and nothing is held; a launch with nothing due needs no acknowledgement. The agent's launchFees quotes what the next request charges.
229
249
  * When the agent's brand vertical is healthcare or insurance, the launch needs the protected health information (PHI) disclosure acknowledged: send acknowledgePhi: true, or the request gets a 400 REGISTRATION_INCOMPLETE whose errors name consent.phiAcknowledgement. The API records the acknowledgement as consent.phiAcknowledgement { acknowledgedAt, acknowledgedBy } from the caller; the client sends only the boolean, and an agent update cannot set it. Once recorded, a later launch request needs no new acknowledgement.
230
250
  * @async
@@ -241,6 +261,24 @@ export class RcsAgents {
241
261
  return this.client(`/registration/${encodeURIComponent(agentId)}/launch`, { method: "POST", body: { acknowledgeFees, acknowledgePhi }, ...options });
242
262
  }
243
263
 
264
+ /**
265
+ * Send Signal House the corrected launch answers after a carrier rejected a launch other carriers took. The carrier
266
+ * partner takes no change through its API once a carrier launched, so Signal House emails it the update; edit
267
+ * `consent` and `contact` first. The agent's carrierUpdate reads REQUESTED for the rejected carriers, then SENT once
268
+ * Signal House sent it. 409 when no carrier is REJECTED after a partial launch, or an update already waits.
269
+ * Sends POST /registration/:agentId/carrier-update: the agent is a registration.
270
+ * @async
271
+ * @roles api, admin, developer, billing, user
272
+ * @param {Object} params - The request
273
+ * @param {string} params.agentId - The agent ID
274
+ * @param {RequestOptions} [params.options] - Additional options for the request
275
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent's registration, with data.carrierUpdate
276
+ */
277
+ async requestCarrierUpdate({ agentId, options = {} }) {
278
+ this.client._require({ agentId });
279
+ return this.client(`/registration/${encodeURIComponent(agentId)}/carrier-update`, { method: "POST", ...options });
280
+ }
281
+
244
282
  /**
245
283
  * Archive an agent. One the carrier partner created stops sending at once and stays ARCHIVE_PENDING until Signal House confirms the partner cancelled it, then ARCHIVED. Archiving cannot be undone; an agent already ARCHIVE_PENDING answers 409.
246
284
  * @async
@@ -255,6 +293,24 @@ export class RcsAgents {
255
293
  return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/archive`, { method: "POST", ...options });
256
294
  }
257
295
 
296
+ /**
297
+ * Make the links that start a chat with the agent: an sms: deep link in Google's format, and a short link that redirects to it,
298
+ * to print as a QR code. With the agent's defaultFallback.from, the deep link names that number, so a handset that cannot reach
299
+ * the agent texts it instead. The same request returns the same short link. The links work for approved testers until a carrier
300
+ * launches the agent; before Google has created the agent the request answers 409 with code GOOGLE_AGENT_PENDING.
301
+ * @async
302
+ * @roles api, admin, developer, billing, user
303
+ * @param {Object} params - The request
304
+ * @param {string} params.agentId - The agent ID
305
+ * @param {string} [params.body] - The message the chat opens with, prefilled on the handset (max 1,000 characters)
306
+ * @param {RequestOptions} [params.options] - Additional options for the request
307
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { googleAgentId, deepLink, shortLink }
308
+ */
309
+ async createEntryPoints({ agentId, body, options = {} }) {
310
+ this.client._require({ agentId });
311
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/entry-points`, { method: "POST", body: { body }, ...options });
312
+ }
313
+
258
314
  /**
259
315
  * Resend a tester's expired invitation, which starts a new 24 hours for the tester to accept it. The number must be
260
316
  * a tester on the agent (404) and its invitation must be EXPIRED (409); up to 20 invitations go out a day (429).
@@ -356,6 +412,42 @@ export class RcsMessages {
356
412
  });
357
413
  }
358
414
 
415
+ /**
416
+ * Send an RCS message to up to 10,000 recipients in the background. The request runs the send's request checks, splits the
417
+ * recipients into chunks of 100, queues each chunk and answers 202. Every message carries the shared bulkId; track progress with
418
+ * the messages list filtered by bulkId (GET /message?bulkId=) and per-message webhooks. A chunk the wallet cannot cover, or that is
419
+ * refused after acceptance, gets BLOCKED messages with blockReason INSUFFICIENT_FUNDS or SEND_REFUSED; a chunk that keeps failing
420
+ * gets SEND_FAILED. Pass options.idempotencyKey to make a retry safe (same bulkId, no duplicate sends); a retry without one may
421
+ * send duplicates.
422
+ * @async
423
+ * @roles api, admin, developer, billing, user
424
+ * @param {Object} params - The send; the same fields as send
425
+ * @param {string} params.agentId - The agent that sends (RCSA…)
426
+ * @param {RcsRecipient[]} params.recipients - Up to 10,000 recipients
427
+ * @param {string} [params.templateId] - A template to send; exactly one of templateId or content
428
+ * @param {number} [params.templateVersion] - A published version of templateId; needs templateId. Pinned when the batch is accepted
429
+ * @param {Object} [params.content] - Inline content; exactly one of templateId or content
430
+ * @param {string} [params.contentFormat] - content.v1 (default) or google.rcs
431
+ * @param {("AUTHENTICATION"|"TRANSACTION"|"SERVICEREQUEST"|"ACKNOWLEDGEMENT"|"PROMOTION")} [params.trafficType] - Required on a MULTI_USE agent when the template sets none
432
+ * @param {number} [params.ttlSeconds] - Seconds each RCS message may wait for delivery, from when its chunk is sent; at most one of ttlSeconds or expireTime
433
+ * @param {string} [params.expireTime] - ISO-8601 time the RCS messages expire
434
+ * @param {RcsMessageFallback} [params.fallback] - The fallback for this send
435
+ * @param {string} [params.statusCallbackUrl] - URL that receives each message's events
436
+ * @param {boolean} [params.enableShortlink] - Shorten the links in the message
437
+ * @param {boolean} [params.isTest] - Send as a test; approved testers only
438
+ * @param {("not_capable"|"ttl_expired"|"delivered"|"read")} [params.simulate] - Simulate this outcome; approved testers only
439
+ * @param {RequestOptions} [params.options] - Additional options for the request
440
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { bulkId, status: "ACCEPTED", recipientCount } (202). Every message of the batch carries bulkId. A recipient from 19999990000 to 19999990359 makes the whole request a simulation, as on send
441
+ */
442
+ async sendBatch({ agentId, recipients, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, statusCallbackUrl, enableShortlink, isTest, simulate, options = {} }) {
443
+ this.client._require({ agentId, recipients });
444
+ return this.client("/message/rcs/batch", {
445
+ method: "POST",
446
+ body: { agentId, recipients, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, statusCallbackUrl, enableShortlink, isTest, simulate },
447
+ ...options,
448
+ });
449
+ }
450
+
359
451
  /**
360
452
  * Check a send without writing anything. Takes the same parameters as send.
361
453
  * @async
@@ -460,7 +552,7 @@ export class RcsMessages {
460
552
  * @param {Object} params - The lookup
461
553
  * @param {string} params.messageId - The message ID
462
554
  * @param {RequestOptions} [params.options] - Additional options for the request
463
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the message; an unknown ID is a 404
555
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the message; an unknown ID is a 404. A settled RCS message carries carrierFeeMicros, the carrier pass-through and media surcharge it was charged
464
556
  */
465
557
  async get({ messageId, options = {} }) {
466
558
  this.client._require({ messageId });
@@ -488,7 +580,7 @@ export class RcsMessages {
488
580
  * @param {string} [params.deliveredChannel] - Filter by the channel that delivered the message (rcs, sms, mms)
489
581
  * @param {boolean} [params.isTest] - true for test messages only, false to leave them out
490
582
  * @param {RequestOptions} [params.options] - Additional options for the request
491
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of messages
583
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of messages; a settled RCS message carries carrierFeeMicros
492
584
  */
493
585
  async list({ groupId, from, to, agentId, status, page, limit, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, options = {} }) {
494
586
  this.client._require({ groupId, from, to });
@@ -159,6 +159,63 @@ export class Registrations {
159
159
  ...options,
160
160
  });
161
161
  },
162
+
163
+ /**
164
+ * Mark an RCS agent's requested carrier update as sent, once staff emailed it to the carrier partner (signalhouse only)
165
+ * @async
166
+ * @roles signalhouse
167
+ * @param {Object} params - The parameters for the update
168
+ * @param {string} params.registrationId - The agent's registration ID (e.g. RCSA7K2M1QZ8RP)
169
+ * @param {RequestOptions} [params.options] - Additional options for the request
170
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, as staff read it; 409 when no update is REQUESTED
171
+ */
172
+ markCarrierUpdateSent: async ({ registrationId, options = {} }) => {
173
+ this.client._require({ registrationId });
174
+ const safeId = encodeURIComponent(registrationId);
175
+ return this.client(`/registration/${safeId}/carrier-update`, {
176
+ method: "PUT",
177
+ body: { status: "SENT" },
178
+ ...options,
179
+ });
180
+ },
181
+
182
+ /**
183
+ * Add an internal comment to a registration of any type; comments are append-only and never reach the customer (signalhouse only)
184
+ * @async
185
+ * @roles signalhouse
186
+ * @param {Object} params - The parameters for the comment
187
+ * @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
188
+ * @param {string} params.comment - The comment, 1 to 2,000 characters
189
+ * @param {RequestOptions} [params.options] - Additional options for the request
190
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { comment, createdAt, createdBy, createdByRole }
191
+ */
192
+ addComment: async ({ registrationId, comment, options = {} }) => {
193
+ this.client._require({ registrationId, comment });
194
+ const safeId = encodeURIComponent(registrationId);
195
+ return this.client(`/registration/${safeId}/comments`, {
196
+ method: "POST",
197
+ body: { comment },
198
+ ...options,
199
+ });
200
+ },
201
+
202
+ /**
203
+ * List a registration's internal comments, newest first (signalhouse only)
204
+ * @async
205
+ * @roles signalhouse
206
+ * @param {Object} params - The parameters for the read
207
+ * @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
208
+ * @param {RequestOptions} [params.options] - Additional options for the request
209
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { comments: [{ comment, createdAt, createdBy, createdByRole }] }
210
+ */
211
+ getComments: async ({ registrationId, options = {} }) => {
212
+ this.client._require({ registrationId });
213
+ const safeId = encodeURIComponent(registrationId);
214
+ return this.client(`/registration/${safeId}/comments`, {
215
+ method: "GET",
216
+ ...options,
217
+ });
218
+ },
162
219
  };
163
220
  }
164
221
  }
@@ -278,7 +335,8 @@ export class Registrations {
278
335
  * Submit a draft. A type Signal House reviews goes to SIGNAL_HOUSE_REVIEW; a type it does not (RCS_AGENT) goes to
279
336
  * SUBMITTING and is filed with the provider at once. A draft that fails a requirement gets a 400 whose details carry
280
337
  * { code: "REGISTRATION_INCOMPLETE", errors, warnings }; a second submit, or one of a registration the provider
281
- * already holds, gets a 409.
338
+ * already holds, gets a 409. An RCS agent whose group has not finished account verification gets a 403 with code
339
+ * GROUP_UNVERIFIED, and one whose group is rejected a 403 with code GROUP_REJECTED.
282
340
  * @async
283
341
  * @roles api, admin, developer, billing, user
284
342
  * @param {Object} params - The parameters for the submission
@@ -297,7 +355,9 @@ export class Registrations {
297
355
  * are checked and the registration goes to SIGNAL_HOUSE_REVIEW, whose approval files the provider's launch request.
298
356
  * Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
299
357
  * carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
300
- * { code: "REGISTRATION_INCOMPLETE", errors, warnings }.
358
+ * { code: "REGISTRATION_INCOMPLETE", errors, warnings }; an RCS agent's copy-rule error carries the carrier partner's key
359
+ * as its `code` (for example OPT_IN_MSG_RATE_DISCL_MISSING). An RCS agent whose group has not finished account
360
+ * verification gets a 403 with code GROUP_UNVERIFIED, and one whose group is rejected a 403 with code GROUP_REJECTED.
301
361
  * An RCS agent's launch request charges its launch fees: a wallet that cannot cover them gets a 402, and nothing changes. When any fee is due the request must set acknowledgeFees: true, or it gets a 400 with code FEE_ACKNOWLEDGEMENT_REQUIRED and nothing is held; a launch with nothing due needs no acknowledgement.
302
362
  * When the agent's brand vertical is healthcare or insurance, the launch needs the protected health information (PHI) disclosure acknowledged: send acknowledgePhi: true, or the request gets a 400 REGISTRATION_INCOMPLETE whose errors name consent.phiAcknowledgement. The API records the acknowledgement as consent.phiAcknowledgement { acknowledgedAt, acknowledgedBy } from the caller; the client sends only the boolean, and an agent update cannot set it. Once recorded, a later launch request needs no new acknowledgement.
303
363
  * @async
@@ -0,0 +1,72 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
7
+ /**
8
+ * Carrier phone-number checks under /verify: SIM Swap and Number Verify. Every check the carrier answers is billed to
9
+ * the group's wallet (402 on insufficient funds); a check the carrier cannot run for the number is a 422 and is not charged.
10
+ */
11
+ export class Verify {
12
+ /**
13
+ * Keep the JSON client every verify request goes through.
14
+ * @param {any} client - The JSON request client
15
+ * @param {boolean} [enableAdmin] - Whether admin-scoped behaviors are enabled
16
+ */
17
+ constructor(client, enableAdmin) {
18
+ this.client = client;
19
+ this.enableAdmin = enableAdmin;
20
+ }
21
+
22
+ /**
23
+ * Check whether a number's SIM card changed recently, as reported by its carrier. Billed once when the check answers;
24
+ * 422 when the check is not available for the number (not charged)
25
+ * @async
26
+ * @roles api, admin, developer
27
+ * @param {Object} params - The check
28
+ * @param {string} params.phoneNumber - The number to check, in international format (e.g. "+12025550123")
29
+ * @param {number} [params.maxAge] - Lookback window in hours, 1-2400; the carrier's default when omitted
30
+ * @param {boolean} [params.includeSwapDate] - Also return the latest SIM change date (no extra charge; default false)
31
+ * @param {RequestOptions} [params.options] - Additional options for the request
32
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, swapped, maxAge, latestSimChange?, cost }`
33
+ */
34
+ async checkSimSwap({ phoneNumber, maxAge, includeSwapDate, options = {} }) {
35
+ this.client._require({ phoneNumber });
36
+ const body = { phoneNumber, ...(maxAge !== undefined && { maxAge }), ...(includeSwapDate !== undefined && { includeSwapDate }) };
37
+ return this.client(`/verify/sim-swap`, { method: "POST", body, ...options });
38
+ }
39
+
40
+ /**
41
+ * Start a Number Verify check. The end user's phone must open the returned `authorizationUrl` on mobile data (Wi-Fi off)
42
+ * within 10 minutes; the carrier then confirms whether the phone's own number matches. Read the result with
43
+ * getNumberVerification. Billed only when the check is answered (VERIFIED or NOT_VERIFIED)
44
+ * @async
45
+ * @roles api, admin, developer
46
+ * @param {Object} params - The check
47
+ * @param {string} params.phoneNumber - The number to verify, in international format (e.g. "+12025550123")
48
+ * @param {string} [params.devicePhoneNumber] - The phone's own number, sent to the carrier as a login hint
49
+ * @param {string} [params.redirectUrl] - An https URL the end user's browser is sent to after the check, with `?checkId=…`
50
+ * @param {RequestOptions} [params.options] - Additional options for the request
51
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status: "PENDING", authorizationUrl, expiresAt }`
52
+ */
53
+ async startNumberVerification({ phoneNumber, devicePhoneNumber, redirectUrl, options = {} }) {
54
+ this.client._require({ phoneNumber });
55
+ const body = { phoneNumber, ...(devicePhoneNumber !== undefined && { devicePhoneNumber }), ...(redirectUrl !== undefined && { redirectUrl }) };
56
+ return this.client(`/verify/number`, { method: "POST", body, ...options });
57
+ }
58
+
59
+ /**
60
+ * Get a Number Verify check's status and result. A PENDING check past its expiresAt reads as EXPIRED
61
+ * @async
62
+ * @roles api, admin, developer, billing, user
63
+ * @param {Object} params - The lookup
64
+ * @param {string} params.checkId - The check ID (e.g. NVC…)
65
+ * @param {RequestOptions} [params.options] - Additional options for the request
66
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status, devicePhoneNumberVerified, failureReason, createdAt, expiresAt, completedAt, cost }`
67
+ */
68
+ async getNumberVerification({ checkId, options = {} }) {
69
+ this.client._require({ checkId });
70
+ return this.client(`/verify/number/${encodeURIComponent(checkId)}`, { method: "GET", ...options });
71
+ }
72
+ }
@@ -30,6 +30,8 @@ export class SignalHouseSDK {
30
30
  webhooks: Webhooks;
31
31
  voice: Voice;
32
32
  agents: Agents;
33
+ audit: Audit;
34
+ verify: Verify;
33
35
  /**
34
36
  * Client for API requests
35
37
  * @private
@@ -115,3 +117,5 @@ import { Notifications } from "./domains/Notifications.js";
115
117
  import { Webhooks } from "./domains/Webhooks.js";
116
118
  import { Voice } from "./domains/Voice.js";
117
119
  import { Agents } from "./domains/Agents.js";
120
+ import { Audit } from "./domains/Audit.js";
121
+ import { Verify } from "./domains/Verify.js";
@@ -0,0 +1,39 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+ /**
7
+ * Audit domain: the staff read of who changed a registration or a message template, and what changed. Every method lives
8
+ * under the admin namespace, present only when the SDK is created with `enableAdmin: true`.
9
+ */
10
+ export class Audit {
11
+ constructor(client: any, enableAdmin: any);
12
+ client: any;
13
+ enableAdmin: any;
14
+ admin: {
15
+ /**
16
+ * Get audit events, newest first: one registration's or template's, or a group's. Staff-only.
17
+ * @async
18
+ * @roles signalhouse
19
+ * @param {Object} params
20
+ * @param {("registration"|"template")} [params.entityType] - The entity type; required with entityId
21
+ * @param {string} [params.entityId] - The registration id or template id
22
+ * @param {string} [params.groupId] - The owning group; required when entityId is omitted
23
+ * @param {number} [params.page] - Page number (default 1)
24
+ * @param {number} [params.limit] - Events per page (default 25, max 100)
25
+ * @param {RequestOptions} [params.options] - Additional options for the request
26
+ * @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`; each event is `{ _id, occurredAt, actor: { type, userId, role }, entity: { type, id, groupId }, action, changes: [{ path, from, to }] }`
27
+ */
28
+ getAuditEvents: ({ entityType, entityId, groupId, page, limit, options }?: {
29
+ entityType?: ("registration" | "template");
30
+ entityId?: string;
31
+ groupId?: string;
32
+ page?: number;
33
+ limit?: number;
34
+ options?: RequestOptions;
35
+ }) => Promise<SdkResponse<any>>;
36
+ };
37
+ }
38
+ export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
39
+ export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
@@ -127,7 +127,7 @@ export class Messages {
127
127
  * @param {string} params.id - The message ID
128
128
  * @param {RequestOptions} [params.options] - Additional options for the request
129
129
  * @throws {Error} Throws an error if the id parameter is missing
130
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404. An RCS message and its fallback leg also carry `costBreakdown`: `{ legs: [{ messageId, channel, billed, billingClass, segments, baseMicros, carrierMicros, rated }] }`, null when it cannot be computed
130
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404. An RCS message and its fallback leg also carry `costBreakdown`: `{ legs: [{ messageId, channel, billed, billingClass, segments, baseMicros, carrierMicros, rated }] }`, null when it cannot be computed. A settled RCS message also carries `carrierFeeMicros`: the carrier pass-through and media surcharge it was charged
131
131
  */
132
132
  getMessage({ id, options }: {
133
133
  id: string;
@@ -490,6 +490,32 @@ export class Messages {
490
490
  regionScopes?: any[] | string;
491
491
  options?: RequestOptions;
492
492
  }): Promise<SdkResponse<any>>;
493
+ /**
494
+ * Export the group's consent ledger, newest first: one append-only record per opt-out or opt-in a recipient gave (a STOP
495
+ * or START keyword, or the confirmation of an opt-out link). It records only; sends do not read it.
496
+ * @async
497
+ * @roles api, admin, developer, billing, user
498
+ * @param {Object} params - The parameters for exporting consent records
499
+ * @param {string} params.groupId - The group whose records to read
500
+ * @param {string} [params.recipientPhoneNumber] - One handset, in any spelling; matched on its digits
501
+ * @param {string} [params.startDate] - Earliest occurredAt, ISO-8601; a bare date is its whole UTC day, a timestamp is bound as sent
502
+ * @param {string} [params.endDate] - Latest occurredAt, ISO-8601; a bare date is its whole UTC day, a timestamp is bound as sent
503
+ * @param {number} [params.page] - Page number (default 1)
504
+ * @param {number} [params.limit] - Records per page (default 100, max 500)
505
+ * @param {RequestOptions} [params.options] - Additional options for the request
506
+ * @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`. Each record carries groupId, subgroupId, recipientPhoneNumber (the handset),
507
+ * phoneNumber (the business number or RCS agent id that received it), scope `{ type: CAMPAIGN|AGENT|SUBGROUP, id }`,
508
+ * clearedScopes (for OPT_IN, every `{ type, id }` the START cleared; empty for OPT_OUT), action (OPT_OUT or OPT_IN), source (KEYWORD or LINK), keyword, messageType (SMS, MMS or RCS), messageId, actor `{ type: "RECIPIENT" }`, occurredAt and createdAt.
509
+ */
510
+ getConsentRecords({ groupId, recipientPhoneNumber, startDate, endDate, page, limit, options }: {
511
+ groupId: string;
512
+ recipientPhoneNumber?: string;
513
+ startDate?: string;
514
+ endDate?: string;
515
+ page?: number;
516
+ limit?: number;
517
+ options?: RequestOptions;
518
+ }): Promise<SdkResponse<any>>;
493
519
  /**
494
520
  * Send an SMS message to one or more recipient phone numbers
495
521
  *
@@ -43,6 +43,15 @@
43
43
  * @property {string} [email] - An individual's business email
44
44
  * @property {string} [mobile] - Mobile number, E.164
45
45
  */
46
+ /**
47
+ * Where one prefilled field's value came from. The agent's `autofill` holds one per field, keyed by its path
48
+ * (`consent.optInDetails`); the API marks a field `edited` once its value changes.
49
+ * @typedef {Object} RcsAgentAutofillMarker
50
+ * @property {("brand"|"campaign"|"landing")} source - The record the value came from
51
+ * @property {string|null} [sourceId] - That record's id (brand ID, campaign ID or landing page ID)
52
+ * @property {string} [at] - When the field was filled (ISO 8601; default now)
53
+ * @property {boolean} [edited] - Whether the value changed since (default false)
54
+ */
46
55
  /**
47
56
  * One recipient of an RCS send.
48
57
  * @typedef {Object} RcsRecipient
@@ -100,10 +109,11 @@ export class RcsAgents {
100
109
  * @param {{ mode?: string, channel?: string, from?: string }|null} [params.defaultFallback] - Fallback mode (auto, rcs_only, sms_only, none), channel (auto, sms, mms) and from, a number on the linked campaign
101
110
  * @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
102
111
  * @param {string[]} [params.testers] - Tester numbers (up to 200), invited once the agent exists at the carrier
112
+ * @param {Object<string, RcsAgentAutofillMarker>} [params.autofill] - Where the fields you prefilled came from, by path (`consent.optInDetails`); the API adds its own for what it fills
103
113
  * @param {RequestOptions} [params.options] - Additional options for the request
104
114
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status DRAFT)
105
115
  */
106
- create({ brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options }: {
116
+ create({ brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, autofill, options }: {
107
117
  brandId: string;
108
118
  campaignId?: string | null;
109
119
  agent?: RcsAgentProfile;
@@ -118,6 +128,9 @@ export class RcsAgents {
118
128
  } | null;
119
129
  excludedCarriers?: string[];
120
130
  testers?: string[];
131
+ autofill?: {
132
+ [x: string]: RcsAgentAutofillMarker;
133
+ };
121
134
  options?: RequestOptions;
122
135
  }): Promise<SdkResponse<any>>;
123
136
  /**
@@ -152,7 +165,7 @@ export class RcsAgents {
152
165
  * @param {Object} params - The lookup
153
166
  * @param {string} params.agentId - The agent ID (e.g. RCSA7K2M1QZ8RP)
154
167
  * @param {RequestOptions} [params.options] - Additional options for the request
155
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
168
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent; googleAgentId is Google's id for it, null until Google has created the agent
156
169
  */
157
170
  get({ agentId, options }: {
158
171
  agentId: string;
@@ -160,9 +173,11 @@ export class RcsAgents {
160
173
  }): Promise<SdkResponse<any>>;
161
174
  /**
162
175
  * Edit an agent while it may change: a draft, a Signal House rejection, a request for changes, or an agent in
163
- * testing (the change is pushed to the carrier partner). `agent`, `consent` and `contact` merge field by field;
164
- * every other key replaces; campaignId: null unlinks the campaign. 409 in any other status; brandId is locked once
165
- * the agent exists at the partner and billingCategory once a launch was requested.
176
+ * testing (the change is pushed to the carrier partner). After a carrier rejected a launch other carriers took
177
+ * (PARTIALLY_LAUNCHED with a REJECTED carrier), only `consent` and `contact` may change, and nothing is pushed: send
178
+ * them with requestCarrierUpdate. `agent`, `consent` and `contact` merge field by field; every other key replaces;
179
+ * campaignId: null unlinks the campaign. 409 in any other status; brandId is locked once the agent exists at the
180
+ * partner and billingCategory once a launch was requested.
166
181
  * @async
167
182
  * @roles api, admin, developer, billing, user
168
183
  * @param {Object} params - The edit
@@ -177,10 +192,11 @@ export class RcsAgents {
177
192
  * @param {Object|null} [params.defaultFallback] - The fallback
178
193
  * @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
179
194
  * @param {string[]} [params.testers] - Tester numbers
195
+ * @param {Object<string, RcsAgentAutofillMarker>} [params.autofill] - Replaces the prefill markers; omitted, the stored ones are kept and a changed field's marker turns edited
180
196
  * @param {RequestOptions} [params.options] - Additional options for the request
181
197
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
182
198
  */
183
- update({ agentId, brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options }: {
199
+ update({ agentId, brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, autofill, options }: {
184
200
  agentId: string;
185
201
  brandId?: string;
186
202
  campaignId?: string | null;
@@ -192,12 +208,17 @@ export class RcsAgents {
192
208
  defaultFallback?: any | null;
193
209
  excludedCarriers?: string[];
194
210
  testers?: string[];
211
+ autofill?: {
212
+ [x: string]: RcsAgentAutofillMarker;
213
+ };
195
214
  options?: RequestOptions;
196
215
  }): Promise<SdkResponse<any>>;
197
216
  /**
198
217
  * Check an agent against the next gate on its path without writing: before it exists at the carrier partner, what
199
218
  * creating it needs (the full profile, useCase, a billingCategory); after that, what the launch request needs
200
219
  * (a VERIFIED brand, the campaign, the full consent with the video, the contact)
220
+ * The launch gate also runs the carriers' copy rules; each error carries the carrier partner's key as `code`, for
221
+ * example OPT_IN_MSG_RATE_DISCL_MISSING.
201
222
  * @async
202
223
  * @roles api, admin, developer, billing, user
203
224
  * @param {Object} params - The lookup
@@ -213,6 +234,8 @@ export class RcsAgents {
213
234
  * Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a
214
235
  * useCase and a billingCategory; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
215
236
  * errors, warnings }. The agent moves to AGENT_CREATING, then IN_TESTING once the partner reports it ready.
237
+ * A group that has not finished account verification gets a 403 with code GROUP_UNVERIFIED, and a rejected one a 403
238
+ * with code GROUP_REJECTED; a pending verification passes.
216
239
  * @async
217
240
  * @roles api, admin, developer, billing, user
218
241
  * @param {Object} params - The submission
@@ -228,7 +251,9 @@ export class RcsAgents {
228
251
  * Request the agent's launch: the launch requirements are checked and the agent goes to Signal House review (status
229
252
  * PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
230
253
  * CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
231
- * "REGISTRATION_INCOMPLETE", errors, warnings }. Sends POST /registration/:agentId/launch: the agent is a registration.
254
+ * "REGISTRATION_INCOMPLETE", errors, warnings }, and a copy-rule error carries the carrier partner's key as its `code`
255
+ * (for example OPT_IN_MSG_RATE_DISCL_MISSING). A group that has not finished account verification gets a 403 with code
256
+ * GROUP_UNVERIFIED, and a rejected one a 403 with code GROUP_REJECTED. Sends POST /registration/:agentId/launch: the agent is a registration.
232
257
  * The request charges the agent's launch fees: a wallet that cannot cover them gets a 402, and the agent stays where it is. When any fee is due the request must set acknowledgeFees: true, or it gets a 400 with code FEE_ACKNOWLEDGEMENT_REQUIRED and nothing is held; a launch with nothing due needs no acknowledgement. The agent's launchFees quotes what the next request charges.
233
258
  * When the agent's brand vertical is healthcare or insurance, the launch needs the protected health information (PHI) disclosure acknowledged: send acknowledgePhi: true, or the request gets a 400 REGISTRATION_INCOMPLETE whose errors name consent.phiAcknowledgement. The API records the acknowledgement as consent.phiAcknowledgement { acknowledgedAt, acknowledgedBy } from the caller; the client sends only the boolean, and an agent update cannot set it. Once recorded, a later launch request needs no new acknowledgement.
234
259
  * @async
@@ -246,6 +271,23 @@ export class RcsAgents {
246
271
  acknowledgePhi?: boolean;
247
272
  options?: RequestOptions;
248
273
  }): Promise<SdkResponse<any>>;
274
+ /**
275
+ * Send Signal House the corrected launch answers after a carrier rejected a launch other carriers took. The carrier
276
+ * partner takes no change through its API once a carrier launched, so Signal House emails it the update; edit
277
+ * `consent` and `contact` first. The agent's carrierUpdate reads REQUESTED for the rejected carriers, then SENT once
278
+ * Signal House sent it. 409 when no carrier is REJECTED after a partial launch, or an update already waits.
279
+ * Sends POST /registration/:agentId/carrier-update: the agent is a registration.
280
+ * @async
281
+ * @roles api, admin, developer, billing, user
282
+ * @param {Object} params - The request
283
+ * @param {string} params.agentId - The agent ID
284
+ * @param {RequestOptions} [params.options] - Additional options for the request
285
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent's registration, with data.carrierUpdate
286
+ */
287
+ requestCarrierUpdate({ agentId, options }: {
288
+ agentId: string;
289
+ options?: RequestOptions;
290
+ }): Promise<SdkResponse<any>>;
249
291
  /**
250
292
  * Archive an agent. One the carrier partner created stops sending at once and stays ARCHIVE_PENDING until Signal House confirms the partner cancelled it, then ARCHIVED. Archiving cannot be undone; an agent already ARCHIVE_PENDING answers 409.
251
293
  * @async
@@ -259,6 +301,24 @@ export class RcsAgents {
259
301
  agentId: string;
260
302
  options?: RequestOptions;
261
303
  }): Promise<SdkResponse<any>>;
304
+ /**
305
+ * Make the links that start a chat with the agent: an sms: deep link in Google's format, and a short link that redirects to it,
306
+ * to print as a QR code. With the agent's defaultFallback.from, the deep link names that number, so a handset that cannot reach
307
+ * the agent texts it instead. The same request returns the same short link. The links work for approved testers until a carrier
308
+ * launches the agent; before Google has created the agent the request answers 409 with code GOOGLE_AGENT_PENDING.
309
+ * @async
310
+ * @roles api, admin, developer, billing, user
311
+ * @param {Object} params - The request
312
+ * @param {string} params.agentId - The agent ID
313
+ * @param {string} [params.body] - The message the chat opens with, prefilled on the handset (max 1,000 characters)
314
+ * @param {RequestOptions} [params.options] - Additional options for the request
315
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { googleAgentId, deepLink, shortLink }
316
+ */
317
+ createEntryPoints({ agentId, body, options }: {
318
+ agentId: string;
319
+ body?: string;
320
+ options?: RequestOptions;
321
+ }): Promise<SdkResponse<any>>;
262
322
  /**
263
323
  * Resend a tester's expired invitation, which starts a new 24 hours for the tester to accept it. The number must be
264
324
  * a tester on the agent (404) and its invitation must be EXPIRED (409); up to 20 invitations go out a day (429).
@@ -364,6 +424,50 @@ export class RcsMessages {
364
424
  simulate?: ("not_capable" | "ttl_expired" | "delivered" | "read");
365
425
  options?: RequestOptions;
366
426
  }): Promise<SdkResponse<any>>;
427
+ /**
428
+ * Send an RCS message to up to 10,000 recipients in the background. The request runs the send's request checks, splits the
429
+ * recipients into chunks of 100, queues each chunk and answers 202. Every message carries the shared bulkId; track progress with
430
+ * the messages list filtered by bulkId (GET /message?bulkId=) and per-message webhooks. A chunk the wallet cannot cover, or that is
431
+ * refused after acceptance, gets BLOCKED messages with blockReason INSUFFICIENT_FUNDS or SEND_REFUSED; a chunk that keeps failing
432
+ * gets SEND_FAILED. Pass options.idempotencyKey to make a retry safe (same bulkId, no duplicate sends); a retry without one may
433
+ * send duplicates.
434
+ * @async
435
+ * @roles api, admin, developer, billing, user
436
+ * @param {Object} params - The send; the same fields as send
437
+ * @param {string} params.agentId - The agent that sends (RCSA…)
438
+ * @param {RcsRecipient[]} params.recipients - Up to 10,000 recipients
439
+ * @param {string} [params.templateId] - A template to send; exactly one of templateId or content
440
+ * @param {number} [params.templateVersion] - A published version of templateId; needs templateId. Pinned when the batch is accepted
441
+ * @param {Object} [params.content] - Inline content; exactly one of templateId or content
442
+ * @param {string} [params.contentFormat] - content.v1 (default) or google.rcs
443
+ * @param {("AUTHENTICATION"|"TRANSACTION"|"SERVICEREQUEST"|"ACKNOWLEDGEMENT"|"PROMOTION")} [params.trafficType] - Required on a MULTI_USE agent when the template sets none
444
+ * @param {number} [params.ttlSeconds] - Seconds each RCS message may wait for delivery, from when its chunk is sent; at most one of ttlSeconds or expireTime
445
+ * @param {string} [params.expireTime] - ISO-8601 time the RCS messages expire
446
+ * @param {RcsMessageFallback} [params.fallback] - The fallback for this send
447
+ * @param {string} [params.statusCallbackUrl] - URL that receives each message's events
448
+ * @param {boolean} [params.enableShortlink] - Shorten the links in the message
449
+ * @param {boolean} [params.isTest] - Send as a test; approved testers only
450
+ * @param {("not_capable"|"ttl_expired"|"delivered"|"read")} [params.simulate] - Simulate this outcome; approved testers only
451
+ * @param {RequestOptions} [params.options] - Additional options for the request
452
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { bulkId, status: "ACCEPTED", recipientCount } (202). Every message of the batch carries bulkId. A recipient from 19999990000 to 19999990359 makes the whole request a simulation, as on send
453
+ */
454
+ sendBatch({ agentId, recipients, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, statusCallbackUrl, enableShortlink, isTest, simulate, options }: {
455
+ agentId: string;
456
+ recipients: RcsRecipient[];
457
+ templateId?: string;
458
+ templateVersion?: number;
459
+ content?: any;
460
+ contentFormat?: string;
461
+ trafficType?: ("AUTHENTICATION" | "TRANSACTION" | "SERVICEREQUEST" | "ACKNOWLEDGEMENT" | "PROMOTION");
462
+ ttlSeconds?: number;
463
+ expireTime?: string;
464
+ fallback?: RcsMessageFallback;
465
+ statusCallbackUrl?: string;
466
+ enableShortlink?: boolean;
467
+ isTest?: boolean;
468
+ simulate?: ("not_capable" | "ttl_expired" | "delivered" | "read");
469
+ options?: RequestOptions;
470
+ }): Promise<SdkResponse<any>>;
367
471
  /**
368
472
  * Check a send without writing anything. Takes the same parameters as send.
369
473
  * @async
@@ -489,7 +593,7 @@ export class RcsMessages {
489
593
  * @param {Object} params - The lookup
490
594
  * @param {string} params.messageId - The message ID
491
595
  * @param {RequestOptions} [params.options] - Additional options for the request
492
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the message; an unknown ID is a 404
596
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the message; an unknown ID is a 404. A settled RCS message carries carrierFeeMicros, the carrier pass-through and media surcharge it was charged
493
597
  */
494
598
  get({ messageId, options }: {
495
599
  messageId: string;
@@ -516,7 +620,7 @@ export class RcsMessages {
516
620
  * @param {string} [params.deliveredChannel] - Filter by the channel that delivered the message (rcs, sms, mms)
517
621
  * @param {boolean} [params.isTest] - true for test messages only, false to leave them out
518
622
  * @param {RequestOptions} [params.options] - Additional options for the request
519
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of messages
623
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of messages; a settled RCS message carries carrierFeeMicros
520
624
  */
521
625
  list({ groupId, from, to, agentId, status, page, limit, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, options }: {
522
626
  groupId: string;
@@ -671,6 +775,28 @@ export type RcsAgentContact = {
671
775
  */
672
776
  mobile?: string;
673
777
  };
778
+ /**
779
+ * Where one prefilled field's value came from. The agent's `autofill` holds one per field, keyed by its path
780
+ * (`consent.optInDetails`); the API marks a field `edited` once its value changes.
781
+ */
782
+ export type RcsAgentAutofillMarker = {
783
+ /**
784
+ * - The record the value came from
785
+ */
786
+ source: ("brand" | "campaign" | "landing");
787
+ /**
788
+ * - That record's id (brand ID, campaign ID or landing page ID)
789
+ */
790
+ sourceId?: string | null;
791
+ /**
792
+ * - When the field was filled (ISO 8601; default now)
793
+ */
794
+ at?: string;
795
+ /**
796
+ * - Whether the value changed since (default false)
797
+ */
798
+ edited?: boolean;
799
+ };
674
800
  /**
675
801
  * One recipient of an RCS send.
676
802
  */
@@ -129,6 +129,47 @@ export class Registrations {
129
129
  registrationId: string;
130
130
  options?: RequestOptions;
131
131
  }) => Promise<SdkResponse<any>>;
132
+ /**
133
+ * Mark an RCS agent's requested carrier update as sent, once staff emailed it to the carrier partner (signalhouse only)
134
+ * @async
135
+ * @roles signalhouse
136
+ * @param {Object} params - The parameters for the update
137
+ * @param {string} params.registrationId - The agent's registration ID (e.g. RCSA7K2M1QZ8RP)
138
+ * @param {RequestOptions} [params.options] - Additional options for the request
139
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, as staff read it; 409 when no update is REQUESTED
140
+ */
141
+ markCarrierUpdateSent: ({ registrationId, options }: {
142
+ registrationId: string;
143
+ options?: RequestOptions;
144
+ }) => Promise<SdkResponse<any>>;
145
+ /**
146
+ * Add an internal comment to a registration of any type; comments are append-only and never reach the customer (signalhouse only)
147
+ * @async
148
+ * @roles signalhouse
149
+ * @param {Object} params - The parameters for the comment
150
+ * @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
151
+ * @param {string} params.comment - The comment, 1 to 2,000 characters
152
+ * @param {RequestOptions} [params.options] - Additional options for the request
153
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { comment, createdAt, createdBy, createdByRole }
154
+ */
155
+ addComment: ({ registrationId, comment, options }: {
156
+ registrationId: string;
157
+ comment: string;
158
+ options?: RequestOptions;
159
+ }) => Promise<SdkResponse<any>>;
160
+ /**
161
+ * List a registration's internal comments, newest first (signalhouse only)
162
+ * @async
163
+ * @roles signalhouse
164
+ * @param {Object} params - The parameters for the read
165
+ * @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
166
+ * @param {RequestOptions} [params.options] - Additional options for the request
167
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { comments: [{ comment, createdAt, createdBy, createdByRole }] }
168
+ */
169
+ getComments: ({ registrationId, options }: {
170
+ registrationId: string;
171
+ options?: RequestOptions;
172
+ }) => Promise<SdkResponse<any>>;
132
173
  };
133
174
  /**
134
175
  * Get the registration types a region offers and whether each can be acquired right now
@@ -251,7 +292,8 @@ export class Registrations {
251
292
  * Submit a draft. A type Signal House reviews goes to SIGNAL_HOUSE_REVIEW; a type it does not (RCS_AGENT) goes to
252
293
  * SUBMITTING and is filed with the provider at once. A draft that fails a requirement gets a 400 whose details carry
253
294
  * { code: "REGISTRATION_INCOMPLETE", errors, warnings }; a second submit, or one of a registration the provider
254
- * already holds, gets a 409.
295
+ * already holds, gets a 409. An RCS agent whose group has not finished account verification gets a 403 with code
296
+ * GROUP_UNVERIFIED, and one whose group is rejected a 403 with code GROUP_REJECTED.
255
297
  * @async
256
298
  * @roles api, admin, developer, billing, user
257
299
  * @param {Object} params - The parameters for the submission
@@ -268,7 +310,9 @@ export class Registrations {
268
310
  * are checked and the registration goes to SIGNAL_HOUSE_REVIEW, whose approval files the provider's launch request.
269
311
  * Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
270
312
  * carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
271
- * { code: "REGISTRATION_INCOMPLETE", errors, warnings }.
313
+ * { code: "REGISTRATION_INCOMPLETE", errors, warnings }; an RCS agent's copy-rule error carries the carrier partner's key
314
+ * as its `code` (for example OPT_IN_MSG_RATE_DISCL_MISSING). An RCS agent whose group has not finished account
315
+ * verification gets a 403 with code GROUP_UNVERIFIED, and one whose group is rejected a 403 with code GROUP_REJECTED.
272
316
  * An RCS agent's launch request charges its launch fees: a wallet that cannot cover them gets a 402, and nothing changes. When any fee is due the request must set acknowledgeFees: true, or it gets a 400 with code FEE_ACKNOWLEDGEMENT_REQUIRED and nothing is held; a launch with nothing due needs no acknowledgement.
273
317
  * When the agent's brand vertical is healthcare or insurance, the launch needs the protected health information (PHI) disclosure acknowledged: send acknowledgePhi: true, or the request gets a 400 REGISTRATION_INCOMPLETE whose errors name consent.phiAcknowledgement. The API records the acknowledgement as consent.phiAcknowledgement { acknowledgedAt, acknowledgedBy } from the caller; the client sends only the boolean, and an agent update cannot set it. Once recorded, a later launch request needs no new acknowledgement.
274
318
  * @async
@@ -0,0 +1,71 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+ /**
7
+ * Carrier phone-number checks under /verify: SIM Swap and Number Verify. Every check the carrier answers is billed to
8
+ * the group's wallet (402 on insufficient funds); a check the carrier cannot run for the number is a 422 and is not charged.
9
+ */
10
+ export class Verify {
11
+ /**
12
+ * Keep the JSON client every verify request goes through.
13
+ * @param {any} client - The JSON request client
14
+ * @param {boolean} [enableAdmin] - Whether admin-scoped behaviors are enabled
15
+ */
16
+ constructor(client: any, enableAdmin?: boolean);
17
+ client: any;
18
+ enableAdmin: boolean;
19
+ /**
20
+ * Check whether a number's SIM card changed recently, as reported by its carrier. Billed once when the check answers;
21
+ * 422 when the check is not available for the number (not charged)
22
+ * @async
23
+ * @roles api, admin, developer
24
+ * @param {Object} params - The check
25
+ * @param {string} params.phoneNumber - The number to check, in international format (e.g. "+12025550123")
26
+ * @param {number} [params.maxAge] - Lookback window in hours, 1-2400; the carrier's default when omitted
27
+ * @param {boolean} [params.includeSwapDate] - Also return the latest SIM change date (no extra charge; default false)
28
+ * @param {RequestOptions} [params.options] - Additional options for the request
29
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, swapped, maxAge, latestSimChange?, cost }`
30
+ */
31
+ checkSimSwap({ phoneNumber, maxAge, includeSwapDate, options }: {
32
+ phoneNumber: string;
33
+ maxAge?: number;
34
+ includeSwapDate?: boolean;
35
+ options?: RequestOptions;
36
+ }): Promise<SdkResponse<any>>;
37
+ /**
38
+ * Start a Number Verify check. The end user's phone must open the returned `authorizationUrl` on mobile data (Wi-Fi off)
39
+ * within 10 minutes; the carrier then confirms whether the phone's own number matches. Read the result with
40
+ * getNumberVerification. Billed only when the check is answered (VERIFIED or NOT_VERIFIED)
41
+ * @async
42
+ * @roles api, admin, developer
43
+ * @param {Object} params - The check
44
+ * @param {string} params.phoneNumber - The number to verify, in international format (e.g. "+12025550123")
45
+ * @param {string} [params.devicePhoneNumber] - The phone's own number, sent to the carrier as a login hint
46
+ * @param {string} [params.redirectUrl] - An https URL the end user's browser is sent to after the check, with `?checkId=…`
47
+ * @param {RequestOptions} [params.options] - Additional options for the request
48
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status: "PENDING", authorizationUrl, expiresAt }`
49
+ */
50
+ startNumberVerification({ phoneNumber, devicePhoneNumber, redirectUrl, options }: {
51
+ phoneNumber: string;
52
+ devicePhoneNumber?: string;
53
+ redirectUrl?: string;
54
+ options?: RequestOptions;
55
+ }): Promise<SdkResponse<any>>;
56
+ /**
57
+ * Get a Number Verify check's status and result. A PENDING check past its expiresAt reads as EXPIRED
58
+ * @async
59
+ * @roles api, admin, developer, billing, user
60
+ * @param {Object} params - The lookup
61
+ * @param {string} params.checkId - The check ID (e.g. NVC…)
62
+ * @param {RequestOptions} [params.options] - Additional options for the request
63
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status, devicePhoneNumberVerified, failureReason, createdAt, expiresAt, completedAt, cost }`
64
+ */
65
+ getNumberVerification({ checkId, options }: {
66
+ checkId: string;
67
+ options?: RequestOptions;
68
+ }): Promise<SdkResponse<any>>;
69
+ }
70
+ export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
71
+ export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;