@unboundcx/sdk 4.13.34 → 4.13.36
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.
|
|
3
|
+
"version": "4.13.36",
|
|
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/ai/playbooks.js
CHANGED
|
@@ -114,7 +114,13 @@ export class PlaybooksService {
|
|
|
114
114
|
* isPublished: true
|
|
115
115
|
* });
|
|
116
116
|
*/
|
|
117
|
-
async updatePlaybook({
|
|
117
|
+
async updatePlaybook({
|
|
118
|
+
playbookId,
|
|
119
|
+
name,
|
|
120
|
+
isPublished,
|
|
121
|
+
recordTypeId,
|
|
122
|
+
passScore,
|
|
123
|
+
}) {
|
|
118
124
|
this.sdk.validateParams(
|
|
119
125
|
{ playbookId },
|
|
120
126
|
{
|
|
@@ -122,11 +128,12 @@ export class PlaybooksService {
|
|
|
122
128
|
name: { type: 'string', required: false },
|
|
123
129
|
isPublished: { type: 'boolean', required: false },
|
|
124
130
|
recordTypeId: { type: 'string', required: false },
|
|
131
|
+
passScore: { type: 'number', required: false },
|
|
125
132
|
},
|
|
126
133
|
);
|
|
127
134
|
|
|
128
135
|
const params = {
|
|
129
|
-
body: { name, isPublished, recordTypeId },
|
|
136
|
+
body: { name, isPublished, recordTypeId, passScore },
|
|
130
137
|
};
|
|
131
138
|
|
|
132
139
|
const result = await internalRequest(this.sdk,
|
|
@@ -202,6 +209,8 @@ export class PlaybooksService {
|
|
|
202
209
|
requiredForPass,
|
|
203
210
|
role,
|
|
204
211
|
signal,
|
|
212
|
+
window,
|
|
213
|
+
windowTurns,
|
|
205
214
|
recordTypeId,
|
|
206
215
|
}) {
|
|
207
216
|
this.sdk.validateParams(
|
|
@@ -229,6 +238,8 @@ export class PlaybooksService {
|
|
|
229
238
|
requiredForPass: { type: 'boolean', required: false },
|
|
230
239
|
role: { type: 'string', required: false },
|
|
231
240
|
signal: { type: 'string', required: false },
|
|
241
|
+
window: { type: 'string', required: false },
|
|
242
|
+
windowTurns: { type: 'number', required: false },
|
|
232
243
|
recordTypeId: { type: 'string', required: false },
|
|
233
244
|
},
|
|
234
245
|
);
|
|
@@ -244,6 +255,8 @@ export class PlaybooksService {
|
|
|
244
255
|
requiredForPass,
|
|
245
256
|
role,
|
|
246
257
|
signal,
|
|
258
|
+
window,
|
|
259
|
+
windowTurns,
|
|
247
260
|
recordTypeId,
|
|
248
261
|
},
|
|
249
262
|
};
|
|
@@ -345,6 +358,8 @@ export class PlaybooksService {
|
|
|
345
358
|
requiredForPass,
|
|
346
359
|
role,
|
|
347
360
|
signal,
|
|
361
|
+
window,
|
|
362
|
+
windowTurns,
|
|
348
363
|
recordTypeId,
|
|
349
364
|
}) {
|
|
350
365
|
this.sdk.validateParams(
|
|
@@ -372,6 +387,8 @@ export class PlaybooksService {
|
|
|
372
387
|
requiredForPass: { type: 'boolean', required: false },
|
|
373
388
|
role: { type: 'string', required: false },
|
|
374
389
|
signal: { type: 'string', required: false },
|
|
390
|
+
window: { type: 'string', required: false },
|
|
391
|
+
windowTurns: { type: 'number', required: false },
|
|
375
392
|
recordTypeId: { type: 'string', required: false },
|
|
376
393
|
},
|
|
377
394
|
);
|
|
@@ -387,6 +404,8 @@ export class PlaybooksService {
|
|
|
387
404
|
requiredForPass,
|
|
388
405
|
role,
|
|
389
406
|
signal,
|
|
407
|
+
window,
|
|
408
|
+
windowTurns,
|
|
390
409
|
recordTypeId,
|
|
391
410
|
},
|
|
392
411
|
};
|
|
@@ -491,6 +510,8 @@ export class PlaybooksService {
|
|
|
491
510
|
description,
|
|
492
511
|
keywords,
|
|
493
512
|
recommendedPhase,
|
|
513
|
+
window,
|
|
514
|
+
windowTurns,
|
|
494
515
|
role,
|
|
495
516
|
signal,
|
|
496
517
|
recordTypeId,
|
|
@@ -502,6 +523,8 @@ export class PlaybooksService {
|
|
|
502
523
|
description: { type: 'string', required: false },
|
|
503
524
|
keywords: { type: 'array', required: false },
|
|
504
525
|
recommendedPhase: { type: 'string', required: false },
|
|
526
|
+
window: { type: 'string', required: false },
|
|
527
|
+
windowTurns: { type: 'number', required: false },
|
|
505
528
|
role: { type: 'string', required: false },
|
|
506
529
|
signal: { type: 'string', required: false },
|
|
507
530
|
recordTypeId: { type: 'string', required: false },
|
|
@@ -509,7 +532,17 @@ export class PlaybooksService {
|
|
|
509
532
|
);
|
|
510
533
|
|
|
511
534
|
const params = {
|
|
512
|
-
body: {
|
|
535
|
+
body: {
|
|
536
|
+
name,
|
|
537
|
+
description,
|
|
538
|
+
keywords,
|
|
539
|
+
recommendedPhase,
|
|
540
|
+
window,
|
|
541
|
+
windowTurns,
|
|
542
|
+
role,
|
|
543
|
+
signal,
|
|
544
|
+
recordTypeId,
|
|
545
|
+
},
|
|
513
546
|
};
|
|
514
547
|
|
|
515
548
|
const result = await internalRequest(this.sdk,
|
|
@@ -604,22 +637,28 @@ export class PlaybooksService {
|
|
|
604
637
|
*/
|
|
605
638
|
async updatePlaybookGoalType({
|
|
606
639
|
goalTypeId,
|
|
640
|
+
playbookGoalTypeId,
|
|
607
641
|
name,
|
|
608
642
|
description,
|
|
609
643
|
keywords,
|
|
610
644
|
recommendedPhase,
|
|
645
|
+
window,
|
|
646
|
+
windowTurns,
|
|
611
647
|
role,
|
|
612
648
|
signal,
|
|
613
649
|
recordTypeId,
|
|
614
650
|
}) {
|
|
651
|
+
const id = goalTypeId || playbookGoalTypeId;
|
|
615
652
|
this.sdk.validateParams(
|
|
616
|
-
{ goalTypeId },
|
|
653
|
+
{ goalTypeId: id },
|
|
617
654
|
{
|
|
618
655
|
goalTypeId: { type: 'string', required: true },
|
|
619
656
|
name: { type: 'string', required: false },
|
|
620
657
|
description: { type: 'string', required: false },
|
|
621
658
|
keywords: { type: 'array', required: false },
|
|
622
659
|
recommendedPhase: { type: 'string', required: false },
|
|
660
|
+
window: { type: 'string', required: false },
|
|
661
|
+
windowTurns: { type: 'number', required: false },
|
|
623
662
|
role: { type: 'string', required: false },
|
|
624
663
|
signal: { type: 'string', required: false },
|
|
625
664
|
recordTypeId: { type: 'string', required: false },
|
|
@@ -627,11 +666,21 @@ export class PlaybooksService {
|
|
|
627
666
|
);
|
|
628
667
|
|
|
629
668
|
const params = {
|
|
630
|
-
body: {
|
|
669
|
+
body: {
|
|
670
|
+
name,
|
|
671
|
+
description,
|
|
672
|
+
keywords,
|
|
673
|
+
recommendedPhase,
|
|
674
|
+
window,
|
|
675
|
+
windowTurns,
|
|
676
|
+
role,
|
|
677
|
+
signal,
|
|
678
|
+
recordTypeId,
|
|
679
|
+
},
|
|
631
680
|
};
|
|
632
681
|
|
|
633
682
|
const result = await internalRequest(this.sdk,
|
|
634
|
-
`/ai/playbooks/goalTypes/${
|
|
683
|
+
`/ai/playbooks/goalTypes/${id}`,
|
|
635
684
|
'PUT',
|
|
636
685
|
params,
|
|
637
686
|
);
|
|
@@ -958,6 +1007,7 @@ export class PlaybooksService {
|
|
|
958
1007
|
confidence,
|
|
959
1008
|
evidence,
|
|
960
1009
|
role,
|
|
1010
|
+
missed,
|
|
961
1011
|
}) {
|
|
962
1012
|
this.sdk.validateParams(
|
|
963
1013
|
{ sessionId, goalId },
|
|
@@ -970,6 +1020,7 @@ export class PlaybooksService {
|
|
|
970
1020
|
confidence: { type: 'number', required: false },
|
|
971
1021
|
evidence: { type: 'array', required: false },
|
|
972
1022
|
role: { type: 'string', required: false },
|
|
1023
|
+
missed: { type: 'boolean', required: false },
|
|
973
1024
|
},
|
|
974
1025
|
);
|
|
975
1026
|
|
|
@@ -982,6 +1033,7 @@ export class PlaybooksService {
|
|
|
982
1033
|
confidence,
|
|
983
1034
|
evidence,
|
|
984
1035
|
role,
|
|
1036
|
+
missed,
|
|
985
1037
|
},
|
|
986
1038
|
};
|
|
987
1039
|
|
|
@@ -447,6 +447,36 @@ export class TenDlcCampaignManagementService {
|
|
|
447
447
|
return result;
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
+
/**
|
|
451
|
+
* Bulk-add/move phone numbers onto a campaign
|
|
452
|
+
* @param {string} campaignId - Campaign ID
|
|
453
|
+
* @param {Object} options
|
|
454
|
+
* @param {string[]} options.phoneNumbers - Phone numbers in E.164 format (1-200)
|
|
455
|
+
* @param {boolean} [options.force] - Move numbers off another campaign instead
|
|
456
|
+
* of returning a 409 conflict
|
|
457
|
+
* @returns {Promise<Object>} `{ id, results: [{ phoneNumber, status, ... }] }`
|
|
458
|
+
*/
|
|
459
|
+
async addPhoneNumbers(campaignId, { phoneNumbers, force } = {}) {
|
|
460
|
+
this.sdk.validateParams(
|
|
461
|
+
{ campaignId, phoneNumbers },
|
|
462
|
+
{
|
|
463
|
+
campaignId: { type: 'string', required: true },
|
|
464
|
+
phoneNumbers: { type: 'array', required: true },
|
|
465
|
+
},
|
|
466
|
+
);
|
|
467
|
+
|
|
468
|
+
const options = {
|
|
469
|
+
body: { phoneNumbers, force },
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
const result = await internalRequest(this.sdk,
|
|
473
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}/phoneNumbers`,
|
|
474
|
+
'POST',
|
|
475
|
+
options,
|
|
476
|
+
);
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
|
|
450
480
|
/**
|
|
451
481
|
* Remove phone number from campaign
|
|
452
482
|
*/
|
|
@@ -22,7 +22,7 @@ export class TenDlcCampaignsService {
|
|
|
22
22
|
},
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
const result = await internalRequest(this.sdk,
|
|
25
|
+
const result = await internalRequest(this.sdk,
|
|
26
26
|
`/messaging/campaigns/10dlc/phoneNumber/${encodeURIComponent(
|
|
27
27
|
phoneNumber,
|
|
28
28
|
)}/campaignStatus`,
|
|
@@ -30,4 +30,41 @@ export class TenDlcCampaignsService {
|
|
|
30
30
|
);
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* List every account phone number with its 10DLC campaign link (if any)
|
|
36
|
+
* @returns {Promise<Array>} `[{ id, phoneNumber, name, city, state, country,
|
|
37
|
+
* campaignId, campaignName, campaignLinkingStatus, linkedAt }]`
|
|
38
|
+
*/
|
|
39
|
+
async listPhoneNumberAssignments() {
|
|
40
|
+
const result = await internalRequest(this.sdk,
|
|
41
|
+
`/messaging/campaigns/10dlc/phoneNumbers/assignments`,
|
|
42
|
+
'GET',
|
|
43
|
+
);
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the current 10DLC campaign link for one phone number
|
|
49
|
+
* @param {string} phoneNumber - Phone number to check
|
|
50
|
+
* @returns {Promise<Object>} `{ phoneNumber, campaignId, campaignName,
|
|
51
|
+
* campaignStatus, campaignLinkingStatus, linkedAt }` (campaignId is null
|
|
52
|
+
* when the number is unassigned)
|
|
53
|
+
*/
|
|
54
|
+
async getPhoneNumberCampaign(phoneNumber) {
|
|
55
|
+
this.sdk.validateParams(
|
|
56
|
+
{ phoneNumber },
|
|
57
|
+
{
|
|
58
|
+
phoneNumber: { type: 'string', required: true },
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const result = await internalRequest(this.sdk,
|
|
63
|
+
`/messaging/campaigns/10dlc/phoneNumber/${encodeURIComponent(
|
|
64
|
+
phoneNumber,
|
|
65
|
+
)}/campaign`,
|
|
66
|
+
'GET',
|
|
67
|
+
);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
33
70
|
}
|
package/services/webchat.js
CHANGED
|
@@ -165,6 +165,32 @@ export class WebchatConversationMessagesService {
|
|
|
165
165
|
params,
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Hide a link preview on a webchat message (same as chat.hideUnfurl).
|
|
171
|
+
* @param {string} widgetId
|
|
172
|
+
* @param {string} engagementSessionId
|
|
173
|
+
* @param {string} messageId
|
|
174
|
+
* @param {Object} options
|
|
175
|
+
* @param {string} options.url
|
|
176
|
+
*/
|
|
177
|
+
async hideUnfurl(widgetId, engagementSessionId, messageId, { url } = {}) {
|
|
178
|
+
this.sdk.validateParams(
|
|
179
|
+
{ widgetId, engagementSessionId, messageId, url },
|
|
180
|
+
{
|
|
181
|
+
widgetId: { type: 'string', required: true },
|
|
182
|
+
engagementSessionId: { type: 'string', required: true },
|
|
183
|
+
messageId: { type: 'string', required: true },
|
|
184
|
+
url: { type: 'string', required: true },
|
|
185
|
+
},
|
|
186
|
+
);
|
|
187
|
+
return internalRequest(
|
|
188
|
+
this.sdk,
|
|
189
|
+
`/webchat/widgets/${widgetId}/conversations/${engagementSessionId}/messages/${messageId}/unfurls/hide`,
|
|
190
|
+
'POST',
|
|
191
|
+
{ body: { url } },
|
|
192
|
+
);
|
|
193
|
+
}
|
|
168
194
|
}
|
|
169
195
|
|
|
170
196
|
export class WebchatConversationsService {
|