@unboundcx/sdk 4.13.128 → 4.13.129
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
|
@@ -339,6 +339,7 @@ export { TimeOffService } from './services/schedules/TimeOffService.js';
|
|
|
339
339
|
export { JourneysService } from './services/journeys/JourneysService.js';
|
|
340
340
|
export { JourneyMembersService } from './services/journeys/JourneyMembersService.js';
|
|
341
341
|
export { JourneyDraftService } from './services/journeys/JourneysService.js';
|
|
342
|
+
export { JourneyWorklistService } from './services/journeys/JourneyWorklistService.js';
|
|
342
343
|
export { WorkflowTemplatesService } from './services/workflowTemplates/WorkflowTemplatesService.js';
|
|
343
344
|
export { EmergencyService } from './services/emergency.js';
|
|
344
345
|
export { WebchatService, WebchatWidgetsService } from './services/webchat.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.129",
|
|
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",
|
|
@@ -114,9 +114,12 @@ export class JourneyMembersService {
|
|
|
114
114
|
* @param {Object} body
|
|
115
115
|
* @param {'pause'|'resume'|'remove'|'reassign'|'changeChannel'} body.action
|
|
116
116
|
* @param {string[]} [body.ids] - Either ids or filter is required
|
|
117
|
-
* @param {Object} [body.filter]
|
|
117
|
+
* @param {Object} [body.filter] - e.g. `{ ownerUserId }` to target every
|
|
118
|
+
* member currently owned by one rep (P5 "reassign-all-owned-by" is this
|
|
119
|
+
* `action:'reassign'` + `filter:{ownerUserId}` combination -- no
|
|
120
|
+
* dedicated endpoint/method was added).
|
|
118
121
|
* @param {string} [body.reason]
|
|
119
|
-
* @param {string} [body.ownerUserId]
|
|
122
|
+
* @param {string} [body.ownerUserId] - New owner for `action:'reassign'`
|
|
120
123
|
* @param {Object} [body.channels]
|
|
121
124
|
* @returns {Promise<Object>} { results }
|
|
122
125
|
*/
|
|
@@ -186,4 +189,31 @@ export class JourneyMembersService {
|
|
|
186
189
|
{},
|
|
187
190
|
);
|
|
188
191
|
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Context-aware AI draft for a human touch-task step (record, step
|
|
195
|
+
* intent, prior conversation) -- journeys-plan.md §9 P5. Not the final
|
|
196
|
+
* send content; the rep edits/sends from the task itself.
|
|
197
|
+
*
|
|
198
|
+
* @param {string} memberId
|
|
199
|
+
* @param {Object} body
|
|
200
|
+
* @param {string} [body.stepKey]
|
|
201
|
+
* @param {'email'|'sms'} body.channel
|
|
202
|
+
* @returns {Promise<{data: {draft: string, channel: string, stepKey: string}}>}
|
|
203
|
+
*/
|
|
204
|
+
async draft(memberId, body = {}) {
|
|
205
|
+
this.sdk.validateParams(
|
|
206
|
+
{ memberId, channel: body?.channel },
|
|
207
|
+
{
|
|
208
|
+
memberId: { type: 'string', required: true },
|
|
209
|
+
channel: { type: 'string', required: true },
|
|
210
|
+
},
|
|
211
|
+
);
|
|
212
|
+
return await internalRequest(
|
|
213
|
+
this.sdk,
|
|
214
|
+
`/journeys/members/${memberId}/draft`,
|
|
215
|
+
'POST',
|
|
216
|
+
{ body: pickDefined(body) },
|
|
217
|
+
);
|
|
218
|
+
}
|
|
189
219
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { internalRequest } from '../../base.js';
|
|
2
|
+
|
|
3
|
+
function pickDefined(fields) {
|
|
4
|
+
const body = {};
|
|
5
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
6
|
+
if (value !== undefined) body[key] = value;
|
|
7
|
+
}
|
|
8
|
+
return body;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} JourneyWorklistTask
|
|
13
|
+
* @property {string} id
|
|
14
|
+
* @property {'journey'} type
|
|
15
|
+
* @property {'worklist'} deliveryMode
|
|
16
|
+
* @property {string|null} dueAt
|
|
17
|
+
* @property {string} journeyMemberId
|
|
18
|
+
* @property {string} journeyId
|
|
19
|
+
* @property {string} journeyStepKey
|
|
20
|
+
* @property {'email'|'sms'|'call'|'other'} journeyStepChannel
|
|
21
|
+
* @property {string|null} preferredWorkerId - Owner, or null for a pool task
|
|
22
|
+
* @property {string|null} engagementSessionId
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sales work list -- `sdk.journeys.worklist.*` (journeys-plan.md §9, P5).
|
|
27
|
+
* Cross-journey view of a sales rep's (or the pool's) open touch tasks
|
|
28
|
+
* (`tasks.type='journey'`), plus upcoming members from
|
|
29
|
+
* `journeyMembers.nextActionAt`. Requires `users_acct.salesEnabled` for
|
|
30
|
+
* `takeNext` (`list` stays open to ordinary object-read permission, per
|
|
31
|
+
* the P5 contract).
|
|
32
|
+
*
|
|
33
|
+
* @see app1-api src/services/journeys/controllers/worklist.js
|
|
34
|
+
*/
|
|
35
|
+
export class JourneyWorklistService {
|
|
36
|
+
constructor(sdk) {
|
|
37
|
+
this.sdk = sdk;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {Object} [opts]
|
|
42
|
+
* @param {'due'|'overdue'|'upcoming'} [opts.bucket]
|
|
43
|
+
* @param {string} [opts.stepType]
|
|
44
|
+
* @param {string} [opts.journeyId]
|
|
45
|
+
* @param {number} [opts.page]
|
|
46
|
+
* @param {number} [opts.pageSize]
|
|
47
|
+
* @returns {Promise<{data: JourneyWorklistTask[]}>}
|
|
48
|
+
*/
|
|
49
|
+
async list(opts = {}) {
|
|
50
|
+
return await internalRequest(this.sdk, '/journeys/worklist', 'GET', {
|
|
51
|
+
query: pickDefined(opts),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Takes the next due task for the caller (owner-or-pool), via the same
|
|
57
|
+
* `transitionTask` path as a manual take (`PUT /tasks/:id
|
|
58
|
+
* {status:'connected', workerId}`) -- not a separate silent-assign path.
|
|
59
|
+
*
|
|
60
|
+
* @param {Object} [filter]
|
|
61
|
+
* @param {string} [filter.stepType]
|
|
62
|
+
* @param {string} [filter.journeyId]
|
|
63
|
+
* @returns {Promise<{data: JourneyWorklistTask|null}>} null when nothing is due
|
|
64
|
+
*/
|
|
65
|
+
async takeNext(filter = {}) {
|
|
66
|
+
return await internalRequest(
|
|
67
|
+
this.sdk,
|
|
68
|
+
'/journeys/worklist/take-next',
|
|
69
|
+
'POST',
|
|
70
|
+
{ body: pickDefined(filter) },
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { internalRequest } from '../../base.js';
|
|
2
2
|
import { JourneyMembersService } from './JourneyMembersService.js';
|
|
3
3
|
import { JourneyDraftService } from './JourneyDraftService.js';
|
|
4
|
+
import { JourneyWorklistService } from './JourneyWorklistService.js';
|
|
4
5
|
|
|
5
6
|
function pickDefined(fields) {
|
|
6
7
|
const body = {};
|
|
@@ -22,6 +23,30 @@ function pickDefined(fields) {
|
|
|
22
23
|
* and the member-grid/enrol/action/fix/events/stats endpoints are custom
|
|
23
24
|
* routes under `/journeys/`, covered by `members` and `stats`.
|
|
24
25
|
*
|
|
26
|
+
* P5 (journeys-plan.md §8, sales queues + human steps) added fields to
|
|
27
|
+
* several generic objects rather than new endpoints -- no dedicated SDK
|
|
28
|
+
* service exists for these, so they are documented here instead:
|
|
29
|
+
* - `sdk.objects` object `'queues'`: `queueType` ('support'|'sales',
|
|
30
|
+
* default 'support'), `deliveryMode` ('push'|'worklist', default
|
|
31
|
+
* 'push'). A sales queue is auto-created with a journey type
|
|
32
|
+
* (`queueType:'sales', deliveryMode:'worklist'`) and its id is set on
|
|
33
|
+
* `journeyTypes.queueId`.
|
|
34
|
+
* - `sdk.objects` object `'queueDispositions'`: `outcome`
|
|
35
|
+
* ('positive'|'neutral'|'negative'|null), `countsAsConversion`
|
|
36
|
+
* (boolean), `flagsBadContact` (boolean) -- drive a journey member's
|
|
37
|
+
* `converted` / `needsAttention:badContact` transitions when a touch
|
|
38
|
+
* task is given that disposition.
|
|
39
|
+
* - `sdk.objects` object `'users'` (`users_acct`): `salesEnabled`
|
|
40
|
+
* (boolean, default false) -- required (alongside normal object
|
|
41
|
+
* permissions) for journeys build/enrol/member-action/worklist-take
|
|
42
|
+
* endpoints; member-grid reads stay open to object-read permission.
|
|
43
|
+
* - Task rows (`sdk.taskRouter.task.*`, `sdk.journeys.worklist.*`) gain
|
|
44
|
+
* `deliveryMode` ('push'|'worklist'), `dueAt` (ISO datetime|null),
|
|
45
|
+
* `journeyMemberId`, `journeyId`, `journeyStepKey`, `journeyStepChannel`
|
|
46
|
+
* ('email'|'sms'|'call'|'other') on a journey touch task
|
|
47
|
+
* (`type:'journey'`). See `JourneyWorklistService`'s
|
|
48
|
+
* `JourneyWorklistTask` typedef for the full shape.
|
|
49
|
+
*
|
|
25
50
|
* @see app1-api src/services/journeys/routes.js
|
|
26
51
|
*/
|
|
27
52
|
export class JourneysService {
|
|
@@ -31,6 +56,7 @@ export class JourneysService {
|
|
|
31
56
|
this.types = new JourneyTypesService(sdk);
|
|
32
57
|
this.goals = new JourneyGoalsService(sdk);
|
|
33
58
|
this.draft = new JourneyDraftService(sdk);
|
|
59
|
+
this.worklist = new JourneyWorklistService(sdk);
|
|
34
60
|
}
|
|
35
61
|
|
|
36
62
|
/**
|
|
@@ -312,4 +338,9 @@ class JourneyGoalsService {
|
|
|
312
338
|
}
|
|
313
339
|
}
|
|
314
340
|
|
|
315
|
-
export {
|
|
341
|
+
export {
|
|
342
|
+
JourneyTypesService,
|
|
343
|
+
JourneyGoalsService,
|
|
344
|
+
JourneyDraftService,
|
|
345
|
+
JourneyWorklistService,
|
|
346
|
+
};
|