@unboundcx/sdk 4.13.60 → 4.13.62

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.60",
3
+ "version": "4.13.62",
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/fax.js CHANGED
@@ -86,6 +86,7 @@ export class FaxService {
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
88
  * @param {string} [options.relatedId] - Record (e.g. engagement/task) id; server posts a fax card into that record's activity feed
89
+ * @param {string} [options.taskId] - Task the outbound fax is sent from; server resolves the from-number chain (queue/user/account fax caller ID) and stamps the fax document to the task
89
90
  * @returns {Promise<Object>} Send result
90
91
  * @returns {string} result.id - The fax document ID
91
92
  * @returns {string} result.status - 'sending' on success, 'failed' on NATS error
@@ -133,9 +134,10 @@ export class FaxService {
133
134
  ecm,
134
135
  timeout,
135
136
  relatedId,
137
+ taskId,
136
138
  }) {
137
139
  this.sdk.validateParams(
138
- { faxMailboxId, toNumber, fromNumber, coverStorageId, paperSize },
140
+ { faxMailboxId, toNumber, fromNumber, coverStorageId, paperSize, taskId },
139
141
  {
140
142
  faxMailboxId: { type: 'string', required: true },
141
143
  toNumber: { type: 'string', required: true },
@@ -145,6 +147,7 @@ export class FaxService {
145
147
  tiffStorageId: { type: 'string', required: false },
146
148
  coverStorageId: { type: 'string', required: false },
147
149
  paperSize: { type: 'string', required: false },
150
+ taskId: { type: 'string', required: false },
148
151
  },
149
152
  );
150
153
 
@@ -36,31 +36,63 @@ export class ParticipantService {
36
36
  }
37
37
 
38
38
  /**
39
- * Add a participant to a task: invite a specific user to join, or request
40
- * help from a queue.
39
+ * Add a participant to a task: invite a specific user to join, request
40
+ * help from a queue, or dial an external caller onto the live voice bridge.
41
41
  *
42
42
  * @param {Object} options - Options
43
43
  * @param {string} options.taskId - Task ID
44
- * @param {string} options.kind - 'user' | 'queue'
44
+ * @param {string} options.kind - 'user' | 'queue' | 'external'
45
45
  * @param {string} [options.userId] - Required when kind is 'user'
46
46
  * @param {string} [options.queueId] - Required when kind is 'queue'
47
+ * @param {string} [options.phoneNumber] - External caller's phone number (kind 'external'; alternative to peopleId/companyId)
48
+ * @param {string} [options.peopleId] - External caller resolved from a person record (kind 'external'; alternative to phoneNumber/companyId)
49
+ * @param {string} [options.companyId] - External caller resolved from a company record (kind 'external'; alternative to phoneNumber/peopleId)
50
+ * @param {string} [options.displayName] - Optional display name shown for the external caller (kind 'external')
47
51
  * @param {string} [options.note] - Optional note shown to the invitee
48
52
  * @param {string} [options.bridgeRole='main'] - Voice bridge role (only 'main' is supported until the media update)
49
- * @returns {Promise<Object>} { participant, offerId } for kind 'user'; { helpTaskId } for kind 'queue'
53
+ * @returns {Promise<Object>} { participant, offerId } for kind 'user'; { helpTaskId } for kind 'queue'; { participant } for kind 'external'
50
54
  *
51
55
  * @example
52
56
  * await sdk.taskRouter.participants.add({ taskId: 'task_123', kind: 'user', userId: 'user_456', note: 'Need a hand' });
53
57
  * @example
54
58
  * await sdk.taskRouter.participants.add({ taskId: 'task_123', kind: 'queue', queueId: 'queue_789' });
59
+ * @example
60
+ * await sdk.taskRouter.participants.add({ taskId: 'task_123', kind: 'external', phoneNumber: '+15551234567', displayName: 'Jane Doe' });
55
61
  */
56
- async add({ taskId, kind, userId, queueId, note, bridgeRole } = {}) {
62
+ async add({
63
+ taskId,
64
+ kind,
65
+ userId,
66
+ queueId,
67
+ phoneNumber,
68
+ peopleId,
69
+ companyId,
70
+ displayName,
71
+ note,
72
+ bridgeRole,
73
+ } = {}) {
57
74
  this.sdk.validateParams(
58
- { taskId, kind, userId, queueId, note, bridgeRole },
75
+ {
76
+ taskId,
77
+ kind,
78
+ userId,
79
+ queueId,
80
+ phoneNumber,
81
+ peopleId,
82
+ companyId,
83
+ displayName,
84
+ note,
85
+ bridgeRole,
86
+ },
59
87
  {
60
88
  taskId: { type: 'string', required: true },
61
89
  kind: { type: 'string', required: true },
62
90
  userId: { type: 'string', required: false },
63
91
  queueId: { type: 'string', required: false },
92
+ phoneNumber: { type: 'string', required: false },
93
+ peopleId: { type: 'string', required: false },
94
+ companyId: { type: 'string', required: false },
95
+ displayName: { type: 'string', required: false },
64
96
  note: { type: 'string', required: false },
65
97
  bridgeRole: { type: 'string', required: false },
66
98
  },
@@ -69,6 +101,10 @@ export class ParticipantService {
69
101
  const params = { body: { kind } };
70
102
  if (userId !== undefined) params.body.userId = userId;
71
103
  if (queueId !== undefined) params.body.queueId = queueId;
104
+ if (phoneNumber !== undefined) params.body.phoneNumber = phoneNumber;
105
+ if (peopleId !== undefined) params.body.peopleId = peopleId;
106
+ if (companyId !== undefined) params.body.companyId = companyId;
107
+ if (displayName !== undefined) params.body.displayName = displayName;
72
108
  if (note !== undefined) params.body.note = note;
73
109
  if (bridgeRole !== undefined) params.body.bridgeRole = bridgeRole;
74
110
 
@@ -175,28 +211,38 @@ export class ParticipantService {
175
211
  }
176
212
 
177
213
  /**
178
- * Swap task ownership between the current owner and a joined helper.
214
+ * Swap task ownership between the current owner and a joined helper. When
215
+ * the helper has no access to the task's queue, this chains: it creates a
216
+ * new task in the helper's queue and makes them its owner. If `queueId` is
217
+ * omitted and the helper has access to more than one queue, the server
218
+ * responds 409 with `{ needsQueue: true, queues }` — retry with a chosen
219
+ * `queueId`.
179
220
  *
180
221
  * @param {Object} options - Options
181
222
  * @param {string} options.taskId - Task ID
182
223
  * @param {string} options.participantId - The helper participant taking/giving control
183
224
  * @param {string} options.action - 'give' | 'take'
184
- * @returns {Promise<Object>} { taskId, workerId }
225
+ * @param {string} [options.queueId] - Target queue for a cross-queue control chain (only relevant when the helper lacks access to the task's own queue)
226
+ * @returns {Promise<Object>} { taskId, workerId } for a same-queue swap; { taskId, newTaskId, workerId } for a cross-queue chain
185
227
  *
186
228
  * @example
187
229
  * await sdk.taskRouter.participants.control({ taskId: 'task_123', participantId: 'tp_456', action: 'give' });
230
+ * @example
231
+ * await sdk.taskRouter.participants.control({ taskId: 'task_123', participantId: 'tp_456', action: 'take', queueId: 'queue_789' });
188
232
  */
189
- async control({ taskId, participantId, action }) {
233
+ async control({ taskId, participantId, action, queueId }) {
190
234
  this.sdk.validateParams(
191
- { taskId, participantId, action },
235
+ { taskId, participantId, action, queueId },
192
236
  {
193
237
  taskId: { type: 'string', required: true },
194
238
  participantId: { type: 'string', required: true },
195
239
  action: { type: 'string', required: true },
240
+ queueId: { type: 'string', required: false },
196
241
  },
197
242
  );
198
243
 
199
244
  const params = { body: { action } };
245
+ if (queueId !== undefined) params.body.queueId = queueId;
200
246
 
201
247
  return await internalRequest(
202
248
  this.sdk,