@unboundcx/sdk 4.8.12 → 4.8.14

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": "@unboundcx/sdk",
3
- "version": "4.8.12",
3
+ "version": "4.8.14",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/services/chat.js CHANGED
@@ -2,7 +2,8 @@ import { internalRequest } from '../base.js';
2
2
  /**
3
3
  * ChatService — channels, DMs, membership, unreads, DND, messages, search,
4
4
  * webhooks, card actions, reports, admin review, admin export, record feeds,
5
- * channel meet, push devices, and notifyLevel.
5
+ * channel meet, threads, bots, group default channels, push devices, and
6
+ * notifyLevel.
6
7
  * Backed by /chat/* on app1-api (checkApiAuth). Incoming webhook POST
7
8
  * (HMAC) is external and is not an SDK method.
8
9
  */
@@ -224,7 +225,8 @@ export class ChatService {
224
225
  }
225
226
 
226
227
  /**
227
- * Find-or-create a 1:1 or group DM.
228
+ * Find-or-create a 1:1, self ("You"), or group DM.
229
+ * Pass `userIds: []` (or only the caller) for the You channel.
228
230
  * @param {Object} params
229
231
  * @param {string[]} params.userIds
230
232
  * @returns {Promise<Object>}
@@ -387,6 +389,8 @@ export class ChatService {
387
389
  * @param {string} [params.threadRootId]
388
390
  * @param {boolean} [params.alsoSendToChannel]
389
391
  * @param {string[]} [params.storageIds]
392
+ * @param {string[]} [params.tools]
393
+ * @param {Object} [params.toolConfig]
390
394
  * @returns {Promise<Object>} Created message
391
395
  */
