@unboundcx/sdk 4.13.26 → 4.13.27
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/webchat.js +45 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.27",
|
|
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/webchat.js
CHANGED
|
@@ -236,6 +236,51 @@ export class WebchatConversationsService {
|
|
|
236
236
|
this.sdk = sdk;
|
|
237
237
|
this.messages = new WebchatConversationMessagesService(sdk);
|
|
238
238
|
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Send a typing indicator into a webchat conversation as an agent.
|
|
242
|
+
* @param {string} widgetId
|
|
243
|
+
* @param {string} engagementSessionId
|
|
244
|
+
* @param {boolean} isTyping
|
|
245
|
+
* @returns {Promise<Object>}
|
|
246
|
+
*/
|
|
247
|
+
async typing(widgetId, engagementSessionId, isTyping) {
|
|
248
|
+
this.sdk.validateParams(
|
|
249
|
+
{ widgetId, engagementSessionId },
|
|
250
|
+
{
|
|
251
|
+
widgetId: { type: 'string', required: true },
|
|
252
|
+
engagementSessionId: { type: 'string', required: true },
|
|
253
|
+
},
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const params = { body: { isTyping: isTyping !== false } };
|
|
257
|
+
|
|
258
|
+
return internalRequest(
|
|
259
|
+
this.sdk,
|
|
260
|
+
`/webchat/widgets/${widgetId}/conversations/${engagementSessionId}/typing`,
|
|
261
|
+
'POST',
|
|
262
|
+
params,
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Look up a webchat conversation by engagementSessionId -- resolves the
|
|
268
|
+
* widgetId + verified-visitor badge data for the agent thread.
|
|
269
|
+
* @param {string} engagementSessionId
|
|
270
|
+
* @returns {Promise<Object>}
|
|
271
|
+
*/
|
|
272
|
+
async get(engagementSessionId) {
|
|
273
|
+
this.sdk.validateParams(
|
|
274
|
+
{ engagementSessionId },
|
|
275
|
+
{ engagementSessionId: { type: 'string', required: true } },
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
return internalRequest(
|
|
279
|
+
this.sdk,
|
|
280
|
+
`/webchat/widgets/conversations/${engagementSessionId}`,
|
|
281
|
+
'GET',
|
|
282
|
+
);
|
|
283
|
+
}
|
|
239
284
|
}
|
|
240
285
|
|
|
241
286
|
export class WebchatService {
|