@unboundcx/sdk 4.13.63 → 4.13.66
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/services/ai/battleCards.js +27 -0
- package/services/fax.js +27 -0
- package/services/knowledgeBase.js +103 -2
- package/services/taskRouter/WorkerService.js +78 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.66",
|
|
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",
|
|
@@ -366,6 +366,33 @@ export class BattleCardsService {
|
|
|
366
366
|
* queueId: 'queue_123'
|
|
367
367
|
* });
|
|
368
368
|
*/
|
|
369
|
+
/**
|
|
370
|
+
* Search (or list) battle cards assigned to a queue's packs.
|
|
371
|
+
* Empty query returns the full pack list; a query ranks title/trigger/body.
|
|
372
|
+
*
|
|
373
|
+
* @param {Object} options
|
|
374
|
+
* @param {string} options.queueId
|
|
375
|
+
* @param {string} [options.query]
|
|
376
|
+
* @param {string} [options.q]
|
|
377
|
+
* @returns {Promise<Object>} { results, query }
|
|
378
|
+
*/
|
|
379
|
+
async searchQueueCards({ queueId, query, q } = {}) {
|
|
380
|
+
this.sdk.validateParams(
|
|
381
|
+
{ queueId },
|
|
382
|
+
{
|
|
383
|
+
queueId: { type: 'string', required: true },
|
|
384
|
+
},
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
const result = await internalRequest(
|
|
388
|
+
this.sdk,
|
|
389
|
+
`/ai/battleCards/queues/${queueId}/cards`,
|
|
390
|
+
'GET',
|
|
391
|
+
{ query: { q: query || q || '' } },
|
|
392
|
+
);
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
395
|
+
|
|
369
396
|
async listQueuePacks({ queueId }) {
|
|
370
397
|
this.sdk.validateParams(
|
|
371
398
|
{ queueId },
|
package/services/fax.js
CHANGED
|
@@ -263,4 +263,31 @@ export class FaxService {
|
|
|
263
263
|
|
|
264
264
|
return await internalRequest(this.sdk, '/fax/status', 'POST', params);
|
|
265
265
|
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Retry a failed outbound fax. Resets the same fax document row (status
|
|
269
|
+
* back to 'pending', clears isError/errorMessage/sipCallId, bumps
|
|
270
|
+
* sendAttempts) and re-dispatches it through the same media-manager path
|
|
271
|
+
* as sdk.fax.send() -- only valid for outbound documents currently in
|
|
272
|
+
* status 'failed'.
|
|
273
|
+
*
|
|
274
|
+
* @param {string} id - The fax document ID to retry (required)
|
|
275
|
+
* @returns {Promise<Object>} Retry result
|
|
276
|
+
* @returns {string} result.id - The fax document ID
|
|
277
|
+
* @returns {string} result.status - 'sending' on success, 'failed' on NATS error
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* const result = await sdk.fax.retry('158abc123...');
|
|
281
|
+
* console.log(result.status); // 'sending'
|
|
282
|
+
*/
|
|
283
|
+
async retry(id) {
|
|
284
|
+
this.sdk.validateParams(
|
|
285
|
+
{ id },
|
|
286
|
+
{
|
|
287
|
+
id: { type: 'string', required: true },
|
|
288
|
+
},
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
return await internalRequest(this.sdk, `/fax/${id}/retry`, 'POST', {});
|
|
292
|
+
}
|
|
266
293
|
}
|
|
@@ -21,7 +21,15 @@ export class KnowledgeBaseService {
|
|
|
21
21
|
* Each result's source now also includes isPublic, knowledgeBaseId, knowledgeBaseName.
|
|
22
22
|
* @returns {Promise<Object>} Search results with source attribution
|
|
23
23
|
*/
|
|
24
|
-
async search({
|
|
24
|
+
async search({
|
|
25
|
+
query,
|
|
26
|
+
knowledgeBaseId,
|
|
27
|
+
limit,
|
|
28
|
+
filters,
|
|
29
|
+
rerank,
|
|
30
|
+
visibility,
|
|
31
|
+
taskId,
|
|
32
|
+
}) {
|
|
25
33
|
this.sdk.validateParams(
|
|
26
34
|
{ query },
|
|
27
35
|
{
|
|
@@ -30,7 +38,15 @@ export class KnowledgeBaseService {
|
|
|
30
38
|
);
|
|
31
39
|
|
|
32
40
|
const params = {
|
|
33
|
-
body: {
|
|
41
|
+
body: {
|
|
42
|
+
query,
|
|
43
|
+
knowledgeBaseId,
|
|
44
|
+
limit,
|
|
45
|
+
filters,
|
|
46
|
+
rerank,
|
|
47
|
+
visibility,
|
|
48
|
+
taskId,
|
|
49
|
+
},
|
|
34
50
|
};
|
|
35
51
|
|
|
36
52
|
const result = await internalRequest(this.sdk,
|
|
@@ -41,6 +57,34 @@ export class KnowledgeBaseService {
|
|
|
41
57
|
return result;
|
|
42
58
|
}
|
|
43
59
|
|
|
60
|
+
async listQueueKnowledgeBases({ queueId }) {
|
|
61
|
+
this.sdk.validateParams(
|
|
62
|
+
{ queueId },
|
|
63
|
+
{ queueId: { type: 'string', required: true } },
|
|
64
|
+
);
|
|
65
|
+
return internalRequest(
|
|
66
|
+
this.sdk,
|
|
67
|
+
`/knowledgeBase/queues/${queueId}/knowledgeBases`,
|
|
68
|
+
'GET',
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async setQueueKnowledgeBases({ queueId, knowledgeBaseIds }) {
|
|
73
|
+
this.sdk.validateParams(
|
|
74
|
+
{ queueId, knowledgeBaseIds },
|
|
75
|
+
{
|
|
76
|
+
queueId: { type: 'string', required: true },
|
|
77
|
+
knowledgeBaseIds: { type: 'array', required: true },
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
return internalRequest(
|
|
81
|
+
this.sdk,
|
|
82
|
+
`/knowledgeBase/queues/${queueId}/knowledgeBases`,
|
|
83
|
+
'PUT',
|
|
84
|
+
{ body: { knowledgeBaseIds } },
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
44
88
|
/**
|
|
45
89
|
* Discover pages available at a URL
|
|
46
90
|
* Checks for sitemaps (auto-discovery + direct sitemap URLs) and returns
|
|
@@ -256,6 +300,12 @@ export class KnowledgeBaseService {
|
|
|
256
300
|
* @param {Object} [params.filters] - Optional date range, source type filters
|
|
257
301
|
* @returns {Promise<Object>} Analytics data
|
|
258
302
|
*/
|
|
303
|
+
async getAccountAnalytics(filters = {}) {
|
|
304
|
+
return internalRequest(this.sdk, '/knowledgeBase/analytics', 'GET', {
|
|
305
|
+
query: filters,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
259
309
|
async getAnalytics({ knowledgeBaseId, ...filters }) {
|
|
260
310
|
this.sdk.validateParams(
|
|
261
311
|
{ knowledgeBaseId },
|
|
@@ -304,4 +354,55 @@ export class KnowledgeBaseService {
|
|
|
304
354
|
);
|
|
305
355
|
return result;
|
|
306
356
|
}
|
|
357
|
+
|
|
358
|
+
async listTaskPins({ taskId }) {
|
|
359
|
+
this.sdk.validateParams(
|
|
360
|
+
{ taskId },
|
|
361
|
+
{ taskId: { type: 'string', required: true } },
|
|
362
|
+
);
|
|
363
|
+
return internalRequest(
|
|
364
|
+
this.sdk,
|
|
365
|
+
`/knowledgeBase/tasks/${taskId}/pins`,
|
|
366
|
+
'GET',
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
async pinTaskSource({
|
|
371
|
+
taskId,
|
|
372
|
+
sourceId,
|
|
373
|
+
sourceType,
|
|
374
|
+
knowledgeBaseId,
|
|
375
|
+
title,
|
|
376
|
+
}) {
|
|
377
|
+
this.sdk.validateParams(
|
|
378
|
+
{ taskId, sourceId },
|
|
379
|
+
{
|
|
380
|
+
taskId: { type: 'string', required: true },
|
|
381
|
+
sourceId: { type: 'string', required: true },
|
|
382
|
+
},
|
|
383
|
+
);
|
|
384
|
+
return internalRequest(
|
|
385
|
+
this.sdk,
|
|
386
|
+
`/knowledgeBase/tasks/${taskId}/pins`,
|
|
387
|
+
'POST',
|
|
388
|
+
{
|
|
389
|
+
body: { sourceId, sourceType, knowledgeBaseId, title },
|
|
390
|
+
},
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
async unpinTaskSource({ taskId, pinId }) {
|
|
395
|
+
this.sdk.validateParams(
|
|
396
|
+
{ taskId, pinId },
|
|
397
|
+
{
|
|
398
|
+
taskId: { type: 'string', required: true },
|
|
399
|
+
pinId: { type: 'string', required: true },
|
|
400
|
+
},
|
|
401
|
+
);
|
|
402
|
+
return internalRequest(
|
|
403
|
+
this.sdk,
|
|
404
|
+
`/knowledgeBase/tasks/${taskId}/pins/${pinId}`,
|
|
405
|
+
'DELETE',
|
|
406
|
+
);
|
|
407
|
+
}
|
|
307
408
|
}
|
|
@@ -195,6 +195,84 @@ export class WorkerService {
|
|
|
195
195
|
return result;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Set the authenticated user's own worker paused state
|
|
200
|
+
* Pauses (or unpauses) the caller's own worker so it stays logged into its queues
|
|
201
|
+
* but stops receiving new task offers. Requires Contact Center access.
|
|
202
|
+
*
|
|
203
|
+
* @param {Object} options - Parameters
|
|
204
|
+
* @param {boolean} options.paused - Whether the worker should be paused
|
|
205
|
+
* @returns {Promise<Object>} The updated worker
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* // Pause the authenticated user's own worker
|
|
209
|
+
* const worker = await sdk.taskRouter.worker.setPaused({ paused: true });
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* // Unpause
|
|
213
|
+
* const worker = await sdk.taskRouter.worker.setPaused({ paused: false });
|
|
214
|
+
*/
|
|
215
|
+
async setPaused(options = {}) {
|
|
216
|
+
const { paused } = options;
|
|
217
|
+
|
|
218
|
+
this.sdk.validateParams(
|
|
219
|
+
{ paused },
|
|
220
|
+
{
|
|
221
|
+
paused: { type: 'boolean', required: true },
|
|
222
|
+
},
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
const params = {
|
|
226
|
+
body: { paused },
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const result = await internalRequest(this.sdk,
|
|
230
|
+
'/taskRouter/workers/me/paused',
|
|
231
|
+
'PUT',
|
|
232
|
+
params,
|
|
233
|
+
);
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Set another worker's paused state
|
|
239
|
+
* Pauses (or unpauses) a specific worker by workerId. The caller must be a queue
|
|
240
|
+
* manager for at least one queue that worker is logged into or assigned to.
|
|
241
|
+
*
|
|
242
|
+
* @param {Object} options - Parameters
|
|
243
|
+
* @param {string} options.workerId - The worker ID to update (required)
|
|
244
|
+
* @param {boolean} options.paused - Whether the worker should be paused
|
|
245
|
+
* @returns {Promise<Object>} The updated worker
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* const worker = await sdk.taskRouter.worker.setWorkerPaused({
|
|
249
|
+
* workerId: '0860002026012400000006665842155429980',
|
|
250
|
+
* paused: true,
|
|
251
|
+
* });
|
|
252
|
+
*/
|
|
253
|
+
async setWorkerPaused(options = {}) {
|
|
254
|
+
const { workerId, paused } = options;
|
|
255
|
+
|
|
256
|
+
this.sdk.validateParams(
|
|
257
|
+
{ workerId, paused },
|
|
258
|
+
{
|
|
259
|
+
workerId: { type: 'string', required: true },
|
|
260
|
+
paused: { type: 'boolean', required: true },
|
|
261
|
+
},
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
const params = {
|
|
265
|
+
body: { paused },
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const result = await internalRequest(this.sdk,
|
|
269
|
+
`/taskRouter/workers/${workerId}/paused`,
|
|
270
|
+
'PUT',
|
|
271
|
+
params,
|
|
272
|
+
);
|
|
273
|
+
return result;
|
|
274
|
+
}
|
|
275
|
+
|
|
198
276
|
/**
|
|
199
277
|
* Automatically login all auto-login queues for a worker
|
|
200
278
|
* When a worker goes available, this logs them into all queues marked with autoLogin = true.
|