@signalhousellc/sdk 1.1.0 → 1.2.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": "@signalhousellc/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -63,13 +63,17 @@ export class Auth {
63
63
  * @param {boolean} [params.acceptedTermsOfService] - Whether the user accepted the Terms of Service
64
64
  * @param {string} [params.psXid] - PartnerStack click id (ps_xid) captured from a referral link
65
65
  * @param {string} [params.psPartnerKey] - PartnerStack partner key (ps_partner_key) captured from a referral link
66
+ * @param {Object} [params.attribution] - Marketing attribution captured at signup
67
+ * @param {string} [params.attribution.posthogDistinctId] - PostHog distinct id of the registering visitor
68
+ * @param {Object} [params.attribution.firstTouch] - First-ever visit: utmSource, utmMedium, utmCampaign, utmTerm, utmContent, gclid, fbclid, referrer, landingUrl
69
+ * @param {Object} [params.attribution.lastTouch] - Visit that registered, same keys as firstTouch
66
70
  * @param {RequestOptions} [params.options] - Additional options for the request
67
71
  * @returns {Promise<SdkResponse<any>>} The response from the server (contains the JWT token)
68
72
  */
69
- async register({ businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, options = {} }) {
73
+ async register({ businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution, options = {} }) {
70
74
  return this.client(`/auth/register`, {
71
75
  method: "POST",
72
- body: { businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey },
76
+ body: { businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, attribution },
73
77
  ...options,
74
78
  });
75
79
  }
@@ -26,7 +26,8 @@ export class Messages {
26
26
  * Estimate regional SMS/MMS retail cost; no charge or send. A Canadian sender requires a Ready Canadian sender and
27
27
  * Canadian or US recipients, and is unavailable unless Canada is enabled for the environment. A +44 (UK) sender
28
28
  * estimates SMS to GB mobiles only and returns region "GB"; while UK sending is disabled for the environment a UK
29
- * sender is refused with a 400.
29
+ * sender is refused with a 400. The sender may also be a READY alphanumeric sender ID (e.g. "ACME"; UK recipients,
30
+ * SMS only); its estimate counts the "\nOpt out: sihou.io/o/{code}" footer the server appends to every such message.
30
31
  * @async
31
32
  * @param {Object} params - Sender, up to 100 recipients (10-15 digits each), messageBody and request options.
32
33
  * @returns {Promise<SdkResponse<any>>} - Per-recipient rates and total in microdollars; unknown carriers use the upper fallback.
@@ -50,15 +51,15 @@ export class Messages {
50
51
  * @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
51
52
  * @param {string|string[]} [params.messageType] - Filter messages by their type. Accepts a single value or an array (e.g. ["SMS", "MMS"]). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types.
52
53
  * @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, virtualLongCode, tollFree, shortCode, p2p. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
53
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Accepted whether or not the environment serves hourly analytics.
54
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Accepted whether or not the environment serves hourly analytics.
54
55
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string. Accepted whether or not the environment serves hourly analytics.
55
56
  * @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (a message matches ANY of them) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
56
57
  * @param {string} [params.carrier] - Filter messages by the carrier used for sending
57
58
  * @param {string|string[]} [params.sentimentLabel] - Filter messages by sentiment bucket. Accepts a single value or an array (e.g. ["positive", "negative"]). Allowed values: positive, neutral, negative. Applied as the sentimentScore range the ±25 label threshold produces, so unscored messages match no bucket and outbound messages (never scored) are excluded.
58
59
  * @param {string|string[]} [params.errorCode] - Filter FAILED messages by Signal House error code (single value or array). "OUT" is the campaign opt-out, displayed as RECIPIENT_OPTED_OUT. Carrier codes are not filterable here; they live inside successOrFailureReason.
59
60
  * @param {string|string[]} [params.phoneNumber] - Filter messages by a business number on either side of the message. Accepts a single value or an array; OR'd with campaignId/brandId when matchAny is true
60
- * @param {string} [params.senderPhoneNumber] - Filter messages by the sender's 5-6 digit Short Code or 10+ digit phone number
61
- * @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
61
+ * @param {string} [params.senderPhoneNumber] - Filter messages by the sender's 5-6 digit Short Code or 10+ digit phone number. Use % as a wildcard for a partial match (e.g. "%1234" matches numbers ending in 1234); a plain value is an exact match. 3-15 digits required alongside any %.
62
+ * @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number. Use % as a wildcard for a partial match (e.g. "%1234" matches numbers ending in 1234); a plain value is an exact match. 3-15 digits required alongside any %.
62
63
  * @param {string} [params.startDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode
63
64
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back
64
65
  * @param {string} [params.sortField] - The field to sort the messages by (createdAt, segmentCount, status, sentimentScore)
@@ -143,7 +144,7 @@ export class Messages {
143
144
  * @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (match ANY) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
144
145
  * @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
145
146
  * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, virtualLongCode, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here (matched by carrier). Accepts a single value or an array. Ignored when matchAny is true (matchAny takes precedence).
146
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
147
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
147
148
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
148
149
  * @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
149
150
  * @param {RequestOptions} [params.options] - Additional options for the request
@@ -179,7 +180,7 @@ export class Messages {
179
180
  * @param {string} [params.endDate] - ISO-8601 date or timestamp. At day granularity it is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back; at hour granularity it is honoured as given.
180
181
  * @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
181
182
  * @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, virtualLongCode, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here. Accepts a single value or an array.
182
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
183
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
183
184
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
184
185
  * @param {("day"|"hour")} [params.granularity] - Time-bucket grain of the byDate rows. Omit for day (each row's _id is a "YYYY-MM-DD" date). "hour" buckets by hour (each row's _id is a "YYYY-MM-DD HH:MM:SS" UTC hour) and is capped to a 7-day span. Only accepted where the environment serves hourly analytics; elsewhere any value, including "day", is rejected with a 400 -- omit the parameter unless hour grain is wanted.
185
186
  * @param {("carrier"|"carrierFamily")} [params.breakdown] - Adds a byBreakdown time × dimension series to the response ({ dimension, rows }: each row is one byDate bucket (_id) for one carrier or carrier family (key), over the top 50 keys by volume, 10DLC only) and caps the span at 31 days. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
@@ -234,7 +235,7 @@ export class Messages {
234
235
  * @roles api, admin, developer, billing, user
235
236
  * @param {Object} params - The parameters for getting analytics filter options
236
237
  * @param {string} params.groupId - The ID of the group whose filter options to load
237
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
238
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
238
239
  * @param {RequestOptions} [params.options] - Additional options for the request
239
240
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to { subgroups, brands, campaigns, phoneNumbers }. Each phone number carries type (TOLL_FREE, SHORT_CODE, ALPHANUMERIC, VIRTUAL_LONG_NUMBER, ...) and country (ISO-2), null when unknown: TOLL_FREE, SHORT_CODE and ALPHANUMERIC are channels by type; any other US number is 10DLC and a non-US one is a Virtual Long Code.
240
241
  */
@@ -265,7 +266,7 @@ export class Messages {
265
266
  * @param {("tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means all activity. tenDLC/virtualLongCode/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s).
266
267
  * @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
267
268
  * @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
268
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
269
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
269
270
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
270
271
  * @param {RequestOptions} [params.options]
271
272
  * @returns {Promise<SdkResponse<any>>} - { rows, totalCount, page, limit }. Each row carries sms/mms/p2p metric columns plus `smsOptOuts` and `mmsOptOuts` from the DNC analytics MV (P2P has no opt-outs).
@@ -297,7 +298,7 @@ export class Messages {
297
298
  * @param {number} [params.limit=50] - max 50 per page
298
299
  * @param {("tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means every code. tenDLC/virtualLongCode/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s); when one channel is selected, totalErrors reflects only that channel.
299
300
  * @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
300
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
301
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
301
302
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
302
303
  * @param {RequestOptions} [params.options]
303
304
  * @returns {Promise<SdkResponse<any>>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
@@ -324,7 +325,7 @@ export class Messages {
324
325
  * @param {string} [params.endDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back
325
326
  * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, virtualLongCode, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
326
327
  * @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
327
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
328
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
328
329
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
329
330
  * @param {RequestOptions} [params.options] - Additional options for the request
330
331
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the DNC analytics data (totals, byDate, byPhoneNumber, bySenderNumber, byCampaign, bySubgroup, byType, byCarrier, byKeyword). bySenderNumber ({ senderPhoneNumber, total, sms, mms }) attributes each opt-out to the first business number that received it, so it is unchanged by later campaign moves and START replies. byCampaign ({ campaignId, ... }) counts campaign-scoped opt-outs only, by the campaign at the time of the STOP; subgroup-scoped opt-outs (non-US recipients) are never attributed to a campaign and appear under bySubgroup ({ subgroupId, ... }) instead. byType ({ messageType, total }) splits SMS/MMS. byKeyword breaks opt-outs down by the normalized keyword that revoked consent ({ optOutKeyword, total, sms, mms }); opt-outs recorded before keyword capture shipped appear as a single optOutKeyword: null bucket ("not recorded"). The distinct keyword set is open-ended (campaigns register their own keywords beyond the mandatory floor) — render top-N plus Other, never a fixed list.
@@ -355,7 +356,7 @@ export class Messages {
355
356
  * @param {string} [params.sortOrder] - Sort direction (asc, desc)
356
357
  * @param {string|string[]} [params.channel] - Filter by channel (tenDLC, virtualLongCode, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
357
358
  * @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
358
- * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (UK is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
359
+ * @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
359
360
  * @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400.
360
361
  * @param {RequestOptions} [params.options] - Additional options for the request
361
362
  * @returns {Promise<SdkResponse<any>>} - A promise that resolves to the paginated DNC records. Each record carries senderPhoneNumber — the first business number that received the opt-out (set once, never changed by a later STOP or a campaign move; the same value as phoneNumber) — optOutKeyword — the normalized keyword that revoked consent (e.g. "stop", "opt out"; a repeat opt-out records the most recent word), null for opt-outs recorded before keyword capture shipped — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
@@ -381,7 +382,7 @@ export class Messages {
381
382
  * @async
382
383
  * @roles api, admin, developer, billing, user
383
384
  * @param {Object} params - The parameters for sending an SMS message
384
- * @param {string} params.senderPhoneNumber - The 5-6 digit Short Code or 10+ digit phone number to send the message from
385
+ * @param {string} params.senderPhoneNumber - The 5-6 digit Short Code or 10+ digit phone number to send the message from, or a READY alphanumeric sender ID (e.g. "ACME"; UK recipients and SMS only). Every message from an alphanumeric sender gets "\nOpt out: sihou.io/o/{code}" appended by the server, counted in segments.
385
386
  * @param {string|string[]} params.recipientPhoneNumbers - The 10+ digit phone number(s) to send the message to. A Short Code sender permits exactly one recipient, and it must be a +1 (US/Canada) number; a bare 10-digit number is treated as +1. The API rejects Short Code sends with multiple recipients or a non-+1 recipient.
386
387
  * @param {string} params.messageBody - The body of the SMS message
387
388
  * @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
@@ -7,7 +7,8 @@
7
7
  /**
8
8
  * Sender registrations for every jurisdiction and type: the catalog of what a region offers, retail quotes,
9
9
  * customer submissions and staff review operations. `type` selects the shape of `data`
10
- * (for VIRTUAL_LONG_CODE: quantity, useCases and the optional voice dossier).
10
+ * (for VIRTUAL_LONG_CODE: quantity, useCases and the optional voice dossier; for GB ALPHANUMERIC_SENDER_ID: requestedSenderId,
11
+ * trafficOrigin, trafficType and the company details).
11
12
  */
12
13
  export class Registrations {
13
14
  constructor(client, enableAdmin) {
@@ -126,7 +127,7 @@ export class Registrations {
126
127
  * @async
127
128
  * @roles api, admin, developer, billing, user
128
129
  * @param {Object} params - The parameters for the catalog
129
- * @param {string} params.region - ISO-2 jurisdiction (US, GB or CA; UK is accepted for GB)
130
+ * @param {string} params.region - ISO-2 jurisdiction (US, GB or CA; any case of UK/GB/GBR/United Kingdom is accepted for GB)
130
131
  * @param {RequestOptions} [params.options] - Additional options for the request
131
132
  * @returns {Promise<SdkResponse<any>>} A promise that resolves to { region, jurisdiction, sendingRequiresRegistration, registeredThrough, provisioning, types }
132
133
  */
@@ -138,13 +139,14 @@ export class Registrations {
138
139
 
139
140
  /**
140
141
  * Get retail quotes for a registration type: one quote per capability bundle with per-number setupAmount
141
- * and monthlyAmount, the totals for the quantity (integer microdollars) and etaDays.
142
+ * and monthlyAmount, the totals for the quantity (integer microdollars) and etaDays. GB ALPHANUMERIC_SENDER_ID
143
+ * quotes one ["SMS"] bundle (6000000 setup and 6000000 monthly by default).
142
144
  * Unavailable (400) while the type cannot be acquired in the region.
143
145
  * @async
144
146
  * @roles api, admin, developer, billing, user
145
147
  * @param {Object} params - The parameters for the quote
146
- * @param {string} params.region - ISO-2 jurisdiction (UK is accepted for GB)
147
- * @param {string} params.type - Registration type (e.g. VIRTUAL_LONG_CODE)
148
+ * @param {string} params.region - ISO-2 jurisdiction (any case of UK/GB/GBR/United Kingdom is accepted for GB)
149
+ * @param {string} params.type - Registration type (e.g. VIRTUAL_LONG_CODE, or ALPHANUMERIC_SENDER_ID for GB)
148
150
  * @param {number} [params.quantity=1] - Number of numbers to quote (1-100)
149
151
  * @param {string} [params.groupId] - Group to price for; staff only
150
152
  * @param {RequestOptions} [params.options] - Additional options for the request
@@ -214,14 +216,19 @@ export class Registrations {
214
216
 
215
217
  /**
216
218
  * Submit a registration. `type` selects the shape of `data`: for VIRTUAL_LONG_CODE it is { quantity (1-100),
217
- * useCases (1-10 descriptions), voice? } where voice is required exactly when capabilities include VOICE.
219
+ * useCases (1-10 descriptions), voice? } where voice is required exactly when capabilities include VOICE. For GB
220
+ * ALPHANUMERIC_SENDER_ID (capabilities ["SMS"]) it is { requestedSenderId (3-11 letters/digits/space/dot/dash,
221
+ * at least one letter), trafficOrigin (LOCAL | INTERNATIONAL), trafficType (TRANSACTIONAL | PROMOTIONAL),
222
+ * companyName, companyCountry, companyWebsite, industry, messageExample, senderRelationship? } where
223
+ * senderRelationship is required when requestedSenderId differs from companyName; quantity is always 1 and
224
+ * data.phoneNumbers carries the granted sender (e.g. ["ACME"]) once APPROVED.
218
225
  * Reuse the same clientRequestId only when retrying an identical payload (409 otherwise).
219
226
  * Unavailable (400) while the type cannot be acquired in the region.
220
227
  * @async
221
228
  * @roles api, admin, developer, billing, user
222
229
  * @param {Object} params - The parameters for the registration
223
- * @param {string} params.region - ISO-2 jurisdiction (UK is accepted for GB)
224
- * @param {string} params.type - Registration type (e.g. VIRTUAL_LONG_CODE)
230
+ * @param {string} params.region - ISO-2 jurisdiction (any case of UK/GB/GBR/United Kingdom is accepted for GB)
231
+ * @param {string} params.type - Registration type (e.g. VIRTUAL_LONG_CODE, or ALPHANUMERIC_SENDER_ID for GB)
225
232
  * @param {string} params.subgroupId - Subgroup that will own the registration and any allocated numbers
226
233
  * @param {string} params.clientRequestId - Idempotency key (UUID)
227
234
  * @param {string[]} params.capabilities - One of the type's bundles, e.g. ["SMS"] or ["SMS", "VOICE"]
@@ -25,6 +25,36 @@ export class Shortlinks {
25
25
  return this.client(`/shortlink/redirect/${safeShortlinkId}`, { method: "GET", ...options });
26
26
  }
27
27
 
28
+ /**
29
+ * Get the recipient opt-out details behind an alphanumeric-sender opt-out link (sihou.io/o/{code})
30
+ * @async
31
+ * @roles public
32
+ * @param {Object} params - The parameters for getting the opt-out details
33
+ * @param {string} params.code - The opt-out code from the link
34
+ * @param {RequestOptions} [params.options] - Additional options for the request
35
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ code, senderName, maskedRecipient, optedOut }`
36
+ */
37
+ async getOptOut({ code, options = {} }) {
38
+ this.client._require({ code });
39
+ const safeCode = encodeURIComponent(code);
40
+ return this.client(`/shortlink/optout/${safeCode}`, { method: "GET", ...options });
41
+ }
42
+
43
+ /**
44
+ * Confirm the recipient opt-out behind an alphanumeric-sender opt-out link; idempotent
45
+ * @async
46
+ * @roles public
47
+ * @param {Object} params - The parameters for confirming the opt-out
48
+ * @param {string} params.code - The opt-out code from the link
49
+ * @param {RequestOptions} [params.options] - Additional options for the request
50
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ code, senderName, maskedRecipient, optedOut: true }`
51
+ */
52
+ async confirmOptOut({ code, options = {} }) {
53
+ this.client._require({ code });
54
+ const safeCode = encodeURIComponent(code);
55
+ return this.client(`/shortlink/optout/${safeCode}`, { method: "POST", ...options });
56
+ }
57
+
28
58
  /**
29
59
  * Get details of a shortlink by its ID, with optional filters
30
60
  * @async