@signalhouse-sms/sdk 1.11.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/SignalHouseSDK.js +5 -0
- package/src/domains/Audit.js +39 -0
- package/src/domains/Billing.js +5 -2
- package/src/domains/Brands.js +56 -1
- package/src/domains/Campaigns.js +2 -2
- package/src/domains/Messages.js +52 -1
- package/src/domains/Numbers.js +4 -3
- package/src/domains/Rcs.js +158 -24
- package/src/domains/Registrations.js +112 -8
- package/src/domains/Templates.js +2 -0
- package/src/domains/Verify.js +72 -0
- package/src/domains/Webhooks.js +9 -5
- package/types/SignalHouseSDK.d.ts +4 -0
- package/types/domains/Audit.d.ts +39 -0
- package/types/domains/Billing.d.ts +7 -1
- package/types/domains/Brands.d.ts +64 -1
- package/types/domains/Campaigns.d.ts +2 -2
- package/types/domains/Messages.d.ts +67 -1
- package/types/domains/Numbers.d.ts +4 -3
- package/types/domains/Rcs.d.ts +198 -20
- package/types/domains/Registrations.d.ts +92 -6
- package/types/domains/Templates.d.ts +2 -0
- package/types/domains/Verify.d.ts +71 -0
- package/types/domains/Webhooks.d.ts +9 -4
|
@@ -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,102 @@ 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
|
+
},
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Mark an RCS agent's requested carrier update as sent, once staff emailed it to the carrier partner (signalhouse only)
|
|
165
|
+
* @async
|
|
166
|
+
* @roles signalhouse
|
|
167
|
+
* @param {Object} params - The parameters for the update
|
|
168
|
+
* @param {string} params.registrationId - The agent's registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
169
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
170
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, as staff read it; 409 when no update is REQUESTED
|
|
171
|
+
*/
|
|
172
|
+
markCarrierUpdateSent: async ({ registrationId, options = {} }) => {
|
|
173
|
+
this.client._require({ registrationId });
|
|
174
|
+
const safeId = encodeURIComponent(registrationId);
|
|
175
|
+
return this.client(`/registration/${safeId}/carrier-update`, {
|
|
176
|
+
method: "PUT",
|
|
177
|
+
body: { status: "SENT" },
|
|
178
|
+
...options,
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Add an internal comment to a registration of any type; comments are append-only and never reach the customer (signalhouse only)
|
|
184
|
+
* @async
|
|
185
|
+
* @roles signalhouse
|
|
186
|
+
* @param {Object} params - The parameters for the comment
|
|
187
|
+
* @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
188
|
+
* @param {string} params.comment - The comment, 1 to 2,000 characters
|
|
189
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
190
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { comment, createdAt, createdBy, createdByRole }
|
|
191
|
+
*/
|
|
192
|
+
addComment: async ({ registrationId, comment, options = {} }) => {
|
|
193
|
+
this.client._require({ registrationId, comment });
|
|
194
|
+
const safeId = encodeURIComponent(registrationId);
|
|
195
|
+
return this.client(`/registration/${safeId}/comments`, {
|
|
196
|
+
method: "POST",
|
|
197
|
+
body: { comment },
|
|
198
|
+
...options,
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* List a registration's internal comments, newest first (signalhouse only)
|
|
204
|
+
* @async
|
|
205
|
+
* @roles signalhouse
|
|
206
|
+
* @param {Object} params - The parameters for the read
|
|
207
|
+
* @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
208
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
209
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { comments: [{ comment, createdAt, createdBy, createdByRole }] }
|
|
210
|
+
*/
|
|
211
|
+
getComments: async ({ registrationId, options = {} }) => {
|
|
212
|
+
this.client._require({ registrationId });
|
|
213
|
+
const safeId = encodeURIComponent(registrationId);
|
|
214
|
+
return this.client(`/registration/${safeId}/comments`, {
|
|
215
|
+
method: "GET",
|
|
216
|
+
...options,
|
|
217
|
+
});
|
|
218
|
+
},
|
|
121
219
|
};
|
|
122
220
|
}
|
|
123
221
|
}
|
|
@@ -237,7 +335,8 @@ export class Registrations {
|
|
|
237
335
|
* Submit a draft. A type Signal House reviews goes to SIGNAL_HOUSE_REVIEW; a type it does not (RCS_AGENT) goes to
|
|
238
336
|
* SUBMITTING and is filed with the provider at once. A draft that fails a requirement gets a 400 whose details carry
|
|
239
337
|
* { code: "REGISTRATION_INCOMPLETE", errors, warnings }; a second submit, or one of a registration the provider
|
|
240
|
-
* already holds, gets a 409.
|
|
338
|
+
* already holds, gets a 409. An RCS agent whose group has not finished account verification gets a 403 with code
|
|
339
|
+
* GROUP_UNVERIFIED, and one whose group is rejected a 403 with code GROUP_REJECTED.
|
|
241
340
|
* @async
|
|
242
341
|
* @roles api, admin, developer, billing, user
|
|
243
342
|
* @param {Object} params - The parameters for the submission
|
|
@@ -256,19 +355,24 @@ export class Registrations {
|
|
|
256
355
|
* are checked and the registration goes to SIGNAL_HOUSE_REVIEW, whose approval files the provider's launch request.
|
|
257
356
|
* Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
|
|
258
357
|
* carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
|
|
259
|
-
* { code: "REGISTRATION_INCOMPLETE", errors, warnings }
|
|
260
|
-
*
|
|
358
|
+
* { code: "REGISTRATION_INCOMPLETE", errors, warnings }; an RCS agent's copy-rule error carries the carrier partner's key
|
|
359
|
+
* as its `code` (for example OPT_IN_MSG_RATE_DISCL_MISSING). An RCS agent whose group has not finished account
|
|
360
|
+
* verification gets a 403 with code GROUP_UNVERIFIED, and one whose group is rejected a 403 with code GROUP_REJECTED.
|
|
361
|
+
* An RCS agent's launch request charges its launch fees: a wallet that cannot cover them gets a 402, and nothing changes. When any fee is due the request must set acknowledgeFees: true, or it gets a 400 with code FEE_ACKNOWLEDGEMENT_REQUIRED and nothing is held; a launch with nothing due needs no acknowledgement.
|
|
362
|
+
* When the agent's brand vertical is healthcare or insurance, the launch needs the protected health information (PHI) disclosure acknowledged: send acknowledgePhi: true, or the request gets a 400 REGISTRATION_INCOMPLETE whose errors name consent.phiAcknowledgement. The API records the acknowledgement as consent.phiAcknowledgement { acknowledgedAt, acknowledgedBy } from the caller; the client sends only the boolean, and an agent update cannot set it. Once recorded, a later launch request needs no new acknowledgement.
|
|
261
363
|
* @async
|
|
262
364
|
* @roles api, admin, developer, billing, user
|
|
263
365
|
* @param {Object} params - The parameters for the launch request
|
|
264
366
|
* @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
367
|
+
* @param {boolean} [params.acknowledgeFees] - Accept the fees due; required when any are
|
|
368
|
+
* @param {boolean} [params.acknowledgePhi] - Accept the PHI disclosure; required for a healthcare or insurance brand
|
|
265
369
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
266
370
|
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, now SIGNAL_HOUSE_REVIEW
|
|
267
371
|
*/
|
|
268
|
-
async launchRegistration({ registrationId, options = {} }) {
|
|
372
|
+
async launchRegistration({ registrationId, acknowledgeFees, acknowledgePhi, options = {} }) {
|
|
269
373
|
this.client._require({ registrationId });
|
|
270
374
|
const safeId = encodeURIComponent(registrationId);
|
|
271
|
-
return this.client(`/registration/${safeId}/launch`, { method: "POST", ...options });
|
|
375
|
+
return this.client(`/registration/${safeId}/launch`, { method: "POST", body: { acknowledgeFees, acknowledgePhi }, ...options });
|
|
272
376
|
}
|
|
273
377
|
|
|
274
378
|
/**
|
package/src/domains/Templates.js
CHANGED
|
@@ -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
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Carrier phone-number checks under /verify: SIM Swap and Number Verify. Every check the carrier answers is billed to
|
|
9
|
+
* the group's wallet (402 on insufficient funds); a check the carrier cannot run for the number is a 422 and is not charged.
|
|
10
|
+
*/
|
|
11
|
+
export class Verify {
|
|
12
|
+
/**
|
|
13
|
+
* Keep the JSON client every verify request goes through.
|
|
14
|
+
* @param {any} client - The JSON request client
|
|
15
|
+
* @param {boolean} [enableAdmin] - Whether admin-scoped behaviors are enabled
|
|
16
|
+
*/
|
|
17
|
+
constructor(client, enableAdmin) {
|
|
18
|
+
this.client = client;
|
|
19
|
+
this.enableAdmin = enableAdmin;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Check whether a number's SIM card changed recently, as reported by its carrier. Billed once when the check answers;
|
|
24
|
+
* 422 when the check is not available for the number (not charged)
|
|
25
|
+
* @async
|
|
26
|
+
* @roles api, admin, developer
|
|
27
|
+
* @param {Object} params - The check
|
|
28
|
+
* @param {string} params.phoneNumber - The number to check, in international format (e.g. "+12025550123")
|
|
29
|
+
* @param {number} [params.maxAge] - Lookback window in hours, 1-2400; the carrier's default when omitted
|
|
30
|
+
* @param {boolean} [params.includeSwapDate] - Also return the latest SIM change date (no extra charge; default false)
|
|
31
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
32
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, swapped, maxAge, latestSimChange?, cost }`
|
|
33
|
+
*/
|
|
34
|
+
async checkSimSwap({ phoneNumber, maxAge, includeSwapDate, options = {} }) {
|
|
35
|
+
this.client._require({ phoneNumber });
|
|
36
|
+
const body = { phoneNumber, ...(maxAge !== undefined && { maxAge }), ...(includeSwapDate !== undefined && { includeSwapDate }) };
|
|
37
|
+
return this.client(`/verify/sim-swap`, { method: "POST", body, ...options });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Start a Number Verify check. The end user's phone must open the returned `authorizationUrl` on mobile data (Wi-Fi off)
|
|
42
|
+
* within 10 minutes; the carrier then confirms whether the phone's own number matches. Read the result with
|
|
43
|
+
* getNumberVerification. Billed only when the check is answered (VERIFIED or NOT_VERIFIED)
|
|
44
|
+
* @async
|
|
45
|
+
* @roles api, admin, developer
|
|
46
|
+
* @param {Object} params - The check
|
|
47
|
+
* @param {string} params.phoneNumber - The number to verify, in international format (e.g. "+12025550123")
|
|
48
|
+
* @param {string} [params.devicePhoneNumber] - The phone's own number, sent to the carrier as a login hint
|
|
49
|
+
* @param {string} [params.redirectUrl] - An https URL the end user's browser is sent to after the check, with `?checkId=…`
|
|
50
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
51
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status: "PENDING", authorizationUrl, expiresAt }`
|
|
52
|
+
*/
|
|
53
|
+
async startNumberVerification({ phoneNumber, devicePhoneNumber, redirectUrl, options = {} }) {
|
|
54
|
+
this.client._require({ phoneNumber });
|
|
55
|
+
const body = { phoneNumber, ...(devicePhoneNumber !== undefined && { devicePhoneNumber }), ...(redirectUrl !== undefined && { redirectUrl }) };
|
|
56
|
+
return this.client(`/verify/number`, { method: "POST", body, ...options });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get a Number Verify check's status and result. A PENDING check past its expiresAt reads as EXPIRED
|
|
61
|
+
* @async
|
|
62
|
+
* @roles api, admin, developer, billing, user
|
|
63
|
+
* @param {Object} params - The lookup
|
|
64
|
+
* @param {string} params.checkId - The check ID (e.g. NVC…)
|
|
65
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
66
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status, devicePhoneNumberVerified, failureReason, createdAt, expiresAt, completedAt, cost }`
|
|
67
|
+
*/
|
|
68
|
+
async getNumberVerification({ checkId, options = {} }) {
|
|
69
|
+
this.client._require({ checkId });
|
|
70
|
+
return this.client(`/verify/number/${encodeURIComponent(checkId)}`, { method: "GET", ...options });
|
|
71
|
+
}
|
|
72
|
+
}
|
package/src/domains/Webhooks.js
CHANGED
|
@@ -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.
|
|
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
|
|
@@ -30,6 +30,8 @@ export class SignalHouseSDK {
|
|
|
30
30
|
webhooks: Webhooks;
|
|
31
31
|
voice: Voice;
|
|
32
32
|
agents: Agents;
|
|
33
|
+
audit: Audit;
|
|
34
|
+
verify: Verify;
|
|
33
35
|
/**
|
|
34
36
|
* Client for API requests
|
|
35
37
|
* @private
|
|
@@ -115,3 +117,5 @@ import { Notifications } from "./domains/Notifications.js";
|
|
|
115
117
|
import { Webhooks } from "./domains/Webhooks.js";
|
|
116
118
|
import { Voice } from "./domains/Voice.js";
|
|
117
119
|
import { Agents } from "./domains/Agents.js";
|
|
120
|
+
import { Audit } from "./domains/Audit.js";
|
|
121
|
+
import { Verify } from "./domains/Verify.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Audit domain: the staff read of who changed a registration or a message template, and what changed. Every method lives
|
|
8
|
+
* under the admin namespace, present only when the SDK is created with `enableAdmin: true`.
|
|
9
|
+
*/
|
|
10
|
+
export class Audit {
|
|
11
|
+
constructor(client: any, enableAdmin: any);
|
|
12
|
+
client: any;
|
|
13
|
+
enableAdmin: any;
|
|
14
|
+
admin: {
|
|
15
|
+
/**
|
|
16
|
+
* Get audit events, newest first: one registration's or template's, or a group's. Staff-only.
|
|
17
|
+
* @async
|
|
18
|
+
* @roles signalhouse
|
|
19
|
+
* @param {Object} params
|
|
20
|
+
* @param {("registration"|"template")} [params.entityType] - The entity type; required with entityId
|
|
21
|
+
* @param {string} [params.entityId] - The registration id or template id
|
|
22
|
+
* @param {string} [params.groupId] - The owning group; required when entityId is omitted
|
|
23
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
24
|
+
* @param {number} [params.limit] - Events per page (default 25, max 100)
|
|
25
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
26
|
+
* @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`; each event is `{ _id, occurredAt, actor: { type, userId, role }, entity: { type, id, groupId }, action, changes: [{ path, from, to }] }`
|
|
27
|
+
*/
|
|
28
|
+
getAuditEvents: ({ entityType, entityId, groupId, page, limit, options }?: {
|
|
29
|
+
entityType?: ("registration" | "template");
|
|
30
|
+
entityId?: string;
|
|
31
|
+
groupId?: string;
|
|
32
|
+
page?: number;
|
|
33
|
+
limit?: number;
|
|
34
|
+
options?: RequestOptions;
|
|
35
|
+
}) => Promise<SdkResponse<any>>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
|
|
39
|
+
export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|
|
@@ -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. A settled RCS message also carries `carrierFeeMicros`: the carrier pass-through and media surcharge it was charged
|
|
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
|
|
@@ -450,6 +490,32 @@ export class Messages {
|
|
|
450
490
|
regionScopes?: any[] | string;
|
|
451
491
|
options?: RequestOptions;
|
|
452
492
|
}): Promise<SdkResponse<any>>;
|
|
493
|
+
/**
|
|
494
|
+
* Export the group's consent ledger, newest first: one append-only record per opt-out or opt-in a recipient gave (a STOP
|
|
495
|
+
* or START keyword, or the confirmation of an opt-out link). It records only; sends do not read it.
|
|
496
|
+
* @async
|
|
497
|
+
* @roles api, admin, developer, billing, user
|
|
498
|
+
* @param {Object} params - The parameters for exporting consent records
|
|
499
|
+
* @param {string} params.groupId - The group whose records to read
|
|
500
|
+
* @param {string} [params.recipientPhoneNumber] - One handset, in any spelling; matched on its digits
|
|
501
|
+
* @param {string} [params.startDate] - Earliest occurredAt, ISO-8601; a bare date is its whole UTC day, a timestamp is bound as sent
|
|
502
|
+
* @param {string} [params.endDate] - Latest occurredAt, ISO-8601; a bare date is its whole UTC day, a timestamp is bound as sent
|
|
503
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
504
|
+
* @param {number} [params.limit] - Records per page (default 100, max 500)
|
|
505
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
506
|
+
* @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`. Each record carries groupId, subgroupId, recipientPhoneNumber (the handset),
|
|
507
|
+
* phoneNumber (the business number or RCS agent id that received it), scope `{ type: CAMPAIGN|AGENT|SUBGROUP, id }`,
|
|
508
|
+
* clearedScopes (for OPT_IN, every `{ type, id }` the START cleared; empty for OPT_OUT), action (OPT_OUT or OPT_IN), source (KEYWORD or LINK), keyword, messageType (SMS, MMS or RCS), messageId, actor `{ type: "RECIPIENT" }`, occurredAt and createdAt.
|
|
509
|
+
*/
|
|
510
|
+
getConsentRecords({ groupId, recipientPhoneNumber, startDate, endDate, page, limit, options }: {
|
|
511
|
+
groupId: string;
|
|
512
|
+
recipientPhoneNumber?: string;
|
|
513
|
+
startDate?: string;
|
|
514
|
+
endDate?: string;
|
|
515
|
+
page?: number;
|
|
516
|
+
limit?: number;
|
|
517
|
+
options?: RequestOptions;
|
|
518
|
+
}): Promise<SdkResponse<any>>;
|
|
453
519
|
/**
|
|
454
520
|
* Send an SMS message to one or more recipient phone numbers
|
|
455
521
|
*
|
|
@@ -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).
|
|
320
|
-
*
|
|
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
|