392
396
  async sendMessage(
@@ -398,6 +402,8 @@ export class ChatService {
398
402
  storageIds,
399
403
  suppressUnfurlUrls,
400
404
  unfurls,
405
+ tools,
406
+ toolConfig,
401
407
  } = {},
402
408
  ) {
403
409
  this.sdk.validateParams(
@@ -409,6 +415,8 @@ export class ChatService {
409
415
  storageIds,
410
416
  suppressUnfurlUrls,
411
417
  unfurls,
418
+ tools,
419
+ toolConfig,
412
420
  },
413
421
  {
414
422
  channelId: { type: 'string', required: true },
@@ -418,6 +426,8 @@ export class ChatService {
418
426
  storageIds: { type: 'array', required: false },
419
427
  suppressUnfurlUrls: { type: 'array', required: false },
420
428
  unfurls: { type: 'array', required: false },
429
+ tools: { type: 'array', required: false },
430
+ toolConfig: { type: 'object', required: false },
421
431
  },
422
432
  );
423
433
 
@@ -431,6 +441,8 @@ export class ChatService {
431
441
  body.suppressUnfurlUrls = suppressUnfurlUrls;
432
442
  }
433
443
  if (unfurls !== undefined) body.unfurls = unfurls;
444
+ if (tools !== undefined) body.tools = tools;
445
+ if (toolConfig !== undefined) body.toolConfig = toolConfig;
434
446
 
435
447
  return internalRequest(this.sdk, `/chat/channels/${channelId}/messages`, 'POST', {
436
448
  body,
@@ -1034,6 +1046,235 @@ export class ChatService {
1034
1046
  return internalRequest(this.sdk, '/chat/mentions', 'GET', { query });
1035
1047
  }
1036
1048
 
1049
+ /**
1050
+ * List thread roots the caller participates in.
1051
+ * @param {Object} [params]
1052
+ * @param {'public'|'private'|'dm'|'group_dm'|'record'} [params.kind]
1053
+ * @param {number} [params.limit]
1054
+ * @returns {Promise<Object>}
1055
+ */
1056
+ async listThreads({ kind, limit } = {}) {
1057
+ const query = {};
1058
+ if (kind) query.kind = kind;
1059
+ if (limit != null) query.limit = limit;
1060
+ return internalRequest(this.sdk, '/chat/threads', 'GET', { query });
1061
+ }
1062
+
1063
+ /**
1064
+ * List default channels for a group (auto-join on membership).
1065
+ * @param {string} groupId
1066
+ * @returns {Promise<Object>}
1067
+ */
1068
+ async getGroupDefaultChannels(groupId) {
1069
+ this.sdk.validateParams(
1070
+ { groupId },
1071
+ { groupId: { type: 'string', required: true } },
1072
+ );
1073
+ return internalRequest(
1074
+ this.sdk,
1075
+ `/chat/groups/${groupId}/default-channels`,
1076
+ 'GET',
1077
+ );
1078
+ }
1079
+
1080
+ /**
1081
+ * Replace default channels for a group.
1082
+ * @param {string} groupId
1083
+ * @param {Object} [params]
1084
+ * @param {string[]} [params.channelIds]
1085
+ * @returns {Promise<Object>}
1086
+ */
1087
+ async setGroupDefaultChannels(groupId, { channelIds } = {}) {
1088
+ this.sdk.validateParams(
1089
+ { groupId, channelIds },
1090
+ {
1091
+ groupId: { type: 'string', required: true },
1092
+ channelIds: { type: 'array', required: false },
1093
+ },
1094
+ );
1095
+ return internalRequest(
1096
+ this.sdk,
1097
+ `/chat/groups/${groupId}/default-channels`,
1098
+ 'PUT',
1099
+ { body: { channelIds } },
1100
+ );
1101
+ }
1102
+
1103
+ /**
1104
+ * Create a Meet/Call room for a channel.
1105
+ * @param {string} channelId
1106
+ * @returns {Promise<Object>}
1107
+ */
1108
+ async createChannelMeet(channelId) {
1109
+ this.sdk.validateParams(
1110
+ { channelId },
1111
+ { channelId: { type: 'string', required: true } },
1112
+ );
1113
+ return internalRequest(
1114
+ this.sdk,
1115
+ `/chat/channels/${channelId}/meet`,
1116
+ 'POST',
1117
+ { body: {} },
1118
+ );
1119
+ }
1120
+
1121
+ /**
1122
+ * Update a channel Meet/Call room.
1123
+ * @param {string} channelId
1124
+ * @param {Object} [patch]
1125
+ * @param {string} [patch.slug]
1126
+ * @param {string} [patch.password]
1127
+ * @param {boolean} [patch.guestsCanStart]
1128
+ * @param {boolean} [patch.startRecordingOn]
1129
+ * @param {boolean} [patch.startTranscribingOn]
1130
+ * @param {number} [patch.endMeetingWithoutHostTimeLimit]
1131
+ * @returns {Promise<Object>}
1132
+ */
1133
+ async updateChannelMeet(channelId, patch = {}) {
1134
+ this.sdk.validateParams(
1135
+ { channelId },
1136
+ { channelId: { type: 'string', required: true } },
1137
+ );
1138
+ const body = {};
1139
+ for (const key of [
1140
+ 'slug',
1141
+ 'password',
1142
+ 'guestsCanStart',
1143
+ 'startRecordingOn',
1144
+ 'startTranscribingOn',
1145
+ 'endMeetingWithoutHostTimeLimit',
1146
+ ]) {
1147
+ if (patch[key] !== undefined) body[key] = patch[key];
1148
+ }
1149
+ return internalRequest(
1150
+ this.sdk,
1151
+ `/chat/channels/${channelId}/meet`,
1152
+ 'PATCH',
1153
+ { body },
1154
+ );
1155
+ }
1156
+
1157
+ /**
1158
+ * Check whether a Meet slug is available for a channel.
1159
+ * @param {string} channelId
1160
+ * @param {string} slug
1161
+ * @returns {Promise<Object>}
1162
+ */
1163
+ async checkChannelMeetSlug(channelId, slug) {
1164
+ this.sdk.validateParams(
1165
+ { channelId, slug },
1166
+ {
1167
+ channelId: { type: 'string', required: true },
1168
+ slug: { type: 'string', required: true },
1169
+ },
1170
+ );
1171
+ return internalRequest(
1172
+ this.sdk,
1173
+ `/chat/channels/${channelId}/meet/slug-available`,
1174
+ 'GET',
1175
+ { query: { slug } },
1176
+ );
1177
+ }
1178
+
1179
+ /**
1180
+ * Regenerate the Meet room password for a channel.
1181
+ * @param {string} channelId
1182
+ * @returns {Promise<Object>}
1183
+ */
1184
+ async regenerateChannelMeetPassword(channelId) {
1185
+ this.sdk.validateParams(
1186
+ { channelId },
1187
+ { channelId: { type: 'string', required: true } },
1188
+ );
1189
+ return internalRequest(
1190
+ this.sdk,
1191
+ `/chat/channels/${channelId}/meet/regenerate-password`,
1192
+ 'POST',
1193
+ { body: {} },
1194
+ );
1195
+ }
1196
+
1197
+ /**
1198
+ * List chat bots for the account.
1199
+ * @returns {Promise<Object>}
1200
+ */
1201
+ async listBots() {
1202
+ return internalRequest(this.sdk, '/chat/bots', 'GET');
1203
+ }
1204
+
1205
+ /**
1206
+ * Update a chat bot.
1207
+ * @param {string} id
1208
+ * @param {Object} [params]
1209
+ * @param {string} [params.name]
1210
+ * @returns {Promise<Object>}
1211
+ */
1212
+ async updateBot(id, { name } = {}) {
1213
+ this.sdk.validateParams(
1214
+ { id, name },
1215
+ {
1216
+ id: { type: 'string', required: true },
1217
+ name: { type: 'string', required: false },
1218
+ },
1219
+ );
1220
+ return internalRequest(this.sdk, `/chat/bots/${id}`, 'PATCH', {
1221
+ body: { name },
1222
+ });
1223
+ }
1224
+
1225
+ /**
1226
+ * Get bot memory for a channel.
1227
+ * @param {string} channelId
1228
+ * @returns {Promise<Object>}
1229
+ */
1230
+ async getBotMemory(channelId) {
1231
+ this.sdk.validateParams(
1232
+ { channelId },
1233
+ { channelId: { type: 'string', required: true } },
1234
+ );
1235
+ return internalRequest(
1236
+ this.sdk,
1237
+ `/chat/channels/${channelId}/bot-memory`,
1238
+ 'GET',
1239
+ );
1240
+ }
1241
+
1242
+ /**
1243
+ * Reset bot memory for a channel.
1244
+ * @param {string} channelId
1245
+ * @returns {Promise<Object>}
1246
+ */
1247
+ async resetBotMemory(channelId) {
1248
+ this.sdk.validateParams(
1249
+ { channelId },
1250
+ { channelId: { type: 'string', required: true } },
1251
+ );
1252
+ return internalRequest(
1253
+ this.sdk,
1254
+ `/chat/channels/${channelId}/bot-memory/reset`,
1255
+ 'POST',
1256
+ { body: {} },
1257
+ );
1258
+ }
1259
+
1260
+ /**
1261
+ * Compact bot memory for a channel.
1262
+ * @param {string} channelId
1263
+ * @returns {Promise<Object>}
1264
+ */
1265
+ async compactBotMemory(channelId) {
1266
+ this.sdk.validateParams(
1267
+ { channelId },
1268
+ { channelId: { type: 'string', required: true } },
1269
+ );
1270
+ return internalRequest(
1271
+ this.sdk,
1272
+ `/chat/channels/${channelId}/bot-memory/compact`,
1273
+ 'POST',
1274
+ { body: {} },
1275
+ );
1276
+ }
1277
+
1037
1278
  async listAdminChannels(query) {
1038
1279
  return this.adminListChannels(query);
1039
1280
  }
package/services/fax.js CHANGED
@@ -85,6 +85,7 @@ export class FaxService {
85
85
  * @param {string} [options.resolution] - Fax resolution (defaults to mailbox resolution)
86
86
  * @param {boolean} [options.ecm] - Enable Error Correction Mode (default: true)
87
87
  * @param {number} [options.timeout] - Dial timeout in seconds (defaults to mailbox dialTimeout)
88
+ * @param {string} [options.relatedId] - Record (e.g. engagement/task) id; server posts a fax card into that record's activity feed
88
89
  * @returns {Promise<Object>} Send result
89
90
  * @returns {string} result.id - The fax document ID
90
91
  * @returns {string} result.status - 'sending' on success, 'failed' on NATS error
@@ -131,6 +132,7 @@ export class FaxService {
131
132
  resolution,
132
133
  ecm,
133
134
  timeout,
135
+ relatedId,
134
136
  }) {
135
137
  this.sdk.validateParams(
136
138
  { faxMailboxId, toNumber, fromNumber, coverStorageId, paperSize },
@@ -166,6 +168,7 @@ export class FaxService {
166
168
  resolution,
167
169
  ecm,
168
170
  timeout,
171
+ relatedId,
169
172
  },
170
173
  };
171
174