@unboundcx/sdk 4.13.39 → 4.13.40
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/chat.js +52 -2
- package/services/messaging/SmsService.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.40",
|
|
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/chat.js
CHANGED
|
@@ -497,6 +497,49 @@ export class ChatService {
|
|
|
497
497
|
);
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
+
/**
|
|
501
|
+
* Send a message on a kind:'text' channel (sms-routing-plan.md §3.3.1).
|
|
502
|
+
* Plain body only — no ProseMirror `message`, no threads/cards. The API
|
|
503
|
+
* intercepts this route for text channels and sends the plain-text body
|
|
504
|
+
* as a real SMS/MMS via the same pipeline as sdk.messaging.sms.send
|
|
505
|
+
* (unless `internal` is set, which stays a regular chat message).
|
|
506
|
+
* @param {string} channelId
|
|
507
|
+
* @param {Object} params
|
|
508
|
+
* @param {string} [params.text] - Plain message text
|
|
509
|
+
* @param {string[]} [params.storageIds] - Image attachment storage ids
|
|
510
|
+
* @param {boolean} [params.internal] - Internal note; never sent as SMS
|
|
511
|
+
* @param {boolean} [params.force] - Force-send past a busy-conversation
|
|
512
|
+
* (409 TEXT_CONVERSATION_BUSY) collision
|
|
513
|
+
* @returns {Promise<Object>} Created message
|
|
514
|
+
*/
|
|
515
|
+
async sendTextMessage(channelId, { text, storageIds, internal, force } = {}) {
|
|
516
|
+
this.sdk.validateParams(
|
|
517
|
+
{ channelId, text, storageIds, internal, force },
|
|
518
|
+
{
|
|
519
|
+
channelId: { type: "string", required: true },
|
|
520
|
+
text: { type: "string", required: false },
|
|
521
|
+
storageIds: { type: "array", required: false },
|
|
522
|
+
internal: { type: "boolean", required: false },
|
|
523
|
+
force: { type: "boolean", required: false },
|
|
524
|
+
},
|
|
525
|
+
);
|
|
526
|
+
|
|
527
|
+
const body = {};
|
|
528
|
+
if (text !== undefined) body.text = text;
|
|
529
|
+
if (storageIds !== undefined) body.storageIds = storageIds;
|
|
530
|
+
if (internal !== undefined) body.internal = internal;
|
|
531
|
+
if (force !== undefined) body.force = force;
|
|
532
|
+
|
|
533
|
+
return internalRequest(
|
|
534
|
+
this.sdk,
|
|
535
|
+
`/chat/channels/${channelId}/messages`,
|
|
536
|
+
"POST",
|
|
537
|
+
{
|
|
538
|
+
body,
|
|
539
|
+
},
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
|
|
500
543
|
/**
|
|
501
544
|
* Edit a message body (ProseMirror JSON).
|
|
502
545
|
* @param {string} id
|
|
@@ -844,7 +887,11 @@ export class ChatService {
|
|
|
844
887
|
* reason"; channel must be a non-archived public/private channel.
|
|
845
888
|
* @returns {Promise<Object>} `{allowReports, reportReasons, reportNotifications}`
|
|
846
889
|
*/
|
|
847
|
-
async adminPutSettings({
|
|
890
|
+
async adminPutSettings({
|
|
891
|
+
allowReports,
|
|
892
|
+
reportReasons,
|
|
893
|
+
reportNotifications,
|
|
894
|
+
} = {}) {
|
|
848
895
|
this.sdk.validateParams(
|
|
849
896
|
{ allowReports, reportReasons, reportNotifications },
|
|
850
897
|
{
|
|
@@ -1145,7 +1192,10 @@ export class ChatService {
|
|
|
1145
1192
|
* @param {'open'|'in_review'} [params.status]
|
|
1146
1193
|
* @returns {Promise<Object>}
|
|
1147
1194
|
*/
|
|
1148
|
-
async adminUpdateCase(
|
|
1195
|
+
async adminUpdateCase(
|
|
1196
|
+
id,
|
|
1197
|
+
{ title, category, description, ownerId, status } = {},
|
|
1198
|
+
) {
|
|
1149
1199
|
this.sdk.validateParams(
|
|
1150
1200
|
{ id, title, category, description, ownerId, status },
|
|
1151
1201
|
{
|
|
@@ -21,6 +21,8 @@ export class SmsService {
|
|
|
21
21
|
* to attach this message to, so it surfaces on that record's feed
|
|
22
22
|
* @param {string} [params.engagementSessionId] - Engagement to attach this message to
|
|
23
23
|
* @param {string} [params.taskId] - Task the message was sent under (multi-channel-per-task attribution)
|
|
24
|
+
* @param {boolean} [params.force] - Force-send past a busy-conversation
|
|
25
|
+
* (409 TEXT_CONVERSATION_BUSY) collision
|
|
24
26
|
* @returns {Promise<Object>} Message details
|
|
25
27
|
*/
|
|
26
28
|
async send({
|
|
@@ -34,6 +36,7 @@ export class SmsService {
|
|
|
34
36
|
relatedId,
|
|
35
37
|
engagementSessionId,
|
|
36
38
|
taskId,
|
|
39
|
+
force,
|
|
37
40
|
}) {
|
|
38
41
|
const messageData = {};
|
|
39
42
|
if (from) messageData.from = from;
|
|
@@ -45,6 +48,7 @@ export class SmsService {
|
|
|
45
48
|
if (relatedId) messageData.relatedId = relatedId;
|
|
46
49
|
if (engagementSessionId) messageData.engagementSessionId = engagementSessionId;
|
|
47
50
|
if (taskId) messageData.taskId = taskId;
|
|
51
|
+
if (force !== undefined) messageData.force = force;
|
|
48
52
|
|
|
49
53
|
this.sdk.validateParams(
|
|
50
54
|
{ to, ...messageData },
|
|
@@ -59,6 +63,7 @@ export class SmsService {
|
|
|
59
63
|
relatedId: { type: 'string', required: false },
|
|
60
64
|
engagementSessionId: { type: 'string', required: false },
|
|
61
65
|
taskId: { type: 'string', required: false },
|
|
66
|
+
force: { type: 'boolean', required: false },
|
|
62
67
|
},
|
|
63
68
|
);
|
|
64
69
|
|