@unboundcx/sdk 4.13.9 → 4.13.11

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.9",
3
+ "version": "4.13.11",
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",
@@ -101,6 +101,18 @@ const TimelineSection = BaseSection.extend({
101
101
  showFilters: z.boolean().default(true),
102
102
  });
103
103
 
104
+ // Email section (people/company/opportunities detail pages) — renders a
105
+ // record-scoped, filtered view over app1-api's GET /object/:id/emails
106
+ // (thread-grouped mailbox data), not a table/kanban query.
107
+ const EmailSection = BaseSection.extend({
108
+ type: z.literal('email'),
109
+ limit: z.number().int().positive().default(25),
110
+ showSearch: z.boolean().default(true),
111
+ showMailboxFilter: z.boolean().default(true),
112
+ showCompose: z.boolean().default(true),
113
+ hideWhenEmpty: z.boolean().default(true),
114
+ });
115
+
104
116
  const TableKanbanSection = BaseSection.extend({
105
117
  type: z.literal('table-kanban'),
106
118
  defaultView: z.enum(['table', 'kanban']).default('table'),
@@ -118,5 +130,5 @@ const TableKanbanSection = BaseSection.extend({
118
130
  // function.
119
131
  export const SectionSpec = z.discriminatedUnion('type', [
120
132
  ContentSection, TableSection, KanbanSection, TableKanbanSection, WidgetSection,
121
- TimelineSection,
133
+ TimelineSection, EmailSection,
122
134
  ]);
@@ -56,7 +56,9 @@ export class EmailService {
56
56
  * @param {Array} [params.storageId] - Array of storage IDs for attachments
57
57
  * @param {string} [params.replyTo] - Reply-to email address
58
58
  * @param {string} [params.replyToEmailId] - ID of email this is replying to
59
- * @param {string} [params.relatedId] - Related record ID
59
+ * @param {string} [params.relatedId] - Related record ID (e.g. opportunity)
60
+ * @param {string} [params.peopleId] - Person record ID to link the email to
61
+ * @param {string} [params.companyId] - Company record ID to link the email to
60
62
  * @param {string} [params.emailType='marketing'] - Email type: 'marketing' or 'transactional'
61
63
  * @param {boolean} [params.tracking=true] - Enable email tracking (opens, clicks)
62
64
  * @param {string} [params.mailboxId] - Specific mailbox to send from
@@ -77,6 +79,8 @@ export class EmailService {
77
79
  replyTo,
78
80
  replyToEmailId,
79
81
  relatedId,
82
+ peopleId,
83
+ companyId,
80
84
  emailType,
81
85
  tracking,
82
86
  mailboxId,
@@ -107,6 +111,8 @@ export class EmailService {
107
111
  replyTo,
108
112
  replyToEmailId,
109
113
  relatedId,
114
+ peopleId,
115
+ companyId,
110
116
  emailType,
111
117
  tracking,
112
118
  mailboxId,
@@ -122,6 +128,8 @@ export class EmailService {
122
128
  replyTo: { type: 'string', required: false },
123
129
  replyToEmailId: { type: 'string', required: false },
124
130
  relatedId: { type: 'string', required: false },
131
+ peopleId: { type: 'string', required: false },
132
+ companyId: { type: 'string', required: false },
125
133
  emailType: { type: 'string', required: false },
126
134
  tracking: { type: 'boolean', required: false },
127
135
  mailboxId: { type: 'string', required: false },
@@ -145,6 +153,8 @@ export class EmailService {
145
153
  if (replyTo) emailData.replyTo = replyTo;
146
154
  if (replyToEmailId) emailData.replyToEmailId = replyToEmailId;
147
155
  if (relatedId) emailData.relatedId = relatedId;
156
+ if (peopleId) emailData.peopleId = peopleId;
157
+ if (companyId) emailData.companyId = companyId;
148
158
  if (emailType) emailData.emailType = emailType;
149
159
  if (tracking !== undefined) emailData.tracking = tracking;
150
160
  if (mailboxId) emailData.mailboxId = mailboxId;
@@ -250,7 +260,9 @@ export class EmailService {
250
260
  * @param {Array} [params.storageId] - Array of storage IDs for attachments
251
261
  * @param {string} [params.replyTo] - Reply-to email address
252
262
  * @param {string} [params.replyToEmailId] - ID of email this is replying to
253
- * @param {string} [params.relatedId] - Related record ID
263
+ * @param {string} [params.relatedId] - Related record ID (e.g. opportunity)
264
+ * @param {string} [params.peopleId] - Person record ID to link the draft to
265
+ * @param {string} [params.companyId] - Company record ID to link the draft to
254
266
  * @param {string} [params.emailType='marketing'] - Email type: 'marketing' or 'transactional'
255
267
  * @param {boolean} [params.tracking=true] - Enable email tracking (opens, clicks)
256
268
  * @param {string} [params.mailboxId] - Specific mailbox for the draft
@@ -272,6 +284,8 @@ export class EmailService {
272
284
  replyTo,
273
285
  replyToEmailId,
274
286
  relatedId,
287
+ peopleId,
288
+ companyId,
275
289
  emailType,
276
290
  tracking,
277
291
  mailboxId,
@@ -293,6 +307,8 @@ export class EmailService {
293
307
  replyTo,
294
308
  replyToEmailId,
295
309
  relatedId,
310
+ peopleId,
311
+ companyId,
296
312
  emailType,
297
313
  tracking,
298
314
  mailboxId,
@@ -310,6 +326,8 @@ export class EmailService {
310
326
  replyTo: { type: 'string', required: false },
311
327
  replyToEmailId: { type: 'string', required: false },
312
328
  relatedId: { type: 'string', required: false },
329
+ peopleId: { type: 'string', required: false },
330
+ companyId: { type: 'string', required: false },
313
331
  emailType: { type: 'string', required: false },
314
332
  tracking: { type: 'boolean', required: false },
315
333
  mailboxId: { type: 'string', required: false },
@@ -333,6 +351,8 @@ export class EmailService {
333
351
  if (replyTo) draftData.replyTo = replyTo;
334
352
  if (replyToEmailId) draftData.replyToEmailId = replyToEmailId;
335
353
  if (relatedId) draftData.relatedId = relatedId;
354
+ if (peopleId) draftData.peopleId = peopleId;
355
+ if (companyId) draftData.companyId = companyId;
336
356
  if (emailType) draftData.emailType = emailType;
337
357
  if (tracking !== undefined) draftData.tracking = tracking;
338
358
  if (mailboxId) draftData.mailboxId = mailboxId;
@@ -367,6 +387,9 @@ export class EmailService {
367
387
  * @param {Object} [params.variables] - Template variables for substitution
368
388
  * @param {Array} [params.storageId] - Array of storage IDs for attachments
369
389
  * @param {string} [params.replyTo] - Reply-to email address
390
+ * @param {string} [params.relatedId] - Related record ID (e.g. opportunity)
391
+ * @param {string} [params.peopleId] - Person record ID to link the draft to
392
+ * @param {string} [params.companyId] - Company record ID to link the draft to
370
393
  * @param {string} [params.emailType] - Email type: 'marketing' or 'transactional'
371
394
  * @param {boolean} [params.tracking] - Enable email tracking (opens, clicks)
372
395
  * @param {string} [params.mailboxId] - Specific mailbox for the draft
@@ -387,6 +410,9 @@ export class EmailService {
387
410
  variables,
388
411
  storageId,
389
412
  replyTo,
413
+ relatedId,
414
+ peopleId,
415
+ companyId,
390
416
  emailType,
391
417
  tracking,
392
418
  mailboxId,
@@ -407,6 +433,9 @@ export class EmailService {
407
433
  variables,
408
434
  storageId,
409
435
  replyTo,
436
+ relatedId,
437
+ peopleId,
438
+ companyId,
410
439
  emailType,
411
440
  tracking,
412
441
  mailboxId,
@@ -422,6 +451,9 @@ export class EmailService {
422
451
  variables: { type: 'object', required: false },
423
452
  storageId: { type: 'array', required: false },
424
453
  replyTo: { type: 'string', required: false },
454
+ relatedId: { type: 'string', required: false },
455
+ peopleId: { type: 'string', required: false },
456
+ companyId: { type: 'string', required: false },
425
457
  emailType: { type: 'string', required: false },
426
458
  tracking: { type: 'boolean', required: false },
427
459
  mailboxId: { type: 'string', required: false },
@@ -442,6 +474,9 @@ export class EmailService {
442
474
  if (variables !== undefined) updateData.variables = variables;
443
475
  if (storageId !== undefined) updateData.storageId = storageId;
444
476
  if (replyTo !== undefined) updateData.replyTo = replyTo;
477
+ if (relatedId !== undefined) updateData.relatedId = relatedId;
478
+ if (peopleId !== undefined) updateData.peopleId = peopleId;
479
+ if (companyId !== undefined) updateData.companyId = companyId;
445
480
  if (emailType !== undefined) updateData.emailType = emailType;
446
481
  if (tracking !== undefined) updateData.tracking = tracking;
447
482
  if (mailboxId !== undefined) updateData.mailboxId = mailboxId;
@@ -1165,6 +1165,35 @@ export class ObjectsService {
1165
1165
  );
1166
1166
  }
1167
1167
 
1168
+ /**
1169
+ * Thread-grouped, record-scoped emails for a single record (person,
1170
+ * company, or opportunity) — filtered mailbox view used by the `email`
1171
+ * layout section (see schemas/layouts/section.js).
1172
+ * @param {string} recordId
1173
+ * @param {object} [options]
1174
+ * @param {number} [options.limit]
1175
+ * @param {number} [options.offset]
1176
+ * @param {string} [options.search]
1177
+ * @param {string} [options.mailboxId]
1178
+ * @param {boolean} [options.unreadOnly]
1179
+ * @returns {Promise<{threads: object[], total: number, unreadCount: number, mailboxes: object[]}>}
1180
+ */
1181
+ async getRecordEmails(recordId, { limit, offset, search, mailboxId, unreadOnly } = {}) {
1182
+ this.sdk.validateParams(
1183
+ { recordId },
1184
+ { recordId: { type: 'string', required: true } },
1185
+ );
1186
+ const query = {};
1187
+ if (limit) query.limit = limit;
1188
+ if (offset) query.offset = offset;
1189
+ if (search) query.search = search;
1190
+ if (mailboxId) query.mailboxId = mailboxId;
1191
+ if (unreadOnly) query.unreadOnly = unreadOnly;
1192
+ return internalRequest(this.sdk, `/object/${recordId}/emails`, 'GET', {
1193
+ query,
1194
+ });
1195
+ }
1196
+
1168
1197
  /**
1169
1198
  * Marketing programs dashboard (programs + totals).
1170
1199
  * @returns {Promise<object>}
@@ -844,4 +844,25 @@ export class TaskService {
844
844
  const result = await internalRequest(this.sdk, '/taskRouter/tasks/', 'PUT', params);
845
845
  return result;
846
846
  }
847
+
848
+ /**
849
+ * Get the voice transcript for a task, keyed by the media-manager
850
+ * bridgeId (not sipCallId) so it works across requeue/transfer.
851
+ *
852
+ * @param {string} taskId - The task ID to fetch a transcript for
853
+ * @returns {Promise<Object>} { bridgeId, messages } — bridgeId is null
854
+ * and messages is [] for chat/email tasks or tasks with no bridge yet.
855
+ */
856
+ async getTranscript(taskId) {
857
+ this.sdk.validateParams(
858
+ { taskId },
859
+ { taskId: { type: 'string', required: true } },
860
+ );
861
+ return await internalRequest(
862
+ this.sdk,
863
+ `/taskRouter/tasks/${taskId}/transcript`,
864
+ 'GET',
865
+ {},
866
+ );
867
+ }
847
868
  }