@unboundcx/sdk 4.13.37 → 4.13.38

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
@@ -43,6 +43,7 @@ import { SearchService } from './services/search.js';
43
43
  import { DirectoryService } from './services/directory.js';
44
44
  import { ChatService } from './services/chat.js';
45
45
  import { DeveloperApisService } from './services/developerApis.js';
46
+ import { TextService } from './services/text.js';
46
47
  import {
47
48
  DataImportService,
48
49
  DataExportService,
@@ -120,6 +121,7 @@ class UnboundSDK extends BaseSDK {
120
121
  this.generateId = new GenerateIdService(this);
121
122
  this.engagementMetrics = new EngagementMetricsService(this);
122
123
  this.taskRouter = new TaskRouterService(this);
124
+ this.text = new TextService(this);
123
125
  this.knowledgeBase = new KnowledgeBaseService(this);
124
126
  this.fax = new FaxService(this);
125
127
  this.documents = new DocumentsService(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.37",
3
+ "version": "4.13.38",
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",
@@ -112,6 +112,9 @@ export class PhoneNumbersService {
112
112
  voiceRecordTypeId,
113
113
  messagingRecordTypeId,
114
114
  recordCalls,
115
+ textApp,
116
+ textAppMetaData,
117
+ textChatVisibility,
115
118
  },
116
119
  ) {
117
120
  this.sdk.validateParams(
@@ -125,6 +128,9 @@ export class PhoneNumbersService {
125
128
  voiceRecordTypeId,
126
129
  messagingRecordTypeId,
127
130
  recordCalls,
131
+ textApp,
132
+ textAppMetaData,
133
+ textChatVisibility,
128
134
  },
129
135
  {
130
136
  id: { type: 'string', required: true },
@@ -137,6 +143,9 @@ export class PhoneNumbersService {
137
143
  voiceRecordTypeId: { type: 'string', required: false },
138
144
  messagingRecordTypeId: { type: 'string', required: false },
139
145
  recordCalls: { type: 'boolean', required: false },
146
+ textApp: { type: 'string', required: false },
147
+ textAppMetaData: { type: 'string', required: false },
148
+ textChatVisibility: { type: 'string', required: false },
140
149
  },
141
150
  );
142
151
 
@@ -155,6 +164,11 @@ export class PhoneNumbersService {
155
164
  if (messagingRecordTypeId)
156
165
  updateData.messagingRecordTypeId = messagingRecordTypeId;
157
166
  if (recordCalls !== undefined) updateData.recordCalls = recordCalls;
167
+ if (textApp !== undefined) updateData.textApp = textApp;
168
+ if (textAppMetaData !== undefined)
169
+ updateData.textAppMetaData = textAppMetaData;
170
+ if (textChatVisibility !== undefined)
171
+ updateData.textChatVisibility = textChatVisibility;
158
172
 
159
173
  const params = {
160
174
  body: updateData,
@@ -845,6 +845,67 @@ export class TaskService {
845
845
  return result;
846
846
  }
847
847
 
848
+ /**
849
+ * Park a task ("waiting for customer"). Clears the worker (freeing
850
+ * capacity) and stamps preferredWorkerId with the parking worker so
851
+ * unpark can offer the task back to them first.
852
+ *
853
+ * @param {Object} options - Parameters
854
+ * @param {string} options.taskId - The task ID to park (required)
855
+ * @returns {Promise<Object>} { taskId, status: 'parked' }
856
+ */
857
+ async park(options = {}) {
858
+ const { taskId } = options;
859
+
860
+ this.sdk.validateParams(
861
+ { taskId },
862
+ { taskId: { type: 'string', required: true } },
863
+ );
864
+
865
+ const params = { body: { taskId } };
866
+
867
+ return await internalRequest(
868
+ this.sdk,
869
+ '/taskRouter/tasks/park',
870
+ 'PUT',
871
+ params,
872
+ );
873
+ }
874
+
875
+ /**
876
+ * Transfer a task to a different queue and/or worker. Passing queueId
877
+ * moves the task back to 'pending' status for re-distribution.
878
+ *
879
+ * @param {Object} options - Parameters
880
+ * @param {string} options.taskId - The task ID to transfer (required)
881
+ * @param {string} [options.queueId] - Destination queue ID
882
+ * @param {string} [options.workerId] - Destination worker ID
883
+ * @returns {Promise<Object>} { taskId }
884
+ */
885
+ async transfer(options = {}) {
886
+ const { taskId, queueId, workerId } = options;
887
+
888
+ this.sdk.validateParams(
889
+ { taskId, queueId, workerId },
890
+ {
891
+ taskId: { type: 'string', required: true },
892
+ queueId: { type: 'string', required: false },
893
+ workerId: { type: 'string', required: false },
894
+ },
895
+ );
896
+
897
+ const params = { body: { taskId } };
898
+ if (queueId !== undefined) params.body.queueId = queueId;
899
+ if (workerId !== undefined) params.body.workerId = workerId;
900
+
901
+ return await internalRequest(
902
+ this.sdk,
903
+ '/taskRouter/tasks/transfer',
904
+ 'PUT',
905
+ params,
906
+ );
907
+ }
908
+
848
909
  /**
849
910
  * Get the voice transcript for a task, keyed by the media-manager
850
911
  * bridgeId (not sipCallId) so it works across requeue/transfer.
@@ -0,0 +1,56 @@
1
+ import { internalRequest } from '../base.js';
2
+
3
+ // Text routing (sms-routing-plan.md §2/§3.2/§3.4): read-only lookups for the
4
+ // durable textConversations row. Mutations (send, park, transfer) go through
5
+ // sdk.messaging.sms / sdk.taskRouter.task — this service is for resolving
6
+ // "what conversation is this" from the client/CC UI.
7
+ export class TextConversationsService {
8
+ constructor(sdk) {
9
+ this.sdk = sdk;
10
+ }
11
+
12
+ /**
13
+ * Get a single text conversation by id.
14
+ * @param {string} id - textConversations id (required)
15
+ * @returns {Promise<Object>}
16
+ */
17
+ async get(id) {
18
+ this.sdk.validateParams(
19
+ { id },
20
+ { id: { type: 'string', required: true } },
21
+ );
22
+
23
+ return internalRequest(this.sdk, `/text/conversations/${id}`, 'GET');
24
+ }
25
+
26
+ /**
27
+ * Resolve the currently-open conversation for an (identity, counterparty)
28
+ * pair, if any.
29
+ * @param {Object} options - Parameters
30
+ * @param {string} options.phoneNumberId - our-side identity id (required)
31
+ * @param {string} options.counterparty - external address (required)
32
+ * @returns {Promise<Object|null>} the open conversation row, or null
33
+ */
34
+ async resolve(options = {}) {
35
+ const { phoneNumberId, counterparty } = options;
36
+
37
+ this.sdk.validateParams(
38
+ { phoneNumberId, counterparty },
39
+ {
40
+ phoneNumberId: { type: 'string', required: true },
41
+ counterparty: { type: 'string', required: true },
42
+ },
43
+ );
44
+
45
+ return internalRequest(this.sdk, '/text/conversations/resolve', 'GET', {
46
+ query: { phoneNumberId, counterparty },
47
+ });
48
+ }
49
+ }
50
+
51
+ export class TextService {
52
+ constructor(sdk) {
53
+ this.sdk = sdk;
54
+ this.conversations = new TextConversationsService(sdk);
55
+ }
56
+ }