@unboundcx/sdk 4.8.11 → 4.8.13

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/index.js CHANGED
@@ -30,7 +30,7 @@ import { FaxService } from './services/fax.js';
30
30
  import { DocumentsService } from './services/documents.js';
31
31
  import { PermissionsService } from './services/permissions.js';
32
32
  import { TriggersService } from './services/triggers.js';
33
- import { InboxService } from './services/inbox.js';
33
+ import { RecentsService } from './services/recents.js';
34
34
  import { SearchService } from './services/search.js';
35
35
  import { DirectoryService } from './services/directory.js';
36
36
  import { ChatService } from './services/chat.js';
@@ -106,7 +106,7 @@ class UnboundSDK extends BaseSDK {
106
106
  this.documents = new DocumentsService(this);
107
107
  this.permissions = new PermissionsService(this);
108
108
  this.triggers = new TriggersService(this);
109
- this.inbox = new InboxService(this);
109
+ this.recents = new RecentsService(this);
110
110
  this.search = new SearchService(this);
111
111
  this.directory = new DirectoryService(this);
112
112
  this.chat = new ChatService(this);
@@ -291,7 +291,7 @@ export { WorkerService } from './services/taskRouter/WorkerService.js';
291
291
  export { KnowledgeBaseService } from './services/knowledgeBase.js';
292
292
  export { FaxService } from './services/fax.js';
293
293
  export { PermissionsService } from './services/permissions.js';
294
- export { InboxService } from './services/inbox.js';
294
+ export { RecentsService } from './services/recents.js';
295
295
  export { SearchService } from './services/search.js';
296
296
  export { DirectoryService } from './services/directory.js';
297
297
  export { ChatService } from './services/chat.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.8.11",
3
+ "version": "4.8.13",
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
  */
@@ -77,14 +78,15 @@ export class ChatService {
77
78
  * @param {Object} [params.settings]
78
79
  * @returns {Promise<Object>}
79
80
  */
80
- async updateChannel(id, { name, topic, settings } = {}) {
81
+ async updateChannel(id, { name, topic, settings, kind } = {}) {
81
82
  this.sdk.validateParams(
82
- { id, name, topic, settings },
83
+ { id, name, topic, settings, kind },
83
84
  {
84
85
  id: { type: 'string', required: true },
85
86
  name: { type: 'string', required: false },
86
87
  topic: { type: 'string', required: false },
87
88
  settings: { type: 'object', required: false },
89
+ kind: { type: 'string', required: false },
88
90
  },
89
91
  );
90
92
 
@@ -92,6 +94,7 @@ export class ChatService {
92
94
  if (name !== undefined) body.name = name;
93
95
  if (topic !== undefined) body.topic = topic;
94
96
  if (settings !== undefined) body.settings = settings;
97
+ if (kind !== undefined) body.kind = kind;
95
98
 
96
99
  return internalRequest(this.sdk, `/chat/channels/${id}`, 'PATCH', { body });
97
100
  }
@@ -265,6 +268,30 @@ export class ChatService {
265
268
  return internalRequest(this.sdk, '/chat/dnd', 'PATCH', { body: { enabled } });
266
269
  }
267
270
 
271
+ /**
272
+ * Favorite reaction emojis for the current user.
273
+ * @returns {Promise<Object>}
274
+ */
275
+ async getEmojiFavorites() {
276
+ return internalRequest(this.sdk, '/chat/emoji-favorites', 'GET');
277
+ }
278
+
279
+ /**
280
+ * Replace the caller's favorite reaction emojis.
281
+ * @param {Object} params
282
+ * @param {string[]} params.emojis
283
+ * @returns {Promise<Object>}
284
+ */
285
+ async setEmojiFavorites({ emojis } = {}) {
286
+ this.sdk.validateParams(
287
+ { emojis },
288
+ { emojis: { type: 'array', required: true } },
289
+ );
290
+ return internalRequest(this.sdk, '/chat/emoji-favorites', 'PATCH', {
291
+ body: { emojis },
292
+ });
293
+ }
294
+
268
295
  /**
269
296
  * Advance the read watermark and recompute unread counters.
270
297
  * @param {string} channelId
@@ -361,20 +388,45 @@ export class ChatService {
361
388
  * @param {string} [params.threadRootId]
362
389
  * @param {boolean} [params.alsoSendToChannel]
363
390
  * @param {string[]} [params.storageIds]
391
+ * @param {string[]} [params.tools]
392
+ * @param {Object} [params.toolConfig]
364
393
  * @returns {Promise<Object>} Created message
365
394
  */
366
395
  async sendMessage(
367
396
  channelId,
368
- { message, threadRootId, alsoSendToChannel, storageIds } = {},
397
+ {
398
+ message,
399
+ threadRootId,
400
+ alsoSendToChannel,
401
+ storageIds,
402
+ suppressUnfurlUrls,
403
+ unfurls,
404
+ tools,
405
+ toolConfig,
406
+ } = {},
369
407
  ) {
370
408
  this.sdk.validateParams(
371
- { channelId, message, threadRootId, alsoSendToChannel, storageIds },
409
+ {
410
+ channelId,
411
+ message,
412
+ threadRootId,
413
+ alsoSendToChannel,
414
+ storageIds,
415
+ suppressUnfurlUrls,
416
+ unfurls,
417
+ tools,
418
+ toolConfig,
419
+ },
372
420
  {
373
421
  channelId: { type: 'string', required: true },
374
422
  message: { type: 'object', required: true },
375
423
  threadRootId: { type: 'string', required: false },
376
424
  alsoSendToChannel: { type: 'boolean', required: false },
377
425
  storageIds: { type: 'array', required: false },
426
+ suppressUnfurlUrls: { type: 'array', required: false },
427
+ unfurls: { type: 'array', required: false },
428
+ tools: { type: 'array', required: false },
429
+ toolConfig: { type: 'object', required: false },
378
430
  },
379
431
  );
380
432
 
@@ -384,6 +436,12 @@ export class ChatService {
384
436
  body.alsoSendToChannel = alsoSendToChannel;
385
437
  }
386
438
  if (storageIds !== undefined) body.storageIds = storageIds;
439
+ if (suppressUnfurlUrls !== undefined) {
440
+ body.suppressUnfurlUrls = suppressUnfurlUrls;
441
+ }
442
+ if (unfurls !== undefined) body.unfurls = unfurls;
443
+ if (tools !== undefined) body.tools = tools;
444
+ if (toolConfig !== undefined) body.toolConfig = toolConfig;
387
445
 
388
446
  return internalRequest(this.sdk, `/chat/channels/${channelId}/messages`, 'POST', {
389
447
  body,
@@ -410,6 +468,44 @@ export class ChatService {
410
468
  });
411
469
  }
412
470
 
471
+ /**
472
+ * Fetch Open Graph data for a URL (composer preview).
473
+ * @param {Object} params
474
+ * @param {string} params.url
475
+ * @returns {Promise<Object>}
476
+ */
477
+ async previewLink({ url } = {}) {
478
+ this.sdk.validateParams({ url }, { url: { type: 'string', required: true } });
479
+ return internalRequest(
480
+ this.sdk,
481
+ `/chat/link-preview?url=${encodeURIComponent(url)}`,
482
+ 'GET',
483
+ );
484
+ }
485
+
486
+ /**
487
+ * Hide a link preview on a message.
488
+ * @param {string} id
489
+ * @param {Object} params
490
+ * @param {string} params.url
491
+ * @returns {Promise<Object>}
492
+ */
493
+ async hideUnfurl(id, { url } = {}) {
494
+ this.sdk.validateParams(
495
+ { id, url },
496
+ {
497
+ id: { type: 'string', required: true },
498
+ url: { type: 'string', required: true },
499
+ },
500
+ );
501
+ return internalRequest(
502
+ this.sdk,
503
+ `/chat/messages/${id}/unfurls/hide`,
504
+ 'POST',
505
+ { body: { url } },
506
+ );
507
+ }
508
+
413
509
  /**
414
510
  * Delete a message (tombstone).
415
511
  * @param {string} id
@@ -895,6 +991,289 @@ export class ChatService {
895
991
  return internalRequest(this.sdk, `/chat/pins/${id}`, 'DELETE');
896
992
  }
897
993
 
994
+ /**
995
+ * Pin a message to the top of a channel/feed.
996
+ * @param {string} channelId
997
+ * @param {Object} params
998
+ * @param {string} params.messageId
999
+ * @returns {Promise<Object>}
1000
+ */
1001
+ async pinMessage(channelId, { messageId } = {}) {
1002
+ this.sdk.validateParams(
1003
+ { channelId, messageId },
1004
+ {
1005
+ channelId: { type: 'string', required: true },
1006
+ messageId: { type: 'string', required: true },
1007
+ },
1008
+ );
1009
+ return internalRequest(
1010
+ this.sdk,
1011
+ `/chat/channels/${channelId}/pinned-message`,
1012
+ 'PUT',
1013
+ { body: { messageId } },
1014
+ );
1015
+ }
1016
+
1017
+ /**
1018
+ * Clear the pinned message on a channel/feed.
1019
+ * @param {string} channelId
1020
+ * @returns {Promise<Object>}
1021
+ */
1022
+ async unpinMessage(channelId) {
1023
+ this.sdk.validateParams(
1024
+ { channelId },
1025
+ { channelId: { type: 'string', required: true } },
1026
+ );
1027
+ return internalRequest(
1028
+ this.sdk,
1029
+ `/chat/channels/${channelId}/pinned-message`,
1030
+ 'DELETE',
1031
+ );
1032
+ }
1033
+
1034
+ /**
1035
+ * List messages that mention the caller.
1036
+ * @param {Object} [params]
1037
+ * @param {'public'|'private'|'dm'|'group_dm'|'record'} [params.kind]
1038
+ * @param {number} [params.limit]
1039
+ * @returns {Promise<Object>}
1040
+ */
1041
+ async listMentions({ kind, limit } = {}) {
1042
+ const query = {};
1043
+ if (kind) query.kind = kind;
1044
+ if (limit != null) query.limit = limit;
1045
+ return internalRequest(this.sdk, '/chat/mentions', 'GET', { query });
1046
+ }
1047
+
1048
+ /**
1049
+ * List thread roots the caller participates in.
1050
+ * @param {Object} [params]
1051
+ * @param {'public'|'private'|'dm'|'group_dm'|'record'} [params.kind]
1052
+ * @param {number} [params.limit]
1053
+ * @returns {Promise<Object>}
1054
+ */
1055
+ async listThreads({ kind, limit } = {}) {
1056
+ const query = {};
1057
+ if (kind) query.kind = kind;
1058
+ if (limit != null) query.limit = limit;
1059
+ return internalRequest(this.sdk, '/chat/threads', 'GET', { query });
1060
+ }
1061
+
1062
+ /**
1063
+ * List default channels for a group (auto-join on membership).
1064
+ * @param {string} groupId
1065
+ * @returns {Promise<Object>}
1066
+ */
1067
+ async getGroupDefaultChannels(groupId) {
1068
+ this.sdk.validateParams(
1069
+ { groupId },
1070
+ { groupId: { type: 'string', required: true } },
1071
+ );
1072
+ return internalRequest(
1073
+ this.sdk,
1074
+ `/chat/groups/${groupId}/default-channels`,
1075
+ 'GET',
1076
+ );
1077
+ }
1078
+
1079
+ /**
1080
+ * Replace default channels for a group.
1081
+ * @param {string} groupId
1082
+ * @param {Object} [params]
1083
+ * @param {string[]} [params.channelIds]
1084
+ * @returns {Promise<Object>}
1085
+ */
1086
+ async setGroupDefaultChannels(groupId, { channelIds } = {}) {
1087
+ this.sdk.validateParams(
1088
+ { groupId, channelIds },
1089
+ {
1090
+ groupId: { type: 'string', required: true },
1091
+ channelIds: { type: 'array', required: false },
1092
+ },
1093
+ );
1094
+ return internalRequest(
1095
+ this.sdk,
1096
+ `/chat/groups/${groupId}/default-channels`,
1097
+ 'PUT',
1098
+ { body: { channelIds } },
1099
+ );
1100
+ }
1101
+
1102
+ /**
1103
+ * Create a Meet/Call room for a channel.
1104
+ * @param {string} channelId
1105
+ * @returns {Promise<Object>}
1106
+ */
1107
+ async createChannelMeet(channelId) {
1108
+ this.sdk.validateParams(
1109
+ { channelId },
1110
+ { channelId: { type: 'string', required: true } },
1111
+ );
1112
+ return internalRequest(
1113
+ this.sdk,
1114
+ `/chat/channels/${channelId}/meet`,
1115
+ 'POST',
1116
+ { body: {} },
1117
+ );
1118
+ }
1119
+
1120
+ /**
1121
+ * Update a channel Meet/Call room.
1122
+ * @param {string} channelId
1123
+ * @param {Object} [patch]
1124
+ * @param {string} [patch.slug]
1125
+ * @param {string} [patch.password]
1126
+ * @param {boolean} [patch.guestsCanStart]
1127
+ * @param {boolean} [patch.startRecordingOn]
1128
+ * @param {boolean} [patch.startTranscribingOn]
1129
+ * @param {number} [patch.endMeetingWithoutHostTimeLimit]
1130
+ * @returns {Promise<Object>}
1131
+ */
1132
+ async updateChannelMeet(channelId, patch = {}) {
1133
+ this.sdk.validateParams(
1134
+ { channelId },
1135
+ { channelId: { type: 'string', required: true } },
1136
+ );
1137
+ const body = {};
1138
+ for (const key of [
1139
+ 'slug',
1140
+ 'password',
1141
+ 'guestsCanStart',
1142
+ 'startRecordingOn',
1143
+ 'startTranscribingOn',
1144
+ 'endMeetingWithoutHostTimeLimit',
1145
+ ]) {
1146
+ if (patch[key] !== undefined) body[key] = patch[key];
1147
+ }
1148
+ return internalRequest(
1149
+ this.sdk,
1150
+ `/chat/channels/${channelId}/meet`,
1151
+ 'PATCH',
1152
+ { body },
1153
+ );
1154
+ }
1155
+
1156
+ /**
1157
+ * Check whether a Meet slug is available for a channel.
1158
+ * @param {string} channelId
1159
+ * @param {string} slug
1160
+ * @returns {Promise<Object>}
1161
+ */
1162
+ async checkChannelMeetSlug(channelId, slug) {
1163
+ this.sdk.validateParams(
1164
+ { channelId, slug },
1165
+ {
1166
+ channelId: { type: 'string', required: true },
1167
+ slug: { type: 'string', required: true },
1168
+ },
1169
+ );
1170
+ return internalRequest(
1171
+ this.sdk,
1172
+ `/chat/channels/${channelId}/meet/slug-available`,
1173
+ 'GET',
1174
+ { query: { slug } },
1175
+ );
1176
+ }
1177
+
1178
+ /**
1179
+ * Regenerate the Meet room password for a channel.
1180
+ * @param {string} channelId
1181
+ * @returns {Promise<Object>}
1182
+ */
1183
+ async regenerateChannelMeetPassword(channelId) {
1184
+ this.sdk.validateParams(
1185
+ { channelId },
1186
+ { channelId: { type: 'string', required: true } },
1187
+ );
1188
+ return internalRequest(
1189
+ this.sdk,
1190
+ `/chat/channels/${channelId}/meet/regenerate-password`,
1191
+ 'POST',
1192
+ { body: {} },
1193
+ );
1194
+ }
1195
+
1196
+ /**
1197
+ * List chat bots for the account.
1198
+ * @returns {Promise<Object>}
1199
+ */
1200
+ async listBots() {
1201
+ return internalRequest(this.sdk, '/chat/bots', 'GET');
1202
+ }
1203
+
1204
+ /**
1205
+ * Update a chat bot.
1206
+ * @param {string} id
1207
+ * @param {Object} [params]
1208
+ * @param {string} [params.name]
1209
+ * @returns {Promise<Object>}
1210
+ */
1211
+ async updateBot(id, { name } = {}) {
1212
+ this.sdk.validateParams(
1213
+ { id, name },
1214
+ {
1215
+ id: { type: 'string', required: true },
1216
+ name: { type: 'string', required: false },
1217
+ },
1218
+ );
1219
+ return internalRequest(this.sdk, `/chat/bots/${id}`, 'PATCH', {
1220
+ body: { name },
1221
+ });
1222
+ }
1223
+
1224
+ /**
1225
+ * Get bot memory for a channel.
1226
+ * @param {string} channelId
1227
+ * @returns {Promise<Object>}
1228
+ */
1229
+ async getBotMemory(channelId) {
1230
+ this.sdk.validateParams(
1231
+ { channelId },
1232
+ { channelId: { type: 'string', required: true } },
1233
+ );
1234
+ return internalRequest(
1235
+ this.sdk,
1236
+ `/chat/channels/${channelId}/bot-memory`,
1237
+ 'GET',
1238
+ );
1239
+ }
1240
+
1241
+ /**
1242
+ * Reset bot memory for a channel.
1243
+ * @param {string} channelId
1244
+ * @returns {Promise<Object>}
1245
+ */
1246
+ async resetBotMemory(channelId) {
1247
+ this.sdk.validateParams(
1248
+ { channelId },
1249
+ { channelId: { type: 'string', required: true } },
1250
+ );
1251
+ return internalRequest(
1252
+ this.sdk,
1253
+ `/chat/channels/${channelId}/bot-memory/reset`,
1254
+ 'POST',
1255
+ { body: {} },
1256
+ );
1257
+ }
1258
+
1259
+ /**
1260
+ * Compact bot memory for a channel.
1261
+ * @param {string} channelId
1262
+ * @returns {Promise<Object>}
1263
+ */
1264
+ async compactBotMemory(channelId) {
1265
+ this.sdk.validateParams(
1266
+ { channelId },
1267
+ { channelId: { type: 'string', required: true } },
1268
+ );
1269
+ return internalRequest(
1270
+ this.sdk,
1271
+ `/chat/channels/${channelId}/bot-memory/compact`,
1272
+ 'POST',
1273
+ { body: {} },
1274
+ );
1275
+ }
1276
+
898
1277
  async listAdminChannels(query) {
899
1278
  return this.adminListChannels(query);
900
1279
  }
@@ -1,11 +1,11 @@
1
1
  import { internalRequest } from '../base.js';
2
- export class InboxService {
2
+ export class RecentsService {
3
3
  constructor(sdk) {
4
4
  this.sdk = sdk;
5
5
  }
6
6
 
7
7
  /**
8
- * List unified inbox items merged across call/voicemail/fax/sms sources,
8
+ * List unified recents items merged across call/voicemail/fax/sms sources,
9
9
  * sorted descending by timestamp.
10
10
  *
11
11
  * @param {Object} params
@@ -93,7 +93,7 @@ export class InboxService {
93
93
 
94
94
  const params = { query };
95
95
 
96
- const result = await internalRequest(this.sdk, '/inbox', 'GET', params);
96
+ const result = await internalRequest(this.sdk, '/recents', 'GET', params);
97
97
  return result;
98
98
  }
99
99
 
@@ -125,18 +125,18 @@ export class InboxService {
125
125
 
126
126
  const params = { query };
127
127
 
128
- const result = await internalRequest(this.sdk, '/inbox/smsThread', 'GET', params);
128
+ const result = await internalRequest(this.sdk, '/recents/smsThread', 'GET', params);
129
129
  return result;
130
130
  }
131
131
 
132
132
  /**
133
- * Fetch inbox stats (calls/talk time/missed/unread voicemail/meetings) for
133
+ * Fetch recents stats (calls/talk time/missed/unread voicemail/meetings) for
134
134
  * the current user.
135
135
  *
136
136
  * @returns {Promise<{callsToday: number, talkTimeSeconds: number, missedToday: number, unreadVoicemail: number, oldestUnreadVoicemailAt: string|null, meetingsToday: number, meetingMinutesToday: number}>}
137
137
  */
138
138
  async stats() {
139
- const result = await internalRequest(this.sdk, '/inbox/stats', 'GET');
139
+ const result = await internalRequest(this.sdk, '/recents/stats', 'GET');
140
140
  return result;
141
141
  }
142
142
 
@@ -154,7 +154,7 @@ export class InboxService {
154
154
  { voicemailMessageId: { type: 'string', required: true } },
155
155
  );
156
156
  return await internalRequest(this.sdk,
157
- `/inbox/voicemail/${voicemailMessageId}/transcribe`,
157
+ `/recents/voicemail/${voicemailMessageId}/transcribe`,
158
158
  'POST',
159
159
  { body: {} },
160
160
  );