@unboundcx/sdk 4.13.99 → 4.13.101

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.13.99",
3
+ "version": "4.13.101",
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",
@@ -46,6 +46,42 @@ export class CCService {
46
46
  return result;
47
47
  }
48
48
 
49
+ /**
50
+ * Queue-level human headcount by status -- same-queue-help-ping-plan.md
51
+ * WP1. The AI bot calls this to decide "hand to a human now" (someone
52
+ * available) vs "take a message" (nobody, or only wrap-up).
53
+ *
54
+ * @param {Object} options - Options
55
+ * @param {string} options.queueId - Queue ID
56
+ * @param {string} [options.taskId] - Task ID (forward-compat; unused today)
57
+ * @returns {Promise<Object>} result
58
+ * @returns {number} result.available - Workers currently `available`
59
+ * @returns {Object} result.byStatus - `{ available, wrapUp }` counts
60
+ *
61
+ * @example
62
+ * const { available, byStatus } = await sdk.taskRouter.cc.getHumanAvailability({ queueId: 'queue_789' });
63
+ */
64
+ async getHumanAvailability({ queueId, taskId } = {}) {
65
+ this.sdk.validateParams(
66
+ { queueId, taskId },
67
+ {
68
+ queueId: { type: 'string', required: true },
69
+ taskId: { type: 'string', required: false },
70
+ },
71
+ );
72
+
73
+ const params = { query: {} };
74
+ if (taskId !== undefined) params.query.taskId = taskId;
75
+
76
+ const result = await internalRequest(
77
+ this.sdk,
78
+ `/taskRouter/queues/${queueId}/human-availability`,
79
+ 'GET',
80
+ params,
81
+ );
82
+ return result;
83
+ }
84
+
49
85
  /**
50
86
  * Get a live Contact Center snapshot (KPIs, per-queue summaries, team roster
51
87
  * with active tasks) scoped to a set of queues.
@@ -443,9 +443,11 @@ export class TaskService {
443
443
  * Release a task back to the queue for a human (same queue, same task
444
444
  * id) — the bot-task-lifecycle release contract. Stamps
445
445
  * botEligible:false (when humanOnly) plus named release-reason
446
- * metadata, and for a voice task in 'callback' mode hands the customer
447
- * off to the existing queue-wait callback contract (hangs up, task goes
448
- * pending, human accept later auto-dials the customer back).
446
+ * metadata and keeps the customer's original place in line. Voice:
447
+ * 'live' keeps the call on hold music for the next human; 'callback'
448
+ * ends the call and the task's primary channel becomes whatever is still
449
+ * live (e.g. sms) — the human who accepts follows up like on any task.
450
+ * This is not the queue-wait callback feature (no auto-dial).
449
451
  *
450
452
  * @param {Object} options - Parameters
451
453
  * @param {string} options.taskId - The task ID to release (required)