@signalhouse-sms/sdk 1.6.0 → 1.8.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.
@@ -171,7 +171,7 @@ export class Groups {
171
171
  * @roles api, admin, developer, billing
172
172
  * @param {Object} params - The parameters for updating a group
173
173
  * @param {string} params.id - The ID of the group to update
174
- * @param {Object} params.groupData - The data for the group, including required fields such as groupName.
174
+ * @param {Object} params.groupData - The data for the group, including required fields such as groupName. A group admin can set requireTwoFactor (boolean) to require 2FA for every member.
175
175
  * Optional CNP fields: cspId (string|null), defaultCnpSubgroupId (string|null)
176
176
  * @param {RequestOptions} [params.options] - Additional options for the request
177
177
  * @throws {Error} Throws an error if the id or groupData parameter is missing
@@ -182,4 +182,102 @@ export class Groups {
182
182
  const safeId = encodeURIComponent(id);
183
183
  return this.client(`/group/${safeId}`, { method: "PUT", body: groupData, ...options });
184
184
  }
185
+
186
+ /**
187
+ * Get a group's Enterprise SSO configuration: whether SSO is available, the redirect URL to register at
188
+ * the identity provider, the saved provider (never its client secret), and each claimed domain with the
189
+ * DNS TXT record that verifies it
190
+ * @async
191
+ * @roles admin
192
+ * @param {Object} params
193
+ * @param {string} params.groupId - The group
194
+ * @param {RequestOptions} [params.options] - Additional options for the request
195
+ * @returns {Promise<SdkResponse<any>>} - { groupId, available, callbackUrl, connection, domains }
196
+ */
197
+ async getSsoConfiguration({ groupId, options = {} }) {
198
+ this.client._require({ groupId });
199
+ const queryString = this.client._getQueryString({ groupId });
200
+ return this.client(`/group/sso${queryString}`, { method: "GET", ...options });
201
+ }
202
+
203
+ /**
204
+ * Create or update a group's OpenID Connect identity provider. Requires a fresh
205
+ * auth.confirmTwoFactorIdentity from the same session
206
+ * @async
207
+ * @roles admin
208
+ * @param {Object} params
209
+ * @param {string} params.groupId - The group
210
+ * @param {string} params.issuer - The provider's https issuer URL
211
+ * @param {string} params.clientId - The client ID registered at the provider
212
+ * @param {string} [params.clientSecret] - The client secret; required the first time, omit to keep the saved one
213
+ * @param {boolean} [params.enabled] - Whether sign-in through the provider is on (default true)
214
+ * @param {RequestOptions} [params.options] - Additional options for the request
215
+ * @returns {Promise<SdkResponse<any>>} - The SSO configuration
216
+ */
217
+ async saveSsoConnection({ groupId, issuer, clientId, clientSecret, enabled, options = {} }) {
218
+ this.client._require({ groupId, issuer, clientId });
219
+ return this.client(`/group/sso`, { method: "PUT", body: { groupId, issuer, clientId, clientSecret, enabled }, ...options });
220
+ }
221
+
222
+ /**
223
+ * Remove a group's identity provider and its domains, and unlink every account that signed in through it.
224
+ * Requires a fresh auth.confirmTwoFactorIdentity from the same session
225
+ * @async
226
+ * @roles admin
227
+ * @param {Object} params
228
+ * @param {string} params.groupId - The group
229
+ * @param {RequestOptions} [params.options] - Additional options for the request
230
+ * @returns {Promise<SdkResponse<any>>} - The (now empty) SSO configuration
231
+ */
232
+ async deleteSsoConnection({ groupId, options = {} }) {
233
+ this.client._require({ groupId });
234
+ const queryString = this.client._getQueryString({ groupId });
235
+ return this.client(`/group/sso${queryString}`, { method: "DELETE", ...options });
236
+ }
237
+
238
+ /**
239
+ * Claim an email domain for a group's SSO; the response includes the DNS TXT record that verifies it
240
+ * @async
241
+ * @roles admin
242
+ * @param {Object} params
243
+ * @param {string} params.groupId - The group
244
+ * @param {string} params.domain - The domain, e.g. "acme.com"
245
+ * @param {RequestOptions} [params.options] - Additional options for the request
246
+ * @returns {Promise<SdkResponse<any>>} - The SSO configuration
247
+ */
248
+ async addSsoDomain({ groupId, domain, options = {} }) {
249
+ this.client._require({ groupId, domain });
250
+ return this.client(`/group/sso/domains`, { method: "POST", body: { groupId, domain }, ...options });
251
+ }
252
+
253
+ /**
254
+ * Verify a claimed domain by its DNS TXT record
255
+ * @async
256
+ * @roles admin
257
+ * @param {Object} params
258
+ * @param {string} params.groupId - The group
259
+ * @param {string} params.domain - The claimed domain
260
+ * @param {RequestOptions} [params.options] - Additional options for the request
261
+ * @returns {Promise<SdkResponse<any>>} - The SSO configuration
262
+ */
263
+ async verifySsoDomain({ groupId, domain, options = {} }) {
264
+ this.client._require({ groupId, domain });
265
+ return this.client(`/group/sso/domains/${encodeURIComponent(domain)}/verify`, { method: "POST", body: { groupId }, ...options });
266
+ }
267
+
268
+ /**
269
+ * Remove a domain from a group's SSO
270
+ * @async
271
+ * @roles admin
272
+ * @param {Object} params
273
+ * @param {string} params.groupId - The group
274
+ * @param {string} params.domain - The domain
275
+ * @param {RequestOptions} [params.options] - Additional options for the request
276
+ * @returns {Promise<SdkResponse<any>>} - The SSO configuration
277
+ */
278
+ async removeSsoDomain({ groupId, domain, options = {} }) {
279
+ this.client._require({ groupId, domain });
280
+ const queryString = this.client._getQueryString({ groupId });
281
+ return this.client(`/group/sso/domains/${encodeURIComponent(domain)}${queryString}`, { method: "DELETE", ...options });
282
+ }
185
283
  }
