@unboundcx/sdk 4.13.38 → 4.13.39
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/messaging/SmsService.js +22 -0
- package/services/text.js +51 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.39",
|
|
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",
|
|
@@ -108,4 +108,26 @@ export class SmsService {
|
|
|
108
108
|
);
|
|
109
109
|
return result;
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Re-send a failed message as a new row, linked back via retryOfId
|
|
114
|
+
* (sms-routing-plan.md §5.1, contract C2).
|
|
115
|
+
* @param {string} id - The failed message's id (required)
|
|
116
|
+
* @returns {Promise<Object>} The new message's { id, status }
|
|
117
|
+
*/
|
|
118
|
+
async retry(id) {
|
|
119
|
+
this.sdk.validateParams(
|
|
120
|
+
{ id },
|
|
121
|
+
{
|
|
122
|
+
id: { type: 'string', required: true },
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const result = await internalRequest(
|
|
127
|
+
this.sdk,
|
|
128
|
+
`/messaging/sms/${id}/retry`,
|
|
129
|
+
'POST',
|
|
130
|
+
);
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
111
133
|
}
|
package/services/text.js
CHANGED
|
@@ -46,6 +46,57 @@ export class TextConversationsService {
|
|
|
46
46
|
query: { phoneNumberId, counterparty },
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Join a UC-Chat-owned conversation's text channel (sms-routing-plan.md
|
|
52
|
+
* §3.3, contract C5) -- private channels aren't joinable via
|
|
53
|
+
* sdk.chat.channels.join (public-only); public-visibility text channels
|
|
54
|
+
* still require `messaging:sms:send`, which this route enforces.
|
|
55
|
+
* @param {string} id - textConversations id (required)
|
|
56
|
+
* @returns {Promise<Object>} { channel, membership }
|
|
57
|
+
*/
|
|
58
|
+
async join(id) {
|
|
59
|
+
this.sdk.validateParams(
|
|
60
|
+
{ id },
|
|
61
|
+
{ id: { type: 'string', required: true } },
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return internalRequest(this.sdk, `/text/conversations/${id}/join`, 'POST');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Escalate a UC-Chat-owned ('user') conversation to a queue or a
|
|
69
|
+
* workflow (sms-routing-plan.md §3.3/§3.4 "Send to queue" / "Send to
|
|
70
|
+
* workflow"). Pass exactly one of queueId or workflowId/workflowVersionId.
|
|
71
|
+
* @param {string} id - textConversations id (required)
|
|
72
|
+
* @param {Object} options - Parameters
|
|
73
|
+
* @param {string} [options.queueId] - Escalate to a queue (new task)
|
|
74
|
+
* @param {string} [options.workflowId] - Escalate to a workflow's current version
|
|
75
|
+
* @param {string} [options.workflowVersionId] - Escalate to a pinned workflow version
|
|
76
|
+
* @returns {Promise<Object>} The updated conversation row
|
|
77
|
+
*/
|
|
78
|
+
async escalate(id, options = {}) {
|
|
79
|
+
const { queueId, workflowId, workflowVersionId } = options;
|
|
80
|
+
|
|
81
|
+
this.sdk.validateParams(
|
|
82
|
+
{ id, queueId, workflowId, workflowVersionId },
|
|
83
|
+
{
|
|
84
|
+
id: { type: 'string', required: true },
|
|
85
|
+
queueId: { type: 'string', required: false },
|
|
86
|
+
workflowId: { type: 'string', required: false },
|
|
87
|
+
workflowVersionId: { type: 'string', required: false },
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
if (!queueId && !workflowId && !workflowVersionId) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
'escalate requires queueId or workflowId/workflowVersionId',
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return internalRequest(this.sdk, `/text/conversations/${id}/escalate`, 'POST', {
|
|
97
|
+
body: { queueId, workflowId, workflowVersionId },
|
|
98
|
+
});
|
|
99
|
+
}
|
|
49
100
|
}
|
|
50
101
|
|
|
51
102
|
export class TextService {
|