@signalhouse-sms/sdk 1.11.0 → 1.12.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.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -70,11 +70,14 @@ export class Billing {
70
70
  * @param {string} [params.transactionType] - The type of transaction to filter by
71
71
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
72
72
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
73
+ * @param {string} [params.category] - One category, or a comma-separated list: one of the RCS categories RCS_RICH_OUTBOUND, RCS_RICH_MEDIA_OUTBOUND, RCS_INBOUND, RCS_ACTION_CLICK, RCS_MEDIA_SURCHARGE, RCS_FEE_ONBOARDING, RCS_FEE_RENEWAL, RCS_SESSION_ADJUSTMENT or RCS_SESSION_CARRIER_ADJUSTMENT, or RCS_CARRIER_PASSTHROUGH for RCS carrier rows alone. Any other value is rejected with a 400.
74
+ * @param {number} [params.page] - Page number (positive integer)
75
+ * @param {number} [params.limit] - Page size, at most 1000
73
76
  * @param {RequestOptions} [params.options] - Additional options for the request
74
77
  * @returns {Promise<SdkResponse<Array>>} The response from the server
75
78
  */
76
- async getTransactionHistory({ groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate, options = {} }) {
77
- const filters = { groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate };
79
+ async getTransactionHistory({ groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate, category, page, limit, options = {} }) {
80
+ const filters = { groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate, category, page, limit };
78
81
  const queryString = this.client._getQueryString(filters);
79
82
  return this.client(`/billing/wallet/transactionHistory${queryString}`, { method: "GET", ...options });
80
83
  }
@@ -225,7 +225,7 @@ export class Brands {
225
225
  * @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
226
226
  * @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
227
227
  * @param {RequestOptions} [params.options] - Additional options for the request
228
- * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, reviewsBusinessOnSubmit?: boolean, businessStructure?: string|null, industry?: string|null, contactEmail?: string|null, contactJobTitle?: string|null, contactJobLevel?: string|null, rejectionReason?: string|null, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.reviewsBusinessOnSubmit` (whether it's reviewed when it's submitted and keeps its business details from then on). A brand reviewed on submit also carries its `tollFree.businessStructure`, `tollFree.industry`, `tollFree.contactEmail`, `tollFree.contactJobTitle` and `tollFree.contactJobLevel`, and `tollFree.rejectionReason` (why its review rejected it, in plain English, or null). On other toll-free brands these are null or absent. The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit. Each brand carries `carrierSuspensions` (carrier brand suspension rules; active while liftedAt is null).
228
+ * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, reviewsBusinessOnSubmit?: boolean, businessStructure?: string|null, industry?: string|null, contactEmail?: string|null, contactJobTitle?: string|null, contactJobLevel?: string|null, rejectionReason?: string|null, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.reviewsBusinessOnSubmit` (whether it's reviewed when it's submitted and keeps its business details from then on). A brand reviewed on submit also carries its `tollFree.businessStructure`, `tollFree.industry`, `tollFree.contactEmail`, `tollFree.contactJobTitle` and `tollFree.contactJobLevel`, and `tollFree.rejectionReason` (why its review rejected it, in plain English, or null). On other toll-free brands these are null or absent. The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit. Each brand carries `carrierSuspensions` (carrier brand suspension rules; active while liftedAt is null). Each brand also carries `cnamName` (its caller name for numbers, or null; see getCallerName).
229
229
  */
230
230
  async getBrands({
231
231
  id,
@@ -541,4 +541,59 @@ export class Brands {
541
541
  formData.append('file', file);
542
542
  return this.multipartClient(`/brand/appeal/${safeBrandId}`, { method: 'POST', body: formData, ...options });
543
543
  }
544
+
545
+ /**
546
+ * Get a brand's caller name (CNAM) and the numbers it applies to: every number whose caller name comes from this
547
+ * brand (its campaign numbers, numbers it was picked on, and campaign-less numbers of subgroups that use it as
548
+ * their default caller-ID brand)
549
+ * @async
550
+ * @roles api, admin, developer, billing, user
551
+ * @param {Object} params - The parameters for the request
552
+ * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
553
+ * @param {RequestOptions} [params.options] - Additional options for the request
554
+ * @throws {Error} Throws an error if the brandId parameter is missing
555
+ * @returns {Promise<SdkResponse<{ brandId: string, companyName: string, cnamName: string|null, eligible: boolean, numbers: { total: number, items: Array<{ phoneNumber: string, friendlyName: string|null, cnam: Object|null }> } }>>} The brand's caller name (null when it has none) and its numbers; `items` lists the first 100
556
+ */
557
+ async getCallerName({ brandId, options = {} }) {
558
+ this.client._require({ brandId });
559
+ const safeBrandId = encodeURIComponent(brandId);
560
+ return this.client(`/brand/cnam/${safeBrandId}`, { method: 'GET', ...options });
561
+ }
562
+
563
+ /**
564
+ * Set a brand's caller name (CNAM). It replaces the caller name on every number whose caller name comes from this
565
+ * brand, names set on a number included, and numbers that later come under the brand get it too. The name may only
566
+ * remove characters from the brand's registered name and must be 1-15 letters, digits, spaces, `-` or `_`; the brand
567
+ * must be verified. Numbers are updated at the carrier in the background (their `cnam.status` is PENDING until then).
568
+ * @async
569
+ * @roles api, admin, developer
570
+ * @param {Object} params - The parameters for the request
571
+ * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
572
+ * @param {string} params.name - The caller name to show
573
+ * @param {RequestOptions} [params.options] - Additional options for the request
574
+ * @throws {Error} Throws an error if the brandId or name parameter is missing
575
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ brandId, companyName, cnamName, eligible, numbers: { total, items } }`
576
+ */
577
+ async setCallerName({ brandId, name, options = {} }) {
578
+ this.client._require({ brandId, name });
579
+ const safeBrandId = encodeURIComponent(brandId);
580
+ return this.client(`/brand/cnam/${safeBrandId}`, { method: 'PUT', body: { name }, ...options });
581
+ }
582
+
583
+ /**
584
+ * Remove a brand's caller name (CNAM). Numbers that had it go back to the automatic name if their subgroup has
585
+ * caller name auto-apply on, otherwise to no caller name. Names set on a number are kept.
586
+ * @async
587
+ * @roles api, admin, developer
588
+ * @param {Object} params - The parameters for the request
589
+ * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
590
+ * @param {RequestOptions} [params.options] - Additional options for the request
591
+ * @throws {Error} Throws an error if the brandId parameter is missing
592
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ brandId, companyName, cnamName, eligible, numbers: { total, items } }`
593
+ */
594
+ async deleteCallerName({ brandId, options = {} }) {
595
+ this.client._require({ brandId });
596
+ const safeBrandId = encodeURIComponent(brandId);
597
+ return this.client(`/brand/cnam/${safeBrandId}`, { method: 'DELETE', ...options });
598
+ }
544
599
  }
@@ -425,7 +425,7 @@ export class Campaigns {
425
425
  * @param {string} params.campaignId - Campaign identifier
426
426
  * @param {RequestOptions} [params.options] - Additional request options
427
427
  * @throws {Error} Throws an error if the campaignId parameter is missing
428
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ campaignId, brandId, usecase, brand: { status, brandScore, entityType }, att: { tier, scope, unit, sms: { limit }, mms: { limit }, marginPercent, nextTier }, tmobile: { tier, scope, unit, dailyLimit, thresholds, nextTier, usedToday: { date, segments, resetsAt } | null } }`. A null tier/limit means the carrier ladder does not apply (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase); a null nextTier means the top rung or a usecase-capped (LOW_VOLUME) campaign.
428
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ campaignId, brandId, usecase, brand: { status, brandScore, entityType }, att: { tier, scope, unit, sms: { limit }, mms: { limit }, marginPercent, nextTier }, tmobile: { tier, scope, unit, dailyLimit, thresholds, nextTier, usedToday: { date, segments, resetsAt } | null, sharedWith: [{ brandId, brandName }] } }`. A null tier/limit means the carrier ladder does not apply (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase); a null nextTier means the top rung or a usecase-capped (LOW_VOLUME) campaign. T-Mobile's counter is keyed per brand EIN, not per brand: sharedWith lists other verified brands in the same group that share this EIN and also carry a T-Mobile limit, since usedToday is their combined total.
429
429
  */
430
430
  async getCampaignThroughputLimits({ campaignId, options = {} }) {
431
431
  this.client._require({ campaignId });
@@ -441,7 +441,7 @@ export class Campaigns {
441
441
  * @param {string} params.groupId - Group identifier
442
442
  * @param {RequestOptions} [params.options] - Additional request options
443
443
  * @throws {Error} Throws an error if the groupId parameter is missing
444
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt } } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score.
444
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt }, sharedWith: [{ brandId, brandName }] } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score. sharedWith lists this brand's other group brands on the same EIN that also carry a T-Mobile limit, since usedToday is their combined total.
445
445
  */
446
446
  async getGroupThroughputUsage({ groupId, options = {} }) {
447
447
  this.client._require({ groupId });
@@ -20,6 +20,20 @@ export class Messages {
20
20
  this.client = client;
21
21
  this.multipartClient = multipartClient;
22
22
  this.enableAdmin = enableAdmin;
23
+
24
+ if (enableAdmin) {
25
+ this.admin = {
26
+ /**
27
+ * Read RCS webhook health: how late provider reports reach Signal House, and which tenants' webhooks are failing (signalhouse only)
28
+ * @async
29
+ * @roles signalhouse
30
+ * @param {Object} [params] - The parameters for the read
31
+ * @param {RequestOptions} [params.options] - Additional options for the request
32
+ * @returns {Promise<SdkResponse<{ windowMinutes: number, lag: { reports: number, p50Seconds: number|null, p95Seconds: number|null, maxSeconds: number|null }, tenantFailures: Array<{ groupId: string, failures: number, alerted: boolean }> }>>} A promise that resolves to the view
33
+ */
34
+ getRcsWebhookHealth: async ({ options = {} } = {}) => this.client("/message/rcs/webhook-health", { method: "GET", ...options }),
35
+ };
36
+ }
23
37
  }
24
38
 
25
39
  /**
@@ -128,13 +142,28 @@ export class Messages {
128
142
  * @param {string} params.id - The message ID
129
143
  * @param {RequestOptions} [params.options] - Additional options for the request
130
144
  * @throws {Error} Throws an error if the id parameter is missing
131
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404
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
132
146
  */
133
147
  async getMessage({ id, options = {} }) {
134
148
  this.client._require({ id });
135
149
  return this.client(`/message/${encodeURIComponent(id)}`, { method: "GET", ...options });
136
150
  }
137
151
 
152
+ /**
153
+ * Get the taps on one RCS message, oldest first
154
+ * @async
155
+ * @roles api, admin, developer, billing, user
156
+ * @param {Object} params - The parameters for getting the taps
157
+ * @param {string} params.id - The message ID
158
+ * @param {RequestOptions} [params.options] - Additional options for the request
159
+ * @throws {Error} Throws an error if the id parameter is missing
160
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to `{ results: [{ actionType, buttonId, label, postbackData, occurredAt, ratedCostMicros }] }`; an unknown ID is a 404
161
+ */
162
+ async getMessageInteractions({ id, options = {} }) {
163
+ this.client._require({ id });
164
+ return this.client(`/message/${encodeURIComponent(id)}/interactions`, { method: "GET", ...options });
165
+ }
166
+
138
167
  /**
139
168
  * Fetch the latest upstream carrier delivery report for a set of messages by ID.
140
169
  * Useful for reconciling messages stuck in a non-terminal state. Outbound SMS and MMS messages sent from numbers on
@@ -317,7 +317,8 @@ export class Numbers {
317
317
  * @param {string} params.phoneNumber - The phone number (E.164, leading + optional)
318
318
  * @param {RequestOptions} [params.options] - Additional options for the request
319
319
  * @throws {Error} Throws an error if the phoneNumber parameter is missing
320
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ phoneNumber, cnam, autoApply, eligible, ineligibleReason }`
320
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ phoneNumber, cnam, autoApply, eligible, ineligibleReason }`;
321
+ * `cnam.source` is MANUAL (set on the number), BRAND (the brand's caller name) or AUTO (subgroup auto-apply)
321
322
  */
322
323
  async getCallerName({ phoneNumber, options = {} }) {
323
324
  this.client._require({ phoneNumber });
@@ -347,8 +348,8 @@ export class Numbers {
347
348
  }
348
349
 
349
350
  /**
350
- * Remove a phone number's own caller name (CNAM). If its subgroup has caller name auto-apply on, the
351
- * number goes back to the automatic name.
351
+ * Remove a phone number's own caller name (CNAM). The number goes back to its brand's caller name if the brand
352
+ * has one (see brands.setCallerName), else to the automatic name if its subgroup has caller name auto-apply on.
352
353
  * @async
353
354
  * @roles api, admin, developer
354
355
  * @param {Object} params - The parameters for the request
@@ -107,7 +107,7 @@ export class RcsAgents {
107
107
  * @param {RcsAgentConsent} [params.consent] - The launch text; required in full before the launch request
108
108
  * @param {RcsAgentContact} [params.contact] - The launch contact; required in full before the launch request
109
109
  * @param {("OTP"|"TRANSACTIONAL"|"PROMOTIONAL"|"MULTI_USE")} [params.useCase] - The agent's use case; required before submit
110
- * @param {("NON_CONVERSATIONAL"|"CONVERSATIONAL")} [params.billingCategory] - Default NON_CONVERSATIONAL; submit refuses CONVERSATIONAL
110
+ * @param {("NON_CONVERSATIONAL"|"CONVERSATIONAL")} [params.billingCategory] - Default NON_CONVERSATIONAL (per message); CONVERSATIONAL is billed per interactive session
111
111
  * @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
112
  * @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
113
113
  * @param {string[]} [params.testers] - Tester numbers (up to 200), invited once the agent exists at the carrier
@@ -130,7 +130,7 @@ export class RcsAgents {
130
130
  * @param {Object} [params] - Filters
131
131
  * @param {string} [params.groupId] - Filter by group ID
132
132
  * @param {string} [params.subgroupId] - Filter by subgroup ID
133
- * @param {string|string[]} [params.status] - DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING or ARCHIVED, one or a list
133
+ * @param {string|string[]} [params.status] - DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING, ARCHIVE_PENDING or ARCHIVED, one or a list
134
134
  * @param {string} [params.brandId] - Agents linked to this brand (carrier brand ID, provisional UUID or _id)
135
135
  * @param {string} [params.campaignId] - Agents linked to this campaign (campaign ID or _id)
136
136
  * @param {number} [params.page] - Page number (default 1)
@@ -190,7 +190,7 @@ export class RcsAgents {
190
190
 
191
191
  /**
192
192
  * Check an agent against the next gate on its path without writing: before it exists at the carrier partner, what
193
- * creating it needs (the full profile, useCase, NON_CONVERSATIONAL billing); after that, what the launch request needs
193
+ * creating it needs (the full profile, useCase, a billingCategory); after that, what the launch request needs
194
194
  * (a VERIFIED brand, the campaign, the full consent with the video, the contact)
195
195
  * @async
196
196
  * @roles api, admin, developer, billing, user
@@ -206,7 +206,7 @@ export class RcsAgents {
206
206
 
207
207
  /**
208
208
  * Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a
209
- * useCase and NON_CONVERSATIONAL billing; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
209
+ * useCase and a billingCategory; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
210
210
  * errors, warnings }. The agent moves to AGENT_CREATING, then IN_TESTING once the partner reports it ready.
211
211
  * @async
212
212
  * @roles api, admin, developer, billing, user
@@ -225,27 +225,30 @@ export class RcsAgents {
225
225
  * PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
226
226
  * CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
227
227
  * "REGISTRATION_INCOMPLETE", errors, warnings }. Sends POST /registration/:agentId/launch: the agent is a registration.
228
- * The request charges the agent's launch fees: a wallet that cannot cover them gets a 402, and the agent stays where it is. The agent's launchFees quotes what the next request charges.
228
+ * 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
+ * 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.
229
230
  * @async
230
231
  * @roles api, admin, developer, billing, user
231
232
  * @param {Object} params - The launch request
232
233
  * @param {string} params.agentId - The agent ID
234
+ * @param {boolean} [params.acknowledgeFees] - Accept the fees due; required when any are
235
+ * @param {boolean} [params.acknowledgePhi] - Accept the PHI disclosure; required for a healthcare or insurance brand
233
236
  * @param {RequestOptions} [params.options] - Additional options for the request
234
237
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status PENDING_REVIEW)
235
238
  */
236
- async launch({ agentId, options = {} }) {
239
+ async launch({ agentId, acknowledgeFees, acknowledgePhi, options = {} }) {
237
240
  this.client._require({ agentId });
238
- return this.client(`/registration/${encodeURIComponent(agentId)}/launch`, { method: "POST", ...options });
241
+ return this.client(`/registration/${encodeURIComponent(agentId)}/launch`, { method: "POST", body: { acknowledgeFees, acknowledgePhi }, ...options });
239
242
  }
240
243
 
241
244
  /**
242
- * Archive an agent
245
+ * 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.
243
246
  * @async
244
247
  * @roles api, admin, developer, user
245
248
  * @param {Object} params - The archive request
246
249
  * @param {string} params.agentId - The agent ID
247
250
  * @param {RequestOptions} [params.options] - Additional options for the request
248
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status ARCHIVED)
251
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status ARCHIVE_PENDING or ARCHIVED)
249
252
  */
250
253
  async archive({ agentId, options = {} }) {
251
254
  this.client._require({ agentId });
@@ -268,6 +271,22 @@ export class RcsAgents {
268
271
  return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/testers/${encodeURIComponent(phoneNumber)}/resend`, { method: "POST", ...options });
269
272
  }
270
273
 
274
+ /**
275
+ * Remove a tester at once, at any point before the agent is archived. The number must be a tester on the agent (404);
276
+ * an archived agent answers 409.
277
+ * @async
278
+ * @roles api, admin, developer, billing, user
279
+ * @param {Object} params - The removal
280
+ * @param {string} params.agentId - The agent ID
281
+ * @param {string} params.phoneNumber - The tester's US number, with or without the +
282
+ * @param {RequestOptions} [params.options] - Additional options for the request
283
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
284
+ */
285
+ async removeTester({ agentId, phoneNumber, options = {} }) {
286
+ this.client._require({ agentId, phoneNumber });
287
+ return this.client(`/rcs/agent/${encodeURIComponent(agentId)}/testers/${encodeURIComponent(phoneNumber)}`, { method: "DELETE", ...options });
288
+ }
289
+
271
290
  /**
272
291
  * Host the agent's logo (224 × 224 px, 50 KB max) or hero image (1440 × 448 px, 200 KB max), PNG or JPEG, and set
273
292
  * it on the draft. Images of any other size are refused.
@@ -326,7 +345,7 @@ export class RcsMessages {
326
345
  * @param {boolean} [params.isTest] - Send as a test; approved testers only
327
346
  * @param {("not_capable"|"ttl_expired"|"delivered"|"read")} [params.simulate] - Simulate this outcome; approved testers only
328
347
  * @param {RequestOptions} [params.options] - Additional options for the request
329
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to { requested, enqueued, failed, bulkId, messages } (201). A blocked row carries blockReason, reason and issues; an archived template answers 409 TEMPLATE_ARCHIVED
348
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { requested, enqueued, failed, bulkId, messages } (201). A blocked row carries blockReason, reason and issues; an archived template answers 409 TEMPLATE_ARCHIVED. A recipient from 19999990000 to 19999990359 makes the whole request a simulation, as on SMS: it resolves to { simulated: true, webhooks } and nothing is stored, sent or charged
330
349
  */
331
350
  async send({ agentId, recipients, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, statusCallbackUrl, enableShortlink, isTest, simulate, options = {} }) {
332
351
  this.client._require({ agentId, recipients });
@@ -385,7 +404,7 @@ export class RcsMessages {
385
404
  * @param {string} [params.expireTime] - ISO-8601 time the RCS message expires
386
405
  * @param {RcsMessageFallback} [params.fallback] - The fallback to price; its from is optional here, and with none the leg is priced on the channel of the agent's linked campaign
387
406
  * @param {RequestOptions} [params.options] - Additional options for the request
388
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB, already inside rcsLeg.cost; a message over 100 MB adds a MEDIA_TOO_LARGE issue.
407
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB for one recipient, and rcsLeg.cost already holds it for every recipient; rcsLeg.cost is null with the fallback mode sms_only; a message over 100 MB adds a MEDIA_TOO_LARGE issue.
389
408
  */
390
409
  async estimate({ agentId, recipients, recipientCount, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, options = {} }) {
391
410
  this.client._require({ agentId });
@@ -404,13 +423,36 @@ export class RcsMessages {
404
423
  * @param {string} params.agentId - The agent (RCSA…)
405
424
  * @param {string[]} params.phoneNumbers - Up to 500 numbers, 10-15 digits, with or without the +
406
425
  * @param {RequestOptions} [params.options] - Additional options for the request
407
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to { results: [{ phoneNumber, capability }] }, capability being ENABLED, UNREACHABLE or UNKNOWN
426
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { results: [{ phoneNumber, capability, rcsEnabled, reason, features, carrier, checkedAt, cached }] }, capability being ENABLED, UNREACHABLE or UNKNOWN, and reason CAPABLE, NOT_CAPABLE, NOT_LAUNCHED_ON_CARRIER or UNKNOWN; rcsEnabled is true only for CAPABLE, carrier and checkedAt may be null, and features is empty today
408
427
  */
409
428
  async capabilities({ agentId, phoneNumbers, options = {} }) {
410
429
  this.client._require({ agentId, phoneNumbers });
411
430
  return this.client("/rcs/capabilities", { method: "POST", body: { agentId, phoneNumbers }, ...options });
412
431
  }
413
432
 
433
+ /**
434
+ * Fake an inbound event from an approved tester of the agent, with no carrier involved: it runs the real inbound handlers and webhooks, as free test traffic. A simulated STOP really opts the tester out; a simulated START clears it. Anyone else gets a 403 with code NOT_TESTER. Returns 202 with { status, messageId }.
435
+ * @async
436
+ * @roles api, admin, developer, billing, user
437
+ * @param {Object} params - The event
438
+ * @param {string} params.agentId - The agent (RCSA…)
439
+ * @param {string} params.from - The approved tester's number
440
+ * @param {string} params.type - TEXT, SUGGESTION, LOCATION, FILE or UNSUBSCRIBE
441
+ * @param {string} [params.text] - The text; required for TEXT
442
+ * @param {string} [params.postbackData] - The tapped suggestion's postback; SUGGESTION needs this or buttonId
443
+ * @param {string} [params.messageId] - The message a tap answers; the latest message delivered to the tester by default
444
+ * @param {string} [params.buttonId] - The suggestion's position, as webhooks report it
445
+ * @param {number} [params.latitude] - Required for LOCATION
446
+ * @param {number} [params.longitude] - Required for LOCATION
447
+ * @param {string} [params.fileName] - The file's name, for FILE
448
+ * @param {RequestOptions} [params.options] - Additional options for the request
449
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { status: "QUEUED", messageId }
450
+ */
451
+ async simulateInbound({ agentId, from, type, text, postbackData, messageId, buttonId, latitude, longitude, fileName, options = {} }) {
452
+ this.client._require({ agentId, from, type });
453
+ return this.client("/message/rcs/simulate-inbound", { method: "POST", body: { agentId, from, type, text, postbackData, messageId, buttonId, latitude, longitude, fileName }, ...options });
454
+ }
455
+
414
456
  /**
415
457
  * Get one message by its ID. The same route as messages.getMessage.
416
458
  * @async
@@ -450,7 +492,7 @@ export class RcsMessages {
450
492
  */
451
493
  async list({ groupId, from, to, agentId, status, page, limit, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, options = {} }) {
452
494
  this.client._require({ groupId, from, to });
453
- const queryString = this.client._getQueryString({ registrationId: agentId, startDate: from, endDate: to, groupId, status, page, limit, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, messageType: "RCS" });
495
+ const queryString = this.client._getQueryString({ registrationId: agentId, startDate: from, endDate: to, groupId, status, page, limit, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, messageType: "RCS", dateBounds: "exact" });
454
496
  return this.client(`/message${queryString}`, { method: "GET", ...options });
455
497
  }
456
498
  }
@@ -24,16 +24,18 @@ export class Registrations {
24
24
  * @param {Object} params - The parameters for the review decision
25
25
  * @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
26
26
  * @param {("APPROVE"|"REJECT")} params.action - The review decision
27
- * @param {string} [params.reason] - Why the registration was rejected; required when action is REJECT
27
+ * @param {string} [params.reason] - Why the registration was rejected; required when action is REJECT. An RCS agent takes 10 to 256 characters
28
+ * @param {string} [params.reasonCode] - The rejection catalogue code; required to reject an RCS agent, refused for any other type
29
+ * @param {Array<{ field?: string|null, code: string, reason: string, recommendedAction?: string|null }>} [params.rejectionReasons] - Field-level reasons for an RCS agent
28
30
  * @param {RequestOptions} [params.options] - Additional options for the request
29
31
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated registration
30
32
  */
31
- reviewRegistration: async ({ registrationId, action, reason, options = {} }) => {
33
+ reviewRegistration: async ({ registrationId, action, reason, reasonCode, rejectionReasons, options = {} }) => {
32
34
  this.client._require({ registrationId, action });
33
35
  const safeId = encodeURIComponent(registrationId);
34
36
  return this.client(`/registration/${safeId}/review`, {
35
37
  method: "POST",
36
- body: { action, reason },
38
+ body: { action, reason, ...(reasonCode !== undefined && { reasonCode }), ...(rejectionReasons !== undefined && { rejectionReasons }) },
37
39
  ...options,
38
40
  });
39
41
  },
@@ -118,6 +120,45 @@ export class Registrations {
118
120
  ...options,
119
121
  });
120
122
  },
123
+
124
+ /**
125
+ * Give an RCS agent an assignee in the staff review queue, or clear it (signalhouse only)
126
+ * @async
127
+ * @roles signalhouse
128
+ * @param {Object} params - The parameters for the assignment
129
+ * @param {string} params.registrationId - The agent's registration ID (e.g. RCSA7K2M1QZ8RP)
130
+ * @param {string|null} params.userId - An active Signal House staff user; null clears the assignee
131
+ * @param {RequestOptions} [params.options] - Additional options for the request
132
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, as staff read it
133
+ */
134
+ assignRegistration: async ({ registrationId, userId, options = {} }) => {
135
+ this.client._require({ registrationId });
136
+ if (userId === undefined) throw new Error("userId is required; pass null to clear the assignee");
137
+ const safeId = encodeURIComponent(registrationId);
138
+ return this.client(`/registration/${safeId}/assignee`, {
139
+ method: "PUT",
140
+ body: { userId },
141
+ ...options,
142
+ });
143
+ },
144
+
145
+ /**
146
+ * Nudge the owner of an RCS agent waiting in an SLA state, at most once per business day (signalhouse only)
147
+ * @async
148
+ * @roles signalhouse
149
+ * @param {Object} params - The parameters for the nudge
150
+ * @param {string} params.registrationId - The agent's registration ID (e.g. RCSA7K2M1QZ8RP)
151
+ * @param {RequestOptions} [params.options] - Additional options for the request
152
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, as staff read it
153
+ */
154
+ nudgeRegistration: async ({ registrationId, options = {} }) => {
155
+ this.client._require({ registrationId });
156
+ const safeId = encodeURIComponent(registrationId);
157
+ return this.client(`/registration/${safeId}/nudge`, {
158
+ method: "POST",
159
+ ...options,
160
+ });
161
+ },
121
162
  };
122
163
  }
123
164
  }
@@ -257,18 +298,21 @@ export class Registrations {
257
298
  * Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
258
299
  * carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
259
300
  * { code: "REGISTRATION_INCOMPLETE", errors, warnings }.
260
- * An RCS agent's launch request charges its launch fees: a wallet that cannot cover them gets a 402, and nothing changes.
301
+ * 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
+ * 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.
261
303
  * @async
262
304
  * @roles api, admin, developer, billing, user
263
305
  * @param {Object} params - The parameters for the launch request
264
306
  * @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
307
+ * @param {boolean} [params.acknowledgeFees] - Accept the fees due; required when any are
308
+ * @param {boolean} [params.acknowledgePhi] - Accept the PHI disclosure; required for a healthcare or insurance brand
265
309
  * @param {RequestOptions} [params.options] - Additional options for the request
266
310
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, now SIGNAL_HOUSE_REVIEW
267
311
  */
268
- async launchRegistration({ registrationId, options = {} }) {
312
+ async launchRegistration({ registrationId, acknowledgeFees, acknowledgePhi, options = {} }) {
269
313
  this.client._require({ registrationId });
270
314
  const safeId = encodeURIComponent(registrationId);
271
- return this.client(`/registration/${safeId}/launch`, { method: "POST", ...options });
315
+ return this.client(`/registration/${safeId}/launch`, { method: "POST", body: { acknowledgeFees, acknowledgePhi }, ...options });
272
316
  }
273
317
 
274
318
  /**
@@ -308,6 +308,7 @@ export class Templates {
308
308
 
309
309
  /**
310
310
  * Publish a template's current draft; no draft returns 409 NO_DRAFT, a draft changed mid-publish returns 409 DRAFT_CHANGED (publish again) and an incomplete draft returns 400 TEMPLATE_INVALID
311
+ * A block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED, whose message names the category ("Content moderation flagged this text: spam"). The check passes when the Moderation API fails.
311
312
  * @async
312
313
  * @roles api, admin, developer
313
314
  * @param {Object} params - The parameters for publishing a template
@@ -367,6 +368,7 @@ export class Templates {
367
368
 
368
369
  /**
369
370
  * Validate an unsaved body or a stored version without writing anything
371
+ * Validate runs the publish checks, the content policy check included: a block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED. Saving a draft does not run that check.
370
372
  * @async
371
373
  * @roles api, admin, developer, billing, user
372
374
  * @param {Object} params - The parameters for validation; pass exactly one of body or version
@@ -19,15 +19,16 @@ export class Webhooks {
19
19
  * @param {Object} params - The parameters for getting webhooks
20
20
  * @param {string} [params.id] - Filter by webhook ID
21
21
  * @param {string} [params.groupId] - Filter by associated group ID
22
- * @param {string} [params.endpointType] - Filter by endpoint type (Global, Number)
22
+ * @param {string} [params.endpointType] - Filter by endpoint type (Global, Number, Agent)
23
23
  * @param {string} [params.phoneNumber] - Filter by associated phone number (for SMS webhooks)
24
+ * @param {string} [params.agentId] - Filter by RCS agent (for Agent webhooks)
24
25
  * @param {number} [params.page] - The page number for pagination
25
26
  * @param {number} [params.limit] - The number of items per page for pagination
26
27
  * @param {RequestOptions} [params.options] - Additional options for the request
27
28
  * @returns {Promise<SdkResponse<Array>>} The response from the server
28
29
  */
29
- async getWebhooks({ id, groupId, endpointType, phoneNumber, page, limit, options = {} }) {
30
- const filters = { id, groupId, endpointType, phoneNumber, page, limit };
30
+ async getWebhooks({ id, groupId, endpointType, phoneNumber, agentId, page, limit, options = {} }) {
31
+ const filters = { id, groupId, endpointType, phoneNumber, agentId, page, limit };
31
32
  const queryString = this.client._getQueryString(filters);
32
33
  return this.client(`/webhook${queryString}`, { method: "GET", ...options });
33
34
  }
@@ -46,7 +47,9 @@ export class Webhooks {
46
47
  * `webhookData.eventSettings` holds per-event options keyed by event name:
47
48
  * `NUMBER_HEALTH_BELOW_THRESHOLD` and `CAMPAIGN_HEALTH_BELOW_THRESHOLD` each take `{ threshold }`, the 7-day
48
49
  * health score (1.5–10, in 0.5 steps) below which the event fires; a subscribed health event without one is
49
- * stored with the default, 6.
50
+ * stored with the default, 6. `webhookData.endpointType` is `Global`, `Number` or `Agent`. An `Agent` endpoint
51
+ * receives one RCS agent's events only: it needs `agentId`, and may set `secondaryUrl`, which gets one try when
52
+ * every attempt to `url` fails.
50
53
  * @async
51
54
  * @roles api, admin, developer
52
55
  * @param {Object} params - The parameters for creating a webhook
@@ -68,7 +71,8 @@ export class Webhooks {
68
71
  * the stored credentials; `HMAC` is rejected for an endpoint with no signing secret (call
69
72
  * `rotateWebhookSecret` first). `updateData.eventSettings` changes per-event options by event name
70
73
  * (`{ NUMBER_HEALTH_BELOW_THRESHOLD: { threshold } }`, `{ CAMPAIGN_HEALTH_BELOW_THRESHOLD: { threshold } }`,
71
- * 1.5–10 in 0.5 steps); events you omit keep their stored settings. Like every read of a webhook, the
74
+ * 1.5–10 in 0.5 steps); events you omit keep their stored settings. `updateData.secondaryUrl` changes an
75
+ * `Agent` endpoint's secondary URL, and `null` clears it. Like every read of a webhook, the
72
76
  * response carries `hasSigningSecret` and `hasCredentials` (booleans), never a secret or credential.
73
77
  * @async
74
78
  * @roles api, admin, developer
@@ -58,10 +58,13 @@ export class Billing {
58
58
  * @param {string} [params.transactionType] - The type of transaction to filter by
59
59
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
60
60
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
61
+ * @param {string} [params.category] - One category, or a comma-separated list: one of the RCS categories RCS_RICH_OUTBOUND, RCS_RICH_MEDIA_OUTBOUND, RCS_INBOUND, RCS_ACTION_CLICK, RCS_MEDIA_SURCHARGE, RCS_FEE_ONBOARDING, RCS_FEE_RENEWAL, RCS_SESSION_ADJUSTMENT or RCS_SESSION_CARRIER_ADJUSTMENT, or RCS_CARRIER_PASSTHROUGH for RCS carrier rows alone. Any other value is rejected with a 400.
62
+ * @param {number} [params.page] - Page number (positive integer)
63
+ * @param {number} [params.limit] - Page size, at most 1000
61
64
  * @param {RequestOptions} [params.options] - Additional options for the request
62
65
  * @returns {Promise<SdkResponse<Array>>} The response from the server
63
66
  */
64
- getTransactionHistory({ groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate, options }: {
67
+ getTransactionHistory({ groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate, category, page, limit, options }: {
65
68
  groupId?: string;
66
69
  subgroupId?: string;
67
70
  brandId?: string;
@@ -70,6 +73,9 @@ export class Billing {
70
73
  transactionType?: string;
71
74
  startDate?: string;
72
75
  endDate?: string;
76
+ category?: string;
77
+ page?: number;
78
+ limit?: number;
73
79
  options?: RequestOptions;
74
80
  }): Promise<SdkResponse<any[]>>;
75
81
  /**
@@ -209,7 +209,7 @@ export class Brands {
209
209
  * @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
210
210
  * @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
211
211
  * @param {RequestOptions} [params.options] - Additional options for the request
212
- * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, reviewsBusinessOnSubmit?: boolean, businessStructure?: string|null, industry?: string|null, contactEmail?: string|null, contactJobTitle?: string|null, contactJobLevel?: string|null, rejectionReason?: string|null, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.reviewsBusinessOnSubmit` (whether it's reviewed when it's submitted and keeps its business details from then on). A brand reviewed on submit also carries its `tollFree.businessStructure`, `tollFree.industry`, `tollFree.contactEmail`, `tollFree.contactJobTitle` and `tollFree.contactJobLevel`, and `tollFree.rejectionReason` (why its review rejected it, in plain English, or null). On other toll-free brands these are null or absent. The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit. Each brand carries `carrierSuspensions` (carrier brand suspension rules; active while liftedAt is null).
212
+ * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, reviewsBusinessOnSubmit?: boolean, businessStructure?: string|null, industry?: string|null, contactEmail?: string|null, contactJobTitle?: string|null, contactJobLevel?: string|null, rejectionReason?: string|null, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.reviewsBusinessOnSubmit` (whether it's reviewed when it's submitted and keeps its business details from then on). A brand reviewed on submit also carries its `tollFree.businessStructure`, `tollFree.industry`, `tollFree.contactEmail`, `tollFree.contactJobTitle` and `tollFree.contactJobLevel`, and `tollFree.rejectionReason` (why its review rejected it, in plain English, or null). On other toll-free brands these are null or absent. The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit. Each brand carries `carrierSuspensions` (carrier brand suspension rules; active while liftedAt is null). Each brand also carries `cnamName` (its caller name for numbers, or null; see getCallerName).
213
213
  */
214
214
  getBrands({ id, subgroupId, groupId, page, limit, status, registrationType, currentTollFreeCarrier, search, sortBy, sortOrder, entityType, ein, email, referenceId, groupIds, createdFrom, createdTo, excludeDeleted, includeTotal, options, }: {
215
215
  id?: string;
@@ -503,6 +503,69 @@ export class Brands {
503
503
  file: File | Blob;
504
504
  options?: RequestOptions;
505
505
  }): Promise<SdkResponse<any>>;
506
+ /**
507
+ * Get a brand's caller name (CNAM) and the numbers it applies to: every number whose caller name comes from this
508
+ * brand (its campaign numbers, numbers it was picked on, and campaign-less numbers of subgroups that use it as
509
+ * their default caller-ID brand)
510
+ * @async
511
+ * @roles api, admin, developer, billing, user
512
+ * @param {Object} params - The parameters for the request
513
+ * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
514
+ * @param {RequestOptions} [params.options] - Additional options for the request
515
+ * @throws {Error} Throws an error if the brandId parameter is missing
516
+ * @returns {Promise<SdkResponse<{ brandId: string, companyName: string, cnamName: string|null, eligible: boolean, numbers: { total: number, items: Array<{ phoneNumber: string, friendlyName: string|null, cnam: Object|null }> } }>>} The brand's caller name (null when it has none) and its numbers; `items` lists the first 100
517
+ */
518
+ getCallerName({ brandId, options }: {
519
+ brandId: BrandLookupId;
520
+ options?: RequestOptions;
521
+ }): Promise<SdkResponse<{
522
+ brandId: string;
523
+ companyName: string;
524
+ cnamName: string | null;
525
+ eligible: boolean;
526
+ numbers: {
527
+ total: number;
528
+ items: Array<{
529
+ phoneNumber: string;
530
+ friendlyName: string | null;
531
+ cnam: any | null;
532
+ }>;
533
+ };
534
+ }>>;
535
+ /**
536
+ * Set a brand's caller name (CNAM). It replaces the caller name on every number whose caller name comes from this
537
+ * brand, names set on a number included, and numbers that later come under the brand get it too. The name may only
538
+ * remove characters from the brand's registered name and must be 1-15 letters, digits, spaces, `-` or `_`; the brand
539
+ * must be verified. Numbers are updated at the carrier in the background (their `cnam.status` is PENDING until then).
540
+ * @async
541
+ * @roles api, admin, developer
542
+ * @param {Object} params - The parameters for the request
543
+ * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
544
+ * @param {string} params.name - The caller name to show
545
+ * @param {RequestOptions} [params.options] - Additional options for the request
546
+ * @throws {Error} Throws an error if the brandId or name parameter is missing
547
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ brandId, companyName, cnamName, eligible, numbers: { total, items } }`
548
+ */
549
+ setCallerName({ brandId, name, options }: {
550
+ brandId: BrandLookupId;
551
+ name: string;
552
+ options?: RequestOptions;
553
+ }): Promise<SdkResponse<any>>;
554
+ /**
555
+ * Remove a brand's caller name (CNAM). Numbers that had it go back to the automatic name if their subgroup has
556
+ * caller name auto-apply on, otherwise to no caller name. Names set on a number are kept.
557
+ * @async
558
+ * @roles api, admin, developer
559
+ * @param {Object} params - The parameters for the request
560
+ * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
561
+ * @param {RequestOptions} [params.options] - Additional options for the request
562
+ * @throws {Error} Throws an error if the brandId parameter is missing
563
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ brandId, companyName, cnamName, eligible, numbers: { total, items } }`
564
+ */
565
+ deleteCallerName({ brandId, options }: {
566
+ brandId: BrandLookupId;
567
+ options?: RequestOptions;
568
+ }): Promise<SdkResponse<any>>;
506
569
  }
507
570
  export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
508
571
  export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
@@ -376,7 +376,7 @@ export class Campaigns {
376
376
  * @param {string} params.campaignId - Campaign identifier
377
377
  * @param {RequestOptions} [params.options] - Additional request options
378
378
  * @throws {Error} Throws an error if the campaignId parameter is missing
379
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ campaignId, brandId, usecase, brand: { status, brandScore, entityType }, att: { tier, scope, unit, sms: { limit }, mms: { limit }, marginPercent, nextTier }, tmobile: { tier, scope, unit, dailyLimit, thresholds, nextTier, usedToday: { date, segments, resetsAt } | null } }`. A null tier/limit means the carrier ladder does not apply (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase); a null nextTier means the top rung or a usecase-capped (LOW_VOLUME) campaign.
379
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ campaignId, brandId, usecase, brand: { status, brandScore, entityType }, att: { tier, scope, unit, sms: { limit }, mms: { limit }, marginPercent, nextTier }, tmobile: { tier, scope, unit, dailyLimit, thresholds, nextTier, usedToday: { date, segments, resetsAt } | null, sharedWith: [{ brandId, brandName }] } }`. A null tier/limit means the carrier ladder does not apply (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase); a null nextTier means the top rung or a usecase-capped (LOW_VOLUME) campaign. T-Mobile's counter is keyed per brand EIN, not per brand: sharedWith lists other verified brands in the same group that share this EIN and also carry a T-Mobile limit, since usedToday is their combined total.
380
380
  */
381
381
  getCampaignThroughputLimits({ campaignId, options }: {
382
382
  campaignId: string;
@@ -390,7 +390,7 @@ export class Campaigns {
390
390
  * @param {string} params.groupId - Group identifier
391
391
  * @param {RequestOptions} [params.options] - Additional request options
392
392
  * @throws {Error} Throws an error if the groupId parameter is missing
393
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt } } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score.
393
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt }, sharedWith: [{ brandId, brandName }] } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score. sharedWith lists this brand's other group brands on the same EIN that also carry a T-Mobile limit, since usedToday is their combined total.
394
394
  */
395
395
  getGroupThroughputUsage({ groupId, options }: {
396
396
  groupId: string;
@@ -3,6 +3,32 @@ export class Messages {
3
3
  client: any;
4
4
  multipartClient: any;
5
5
  enableAdmin: any;
6
+ admin: {
7
+ /**
8
+ * Read RCS webhook health: how late provider reports reach Signal House, and which tenants' webhooks are failing (signalhouse only)
9
+ * @async
10
+ * @roles signalhouse
11
+ * @param {Object} [params] - The parameters for the read
12
+ * @param {RequestOptions} [params.options] - Additional options for the request
13
+ * @returns {Promise<SdkResponse<{ windowMinutes: number, lag: { reports: number, p50Seconds: number|null, p95Seconds: number|null, maxSeconds: number|null }, tenantFailures: Array<{ groupId: string, failures: number, alerted: boolean }> }>>} A promise that resolves to the view
14
+ */
15
+ getRcsWebhookHealth: ({ options }?: {
16
+ options?: RequestOptions;
17
+ }) => Promise<SdkResponse<{
18
+ windowMinutes: number;
19
+ lag: {
20
+ reports: number;
21
+ p50Seconds: number | null;
22
+ p95Seconds: number | null;
23
+ maxSeconds: number | null;
24
+ };
25
+ tenantFailures: Array<{
26
+ groupId: string;
27
+ failures: number;
28
+ alerted: boolean;
29
+ }>;
30
+ }>>;
31
+ };
6
32
  /**
7
33
  * Estimate regional SMS/MMS retail cost; no charge or send. A Canadian sender requires a Ready Canadian sender and
8
34
  * Canadian or US recipients, and is unavailable unless Canada is enabled for the environment. A +44 (UK) sender
@@ -101,12 +127,26 @@ export class Messages {
101
127
  * @param {string} params.id - The message ID
102
128
  * @param {RequestOptions} [params.options] - Additional options for the request
103
129
  * @throws {Error} Throws an error if the id parameter is missing
104
- * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404
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
105
131
  */
106
132
  getMessage({ id, options }: {
107
133
  id: string;
108
134
  options?: RequestOptions;
109
135
  }): Promise<SdkResponse<any>>;
136
+ /**
137
+ * Get the taps on one RCS message, oldest first
138
+ * @async
139
+ * @roles api, admin, developer, billing, user
140
+ * @param {Object} params - The parameters for getting the taps
141
+ * @param {string} params.id - The message ID
142
+ * @param {RequestOptions} [params.options] - Additional options for the request
143
+ * @throws {Error} Throws an error if the id parameter is missing
144
+ * @returns {Promise<SdkResponse<any>>} - A promise that resolves to `{ results: [{ actionType, buttonId, label, postbackData, occurredAt, ratedCostMicros }] }`; an unknown ID is a 404
145
+ */
146
+ getMessageInteractions({ id, options }: {
147
+ id: string;
148
+ options?: RequestOptions;
149
+ }): Promise<SdkResponse<any>>;
110
150
  /**
111
151
  * Fetch the latest upstream carrier delivery report for a set of messages by ID.
112
152
  * Useful for reconciling messages stuck in a non-terminal state. Outbound SMS and MMS messages sent from numbers on
@@ -289,7 +289,8 @@ export class Numbers {
289
289
  * @param {string} params.phoneNumber - The phone number (E.164, leading + optional)
290
290
  * @param {RequestOptions} [params.options] - Additional options for the request
291
291
  * @throws {Error} Throws an error if the phoneNumber parameter is missing
292
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ phoneNumber, cnam, autoApply, eligible, ineligibleReason }`
292
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ phoneNumber, cnam, autoApply, eligible, ineligibleReason }`;
293
+ * `cnam.source` is MANUAL (set on the number), BRAND (the brand's caller name) or AUTO (subgroup auto-apply)
293
294
  */
294
295
  getCallerName({ phoneNumber, options }: {
295
296
  phoneNumber: string;
@@ -316,8 +317,8 @@ export class Numbers {
316
317
  options?: RequestOptions;
317
318
  }): Promise<SdkResponse<any>>;
318
319
  /**
319
- * Remove a phone number's own caller name (CNAM). If its subgroup has caller name auto-apply on, the
320
- * number goes back to the automatic name.
320
+ * Remove a phone number's own caller name (CNAM). The number goes back to its brand's caller name if the brand
321
+ * has one (see brands.setCallerName), else to the automatic name if its subgroup has caller name auto-apply on.
321
322
  * @async
322
323
  * @roles api, admin, developer
323
324
  * @param {Object} params - The parameters for the request
@@ -96,7 +96,7 @@ export class RcsAgents {
96
96
  * @param {RcsAgentConsent} [params.consent] - The launch text; required in full before the launch request
97
97
  * @param {RcsAgentContact} [params.contact] - The launch contact; required in full before the launch request
98
98
  * @param {("OTP"|"TRANSACTIONAL"|"PROMOTIONAL"|"MULTI_USE")} [params.useCase] - The agent's use case; required before submit
99
- * @param {("NON_CONVERSATIONAL"|"CONVERSATIONAL")} [params.billingCategory] - Default NON_CONVERSATIONAL; submit refuses CONVERSATIONAL
99
+ * @param {("NON_CONVERSATIONAL"|"CONVERSATIONAL")} [params.billingCategory] - Default NON_CONVERSATIONAL (per message); CONVERSATIONAL is billed per interactive session
100
100
  * @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
101
  * @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
102
102
  * @param {string[]} [params.testers] - Tester numbers (up to 200), invited once the agent exists at the carrier
@@ -127,7 +127,7 @@ export class RcsAgents {
127
127
  * @param {Object} [params] - Filters
128
128
  * @param {string} [params.groupId] - Filter by group ID
129
129
  * @param {string} [params.subgroupId] - Filter by subgroup ID
130
- * @param {string|string[]} [params.status] - DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING or ARCHIVED, one or a list
130
+ * @param {string|string[]} [params.status] - DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING, ARCHIVE_PENDING or ARCHIVED, one or a list
131
131
  * @param {string} [params.brandId] - Agents linked to this brand (carrier brand ID, provisional UUID or _id)
132
132
  * @param {string} [params.campaignId] - Agents linked to this campaign (campaign ID or _id)
133
133
  * @param {number} [params.page] - Page number (default 1)
@@ -196,7 +196,7 @@ export class RcsAgents {
196
196
  }): Promise<SdkResponse<any>>;
197
197
  /**
198
198
  * Check an agent against the next gate on its path without writing: before it exists at the carrier partner, what
199
- * creating it needs (the full profile, useCase, NON_CONVERSATIONAL billing); after that, what the launch request needs
199
+ * creating it needs (the full profile, useCase, a billingCategory); after that, what the launch request needs
200
200
  * (a VERIFIED brand, the campaign, the full consent with the video, the contact)
201
201
  * @async
202
202
  * @roles api, admin, developer, billing, user
@@ -211,7 +211,7 @@ export class RcsAgents {
211
211
  }): Promise<SdkResponse<any>>;
212
212
  /**
213
213
  * Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a
214
- * useCase and NON_CONVERSATIONAL billing; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
214
+ * useCase and a billingCategory; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
215
215
  * errors, warnings }. The agent moves to AGENT_CREATING, then IN_TESTING once the partner reports it ready.
216
216
  * @async
217
217
  * @roles api, admin, developer, billing, user
@@ -229,26 +229,31 @@ export class RcsAgents {
229
229
  * PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
230
230
  * CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
231
231
  * "REGISTRATION_INCOMPLETE", errors, warnings }. Sends POST /registration/:agentId/launch: the agent is a registration.
232
- * The request charges the agent's launch fees: a wallet that cannot cover them gets a 402, and the agent stays where it is. The agent's launchFees quotes what the next request charges.
232
+ * 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
+ * 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.
233
234
  * @async
234
235
  * @roles api, admin, developer, billing, user
235
236
  * @param {Object} params - The launch request
236
237
  * @param {string} params.agentId - The agent ID
238
+ * @param {boolean} [params.acknowledgeFees] - Accept the fees due; required when any are
239
+ * @param {boolean} [params.acknowledgePhi] - Accept the PHI disclosure; required for a healthcare or insurance brand
237
240
  * @param {RequestOptions} [params.options] - Additional options for the request
238
241
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status PENDING_REVIEW)
239
242
  */
240
- launch({ agentId, options }: {
243
+ launch({ agentId, acknowledgeFees, acknowledgePhi, options }: {
241
244
  agentId: string;
245
+ acknowledgeFees?: boolean;
246
+ acknowledgePhi?: boolean;
242
247
  options?: RequestOptions;
243
248
  }): Promise<SdkResponse<any>>;
244
249
  /**
245
- * Archive an agent
250
+ * 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
251
  * @async
247
252
  * @roles api, admin, developer, user
248
253
  * @param {Object} params - The archive request
249
254
  * @param {string} params.agentId - The agent ID
250
255
  * @param {RequestOptions} [params.options] - Additional options for the request
251
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status ARCHIVED)
256
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status ARCHIVE_PENDING or ARCHIVED)
252
257
  */
253
258
  archive({ agentId, options }: {
254
259
  agentId: string;
@@ -270,6 +275,22 @@ export class RcsAgents {
270
275
  phoneNumber: string;
271
276
  options?: RequestOptions;
272
277
  }): Promise<SdkResponse<any>>;
278
+ /**
279
+ * Remove a tester at once, at any point before the agent is archived. The number must be a tester on the agent (404);
280
+ * an archived agent answers 409.
281
+ * @async
282
+ * @roles api, admin, developer, billing, user
283
+ * @param {Object} params - The removal
284
+ * @param {string} params.agentId - The agent ID
285
+ * @param {string} params.phoneNumber - The tester's US number, with or without the +
286
+ * @param {RequestOptions} [params.options] - Additional options for the request
287
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
288
+ */
289
+ removeTester({ agentId, phoneNumber, options }: {
290
+ agentId: string;
291
+ phoneNumber: string;
292
+ options?: RequestOptions;
293
+ }): Promise<SdkResponse<any>>;
273
294
  /**
274
295
  * Host the agent's logo (224 × 224 px, 50 KB max) or hero image (1440 × 448 px, 200 KB max), PNG or JPEG, and set
275
296
  * it on the draft. Images of any other size are refused.
@@ -324,7 +345,7 @@ export class RcsMessages {
324
345
  * @param {boolean} [params.isTest] - Send as a test; approved testers only
325
346
  * @param {("not_capable"|"ttl_expired"|"delivered"|"read")} [params.simulate] - Simulate this outcome; approved testers only
326
347
  * @param {RequestOptions} [params.options] - Additional options for the request
327
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to { requested, enqueued, failed, bulkId, messages } (201). A blocked row carries blockReason, reason and issues; an archived template answers 409 TEMPLATE_ARCHIVED
348
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { requested, enqueued, failed, bulkId, messages } (201). A blocked row carries blockReason, reason and issues; an archived template answers 409 TEMPLATE_ARCHIVED. A recipient from 19999990000 to 19999990359 makes the whole request a simulation, as on SMS: it resolves to { simulated: true, webhooks } and nothing is stored, sent or charged
328
349
  */
329
350
  send({ agentId, recipients, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, statusCallbackUrl, enableShortlink, isTest, simulate, options }: {
330
351
  agentId: string;
@@ -399,7 +420,7 @@ export class RcsMessages {
399
420
  * @param {string} [params.expireTime] - ISO-8601 time the RCS message expires
400
421
  * @param {RcsMessageFallback} [params.fallback] - The fallback to price; its from is optional here, and with none the leg is priced on the channel of the agent's linked campaign
401
422
  * @param {RequestOptions} [params.options] - Additional options for the request
402
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB, already inside rcsLeg.cost; a message over 100 MB adds a MEDIA_TOO_LARGE issue.
423
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB for one recipient, and rcsLeg.cost already holds it for every recipient; rcsLeg.cost is null with the fallback mode sms_only; a message over 100 MB adds a MEDIA_TOO_LARGE issue.
403
424
  */
404
425
  estimate({ agentId, recipients, recipientCount, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, options }: {
405
426
  agentId: string;
@@ -423,13 +444,44 @@ export class RcsMessages {
423
444
  * @param {string} params.agentId - The agent (RCSA…)
424
445
  * @param {string[]} params.phoneNumbers - Up to 500 numbers, 10-15 digits, with or without the +
425
446
  * @param {RequestOptions} [params.options] - Additional options for the request
426
- * @returns {Promise<SdkResponse<any>>} A promise that resolves to { results: [{ phoneNumber, capability }] }, capability being ENABLED, UNREACHABLE or UNKNOWN
447
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { results: [{ phoneNumber, capability, rcsEnabled, reason, features, carrier, checkedAt, cached }] }, capability being ENABLED, UNREACHABLE or UNKNOWN, and reason CAPABLE, NOT_CAPABLE, NOT_LAUNCHED_ON_CARRIER or UNKNOWN; rcsEnabled is true only for CAPABLE, carrier and checkedAt may be null, and features is empty today
427
448
  */
428
449
  capabilities({ agentId, phoneNumbers, options }: {
429
450
  agentId: string;
430
451
  phoneNumbers: string[];
431
452
  options?: RequestOptions;
432
453
  }): Promise<SdkResponse<any>>;
454
+ /**
455
+ * Fake an inbound event from an approved tester of the agent, with no carrier involved: it runs the real inbound handlers and webhooks, as free test traffic. A simulated STOP really opts the tester out; a simulated START clears it. Anyone else gets a 403 with code NOT_TESTER. Returns 202 with { status, messageId }.
456
+ * @async
457
+ * @roles api, admin, developer, billing, user
458
+ * @param {Object} params - The event
459
+ * @param {string} params.agentId - The agent (RCSA…)
460
+ * @param {string} params.from - The approved tester's number
461
+ * @param {string} params.type - TEXT, SUGGESTION, LOCATION, FILE or UNSUBSCRIBE
462
+ * @param {string} [params.text] - The text; required for TEXT
463
+ * @param {string} [params.postbackData] - The tapped suggestion's postback; SUGGESTION needs this or buttonId
464
+ * @param {string} [params.messageId] - The message a tap answers; the latest message delivered to the tester by default
465
+ * @param {string} [params.buttonId] - The suggestion's position, as webhooks report it
466
+ * @param {number} [params.latitude] - Required for LOCATION
467
+ * @param {number} [params.longitude] - Required for LOCATION
468
+ * @param {string} [params.fileName] - The file's name, for FILE
469
+ * @param {RequestOptions} [params.options] - Additional options for the request
470
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to { status: "QUEUED", messageId }
471
+ */
472
+ simulateInbound({ agentId, from, type, text, postbackData, messageId, buttonId, latitude, longitude, fileName, options }: {
473
+ agentId: string;
474
+ from: string;
475
+ type: string;
476
+ text?: string;
477
+ postbackData?: string;
478
+ messageId?: string;
479
+ buttonId?: string;
480
+ latitude?: number;
481
+ longitude?: number;
482
+ fileName?: string;
483
+ options?: RequestOptions;
484
+ }): Promise<SdkResponse<any>>;
433
485
  /**
434
486
  * Get one message by its ID. The same route as messages.getMessage.
435
487
  * @async
@@ -21,14 +21,23 @@ export class Registrations {
21
21
  * @param {Object} params - The parameters for the review decision
22
22
  * @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
23
23
  * @param {("APPROVE"|"REJECT")} params.action - The review decision
24
- * @param {string} [params.reason] - Why the registration was rejected; required when action is REJECT
24
+ * @param {string} [params.reason] - Why the registration was rejected; required when action is REJECT. An RCS agent takes 10 to 256 characters
25
+ * @param {string} [params.reasonCode] - The rejection catalogue code; required to reject an RCS agent, refused for any other type
26
+ * @param {Array<{ field?: string|null, code: string, reason: string, recommendedAction?: string|null }>} [params.rejectionReasons] - Field-level reasons for an RCS agent
25
27
  * @param {RequestOptions} [params.options] - Additional options for the request
26
28
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated registration
27
29
  */
28
- reviewRegistration: ({ registrationId, action, reason, options }: {
30
+ reviewRegistration: ({ registrationId, action, reason, reasonCode, rejectionReasons, options }: {
29
31
  registrationId: string;
30
32
  action: ("APPROVE" | "REJECT");
31
33
  reason?: string;
34
+ reasonCode?: string;
35
+ rejectionReasons?: Array<{
36
+ field?: string | null;
37
+ code: string;
38
+ reason: string;
39
+ recommendedAction?: string | null;
40
+ }>;
32
41
  options?: RequestOptions;
33
42
  }) => Promise<SdkResponse<any>>;
34
43
  /**
@@ -92,6 +101,34 @@ export class Registrations {
92
101
  registrationId: string;
93
102
  options?: RequestOptions;
94
103
  }) => Promise<SdkResponse<ArrayBuffer>>;
104
+ /**
105
+ * Give an RCS agent an assignee in the staff review queue, or clear it (signalhouse only)
106
+ * @async
107
+ * @roles signalhouse
108
+ * @param {Object} params - The parameters for the assignment
109
+ * @param {string} params.registrationId - The agent's registration ID (e.g. RCSA7K2M1QZ8RP)
110
+ * @param {string|null} params.userId - An active Signal House staff user; null clears the assignee
111
+ * @param {RequestOptions} [params.options] - Additional options for the request
112
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, as staff read it
113
+ */
114
+ assignRegistration: ({ registrationId, userId, options }: {
115
+ registrationId: string;
116
+ userId: string | null;
117
+ options?: RequestOptions;
118
+ }) => Promise<SdkResponse<any>>;
119
+ /**
120
+ * Nudge the owner of an RCS agent waiting in an SLA state, at most once per business day (signalhouse only)
121
+ * @async
122
+ * @roles signalhouse
123
+ * @param {Object} params - The parameters for the nudge
124
+ * @param {string} params.registrationId - The agent's registration ID (e.g. RCSA7K2M1QZ8RP)
125
+ * @param {RequestOptions} [params.options] - Additional options for the request
126
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, as staff read it
127
+ */
128
+ nudgeRegistration: ({ registrationId, options }: {
129
+ registrationId: string;
130
+ options?: RequestOptions;
131
+ }) => Promise<SdkResponse<any>>;
95
132
  };
96
133
  /**
97
134
  * Get the registration types a region offers and whether each can be acquired right now
@@ -232,16 +269,21 @@ export class Registrations {
232
269
  * Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
233
270
  * carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
234
271
  * { code: "REGISTRATION_INCOMPLETE", errors, warnings }.
235
- * An RCS agent's launch request charges its launch fees: a wallet that cannot cover them gets a 402, and nothing changes.
272
+ * 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
+ * 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.
236
274
  * @async
237
275
  * @roles api, admin, developer, billing, user
238
276
  * @param {Object} params - The parameters for the launch request
239
277
  * @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
278
+ * @param {boolean} [params.acknowledgeFees] - Accept the fees due; required when any are
279
+ * @param {boolean} [params.acknowledgePhi] - Accept the PHI disclosure; required for a healthcare or insurance brand
240
280
  * @param {RequestOptions} [params.options] - Additional options for the request
241
281
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, now SIGNAL_HOUSE_REVIEW
242
282
  */
243
- launchRegistration({ registrationId, options }: {
283
+ launchRegistration({ registrationId, acknowledgeFees, acknowledgePhi, options }: {
244
284
  registrationId: string;
285
+ acknowledgeFees?: boolean;
286
+ acknowledgePhi?: boolean;
245
287
  options?: RequestOptions;
246
288
  }): Promise<SdkResponse<any>>;
247
289
  /**
@@ -138,6 +138,7 @@ export class Templates {
138
138
  }): Promise<SdkResponse<SavedTemplate>>;
139
139
  /**
140
140
  * Publish a template's current draft; no draft returns 409 NO_DRAFT, a draft changed mid-publish returns 409 DRAFT_CHANGED (publish again) and an incomplete draft returns 400 TEMPLATE_INVALID
141
+ * A block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED, whose message names the category ("Content moderation flagged this text: spam"). The check passes when the Moderation API fails.
141
142
  * @async
142
143
  * @roles api, admin, developer
143
144
  * @param {Object} params - The parameters for publishing a template
@@ -189,6 +190,7 @@ export class Templates {
189
190
  }): Promise<SdkResponse<Page<VersionSummary>>>;
190
191
  /**
191
192
  * Validate an unsaved body or a stored version without writing anything
193
+ * Validate runs the publish checks, the content policy check included: a block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED. Saving a draft does not run that check.
192
194
  * @async
193
195
  * @roles api, admin, developer, billing, user
194
196
  * @param {Object} params - The parameters for validation; pass exactly one of body or version
@@ -16,18 +16,20 @@ export class Webhooks {
16
16
  * @param {Object} params - The parameters for getting webhooks
17
17
  * @param {string} [params.id] - Filter by webhook ID
18
18
  * @param {string} [params.groupId] - Filter by associated group ID
19
- * @param {string} [params.endpointType] - Filter by endpoint type (Global, Number)
19
+ * @param {string} [params.endpointType] - Filter by endpoint type (Global, Number, Agent)
20
20
  * @param {string} [params.phoneNumber] - Filter by associated phone number (for SMS webhooks)
21
+ * @param {string} [params.agentId] - Filter by RCS agent (for Agent webhooks)
21
22
  * @param {number} [params.page] - The page number for pagination
22
23
  * @param {number} [params.limit] - The number of items per page for pagination
23
24
  * @param {RequestOptions} [params.options] - Additional options for the request
24
25
  * @returns {Promise<SdkResponse<Array>>} The response from the server
25
26
  */
26
- getWebhooks({ id, groupId, endpointType, phoneNumber, page, limit, options }: {
27
+ getWebhooks({ id, groupId, endpointType, phoneNumber, agentId, page, limit, options }: {
27
28
  id?: string;
28
29
  groupId?: string;
29
30
  endpointType?: string;
30
31
  phoneNumber?: string;
32
+ agentId?: string;
31
33
  page?: number;
32
34
  limit?: number;
33
35
  options?: RequestOptions;
@@ -46,7 +48,9 @@ export class Webhooks {
46
48
  * `webhookData.eventSettings` holds per-event options keyed by event name:
47
49
  * `NUMBER_HEALTH_BELOW_THRESHOLD` and `CAMPAIGN_HEALTH_BELOW_THRESHOLD` each take `{ threshold }`, the 7-day
48
50
  * health score (1.5–10, in 0.5 steps) below which the event fires; a subscribed health event without one is
49
- * stored with the default, 6.
51
+ * stored with the default, 6. `webhookData.endpointType` is `Global`, `Number` or `Agent`. An `Agent` endpoint
52
+ * receives one RCS agent's events only: it needs `agentId`, and may set `secondaryUrl`, which gets one try when
53
+ * every attempt to `url` fails.
50
54
  * @async
51
55
  * @roles api, admin, developer
52
56
  * @param {Object} params - The parameters for creating a webhook
@@ -67,7 +71,8 @@ export class Webhooks {
67
71
  * the stored credentials; `HMAC` is rejected for an endpoint with no signing secret (call
68
72
  * `rotateWebhookSecret` first). `updateData.eventSettings` changes per-event options by event name
69
73
  * (`{ NUMBER_HEALTH_BELOW_THRESHOLD: { threshold } }`, `{ CAMPAIGN_HEALTH_BELOW_THRESHOLD: { threshold } }`,
70
- * 1.5–10 in 0.5 steps); events you omit keep their stored settings. Like every read of a webhook, the
74
+ * 1.5–10 in 0.5 steps); events you omit keep their stored settings. `updateData.secondaryUrl` changes an
75
+ * `Agent` endpoint's secondary URL, and `null` clears it. Like every read of a webhook, the
71
76
  * response carries `hasSigningSecret` and `hasCredentials` (booleans), never a secret or credential.
72
77
  * @async
73
78
  * @roles api, admin, developer