@@ -140,7 +140,7 @@ export class Messages {
140
140
  * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
141
141
  * @param {string|string[]} [params.phoneNumber] - Filter analytics by the phone number involved in the messages. Accepts a single value, an array, or a comma-separated string.
142
142
  * @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
143
- * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
143
+ * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
144
144
  * @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
145
145
  * @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
146
146
  * @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.
@@ -177,7 +177,7 @@ export class Messages {
177
177
  * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
178
178
  * @param {string|string[]} [params.phoneNumber] - Filter analytics by the phone number involved in the messages. Accepts a single value, an array, or a comma-separated string.
179
179
  * @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
180
- * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
180
+ * @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
181
181
  * @param {string} [params.startDate] - ISO-8601 date or timestamp. 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, then floored to the start of its hour at either granularity, because the hourly cube is keyed by hour and a mid-hour start would drop that hour's bucket.
182
182
  * @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.
183
183
  * @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.
@@ -260,7 +260,7 @@ export class Messages {
260
260
  * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
261
261
  * @param {string|string[]} [params.phoneNumber]
262
262
  * @param {string|string[]} [params.carrier]
263
- * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
263
+ * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
264
264
  * @param {string} [params.startDate]
265
265
  * @param {string} [params.endDate]
266
266
  * @param {number} [params.page=1]
@@ -293,7 +293,7 @@ export class Messages {
293
293
  * @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations (hourly analytics only; a 400 while hourly reads are off). A phoneNumber filter takes precedence. Accepts a single value or an array.
294
294
  * @param {string|string[]} [params.phoneNumber]
295
295
  * @param {string|string[]} [params.carrier]
296
- * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
296
+ * @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
297
297
  * @param {string} [params.startDate]
298
298
  * @param {string} [params.endDate]
299
299
  * @param {number} [params.page=1]
@@ -362,7 +362,7 @@ export class Messages {
362
362
  * @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.
363
363
  * @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.
364
364
  * @param {RequestOptions} [params.options] - Additional options for the request
365
- * @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).
365
+ * @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, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
366
366
  */
367
367
  async getDncRecords({ groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds, options = {} }) {
368
368
  const filters = { groupId, subgroupId, brandId, campaignId, registrationId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, region, regionScopes, dateBounds };
@@ -7,6 +7,7 @@ import { CallLogs } from "./voice/CallLogs.js";
7
7
  import { GlobalVoiceSettings } from "./voice/GlobalVoiceSettings.js";
8
8
  import { Tokens } from "./voice/Tokens.js";
9
9
  import { Analytics } from "./voice/Analytics.js";
10
+ import { OutboundVoice } from "./voice/OutboundVoice.js";
10
11
 
11
12
  /**
12
13
  * Voice domain — wraps the Voice service (mounted under /voice on the
@@ -37,5 +38,6 @@ export class Voice {
37
38
  this.globalVoiceSettings = new GlobalVoiceSettings(client, enableAdmin);
38
39
  this.tokens = new Tokens(client, enableAdmin);
39
40
  this.analytics = new Analytics(client, enableAdmin);
41
+ this.outboundVoice = new OutboundVoice(client, enableAdmin);
40
42
  }
41
43
  }
@@ -0,0 +1,150 @@
1
+ /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
7
+ /**
8
+ * @typedef {"GROUP"|"SUBGROUP"|"NUMBER"|"TRUNK"|"SIP_PROFILE"|"WEBRTC_IDENTITY"} OutboundScopeType
9
+ */
10
+
11
+ const BASE_PATH = "/voice/api/v1/outbound-voice";
12
+
13
+ /**
14
+ * Outbound voice policy: Signal House staff switches that turn outbound calling off for a group,
15
+ * subgroup, number, SIP trunk, SIP endpoint or softphone user, plus a group's AI-outbound
16
+ * authorization. Staff only; every method lives under the hidden `admin` namespace.
17
+ * Accessed via `sdk.voice.outboundVoice.admin`.
18
+ */
19
+ export class OutboundVoice {
20
+ constructor(client, enableAdmin) {
21
+ this.client = client;
22
+ this.enableAdmin = enableAdmin;
23
+
24
+ // Hidden Admin namespace INSIDE the domain
25
+ if (enableAdmin) {
26
+ this.admin = {
27
+ /**
28
+ * Get the switches that are off in a group, and its AI-outbound authorization.
29
+ * @async
30
+ * @roles signalhouse_admin, signalhouse_api, signalhouse_user
31
+ * @param {Object} params - Request parameters.
32
+ * @param {string} params.groupId - The group to read.
33
+ * @param {RequestOptions} [params.options] - Additional options for the request.
34
+ * @throws {Error} If groupId is missing.
35
+ * @returns {Promise<SdkResponse<any>>} `{ groupId, outboundAiAuthorized, aiAuthorization, blocks: [...] }`.
36
+ */
37
+ getGroupPolicy: async ({ groupId, options = {} }) => {
38
+ this.client._require({ groupId });
39
+ return this.client(`${BASE_PATH}/groups/${encodeURIComponent(groupId)}`, { method: "GET", ...options });
40
+ },
41
+
42
+ /**
43
+ * List a group's outbound policy changes, newest first.
44
+ * @async
45
+ * @roles signalhouse_admin, signalhouse_api, signalhouse_user
46
+ * @param {Object} params - Request parameters.
47
+ * @param {string} params.groupId - The group to read.
48
+ * @param {number} [params.limit] - Most rows to return (1-200, default 50).
49
+ * @param {RequestOptions} [params.options] - Additional options for the request.
50
+ * @throws {Error} If groupId is missing.
51
+ * @returns {Promise<SdkResponse<any>>} `{ groupId, events: [...] }`.
52
+ */
53
+ listHistory: async ({ groupId, limit, options = {} }) => {
54
+ this.client._require({ groupId });
55
+ const queryString = this.client._getQueryString({ limit });
56
+ return this.client(`${BASE_PATH}/groups/${encodeURIComponent(groupId)}/history${queryString}`, { method: "GET", ...options });
57
+ },
58
+
59
+ /**
60
+ * Check whether a call with this context may go out, and which switch blocks it if not.
61
+ * @async
62
+ * @roles signalhouse_admin, signalhouse_api, signalhouse_user
63
+ * @param {Object} params - Request parameters.
64
+ * @param {string} params.groupId - The calling group.
65
+ * @param {string} [params.subgroupId] - The calling subgroup, when known.
66
+ * @param {string} [params.e164] - The caller ID, in E.164.
67
+ * @param {string} [params.sipTrunkId] - The SIP trunk the call comes from.
68
+ * @param {string} [params.sipProfileId] - The SIP endpoint the call comes from.
69
+ * @param {string} [params.webrtcIdentity] - The softphone user's requested identity.
70
+ * @param {RequestOptions} [params.options] - Additional options for the request.
71
+ * @throws {Error} If groupId is missing.
72
+ * @returns {Promise<SdkResponse<any>>} `{ allowed, blockedBy }`.
73
+ */
74
+ resolve: async ({ groupId, subgroupId, e164, sipTrunkId, sipProfileId, webrtcIdentity, options = {} }) => {
75
+ this.client._require({ groupId });
76
+ return this.client(`${BASE_PATH}/resolve`, {
77
+ method: "POST",
78
+ body: { groupId, subgroupId, e164, sipTrunkId, sipProfileId, webrtcIdentity },
79
+ ...options,
80
+ });
81
+ },
82
+
83
+ /**
84
+ * Turn outbound calling off for one scope. A scope that is already off keeps its original switch.
85
+ * @async
86
+ * @roles signalhouse_admin, signalhouse_api
87
+ * @param {Object} params - Request parameters.
88
+ * @param {string} params.groupId - The group that owns the scope.
89
+ * @param {OutboundScopeType} params.scopeType - What kind of thing is being turned off.
90
+ * @param {string} params.scopeId - The group, subgroup, number, trunk, endpoint or softphone identity.
91
+ * @param {string} params.reason - Why (3-500 characters).
92
+ * @param {RequestOptions} [params.options] - Additional options for the request.
93
+ * @throws {Error} If groupId, scopeType, scopeId or reason is missing.
94
+ * @returns {Promise<SdkResponse<any>>} `{ created, block }`.
95
+ */
96
+ block: async ({ groupId, scopeType, scopeId, reason, options = {} }) => {
97
+ this.client._require({ groupId, scopeType, scopeId, reason });
98
+ return this.client(`${BASE_PATH}/groups/${encodeURIComponent(groupId)}/blocks/${encodeURIComponent(scopeType)}/${encodeURIComponent(scopeId)}`, {
99
+ method: "PUT",
100
+ body: { reason },
101
+ ...options,
102
+ });
103
+ },
104
+
105
+ /**
106
+ * Turn outbound calling back on for one scope.
107
+ * @async
108
+ * @roles signalhouse_admin, signalhouse_api
109
+ * @param {Object} params - Request parameters.
110
+ * @param {string} params.groupId - The group that owns the scope.
111
+ * @param {OutboundScopeType} params.scopeType - What kind of thing is being turned on.
112
+ * @param {string} params.scopeId - The switch's scope id.
113
+ * @param {string} [params.reason] - Optional note for the history.
114
+ * @param {RequestOptions} [params.options] - Additional options for the request.
115
+ * @throws {Error} If groupId, scopeType or scopeId is missing.
116
+ * @returns {Promise<SdkResponse<any>>} `{ removed, block }`.
117
+ */
118
+ unblock: async ({ groupId, scopeType, scopeId, reason, options = {} }) => {
119
+ this.client._require({ groupId, scopeType, scopeId });
120
+ return this.client(`${BASE_PATH}/groups/${encodeURIComponent(groupId)}/blocks/${encodeURIComponent(scopeType)}/${encodeURIComponent(scopeId)}`, {
121
+ method: "DELETE",
122
+ ...(reason ? { body: { reason } } : {}),
123
+ ...options,
124
+ });
125
+ },
126
+
127
+ /**
128
+ * Set or clear a group's authorization to place outbound AI-agent calls.
129
+ * @async
130
+ * @roles signalhouse_admin, signalhouse_api
131
+ * @param {Object} params - Request parameters.
132
+ * @param {string} params.groupId - The group to change.
133
+ * @param {boolean} params.authorized - The new value.
134
+ * @param {string} params.reason - Why (3-500 characters).
135
+ * @param {RequestOptions} [params.options] - Additional options for the request.
136
+ * @throws {Error} If groupId, authorized or reason is missing.
137
+ * @returns {Promise<SdkResponse<any>>} `{ groupId, outboundAiAuthorized, changed }`.
138
+ */
139
+ setAiAuthorization: async ({ groupId, authorized, reason, options = {} }) => {
140
+ this.client._require({ groupId, authorized, reason });
141
+ return this.client(`${BASE_PATH}/groups/${encodeURIComponent(groupId)}/ai-authorization`, {
142
+ method: "PUT",
143
+ body: { authorized, reason },
144
+ ...options,
145
+ });
146
+ },
147
+ };
148
+ }
149
+ }
150
+ }
@@ -113,7 +113,7 @@
113
113
  * @property {string} inboundText - The contact message the agent was answering.
114
114
  * @property {string} draftText - The reply as the agent wrote it.
115
115
  * @property {string|null} sentText - The text actually sent; differs from draftText when edited.
116
- * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
116
+ * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback", "guardrail" or "quiet_hours" (an auto-pilot reply written between 9 pm and 9 am in the contact's time zone), or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
117
117
  * @property {string} status - "pending", "sending", "sent", "rejected" or "failed" (the send path accepted nothing, e.g. the contact opted out).
118
118
  * @property {string|null} decidedBy - The user who approved or rejected it.
119
119
  * @property {string|null} decidedAt - When it was approved or rejected.
@@ -1343,7 +1343,7 @@ export type AgentReplyDraft = {
1343
1343
  */
1344
1344
  sentText: string | null;
1345
1345
  /**
1346
- * - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
1346
+ * - Why it was held: "review_mode", "escalation", "fallback", "guardrail" or "quiet_hours" (an auto-pilot reply written between 9 pm and 9 am in the contact's time zone), or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
1347
1347
  */
1348
1348
  reason: string;
1349
1349
  /**