@heymantle/core-api-client 0.1.25 → 0.1.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/README.md +626 -87
- package/dist/index.d.mts +495 -1
- package/dist/index.d.ts +495 -1
- package/dist/index.js +217 -0
- package/dist/index.mjs +216 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -261,6 +261,13 @@ const { contact } = await client.contacts.update('contact_123', {
|
|
|
261
261
|
|
|
262
262
|
// Retrieve a contact
|
|
263
263
|
const { contact } = await client.contacts.retrieve('contact_123');
|
|
264
|
+
|
|
265
|
+
// Delete a contact
|
|
266
|
+
await client.contacts.del('contact_123');
|
|
267
|
+
|
|
268
|
+
// Add/remove tags
|
|
269
|
+
await client.contacts.addTags('contact_123', ['vip', 'decision-maker']);
|
|
270
|
+
await client.contacts.removeTags('contact_123', ['trial']);
|
|
264
271
|
```
|
|
265
272
|
|
|
266
273
|
### Subscriptions
|
|
@@ -381,10 +388,16 @@ const { deal } = await client.deals.update('deal_123', {
|
|
|
381
388
|
await client.deals.del('deal_123');
|
|
382
389
|
|
|
383
390
|
// Get deal timeline
|
|
384
|
-
const { events } = await client.deals.
|
|
391
|
+
const { events } = await client.deals.timeline('deal_123');
|
|
385
392
|
|
|
386
393
|
// Get deal events
|
|
387
|
-
const { events } = await client.deals.
|
|
394
|
+
const { events } = await client.deals.listEvents('deal_123');
|
|
395
|
+
|
|
396
|
+
// Create a deal event
|
|
397
|
+
const { event } = await client.deals.createEvent('deal_123', {
|
|
398
|
+
type: 'note',
|
|
399
|
+
description: 'Called the customer to discuss pricing',
|
|
400
|
+
});
|
|
388
401
|
```
|
|
389
402
|
|
|
390
403
|
### Deal Flows
|
|
@@ -710,11 +723,26 @@ const { channel } = await client.channels.create({
|
|
|
710
723
|
|
|
711
724
|
### Agents
|
|
712
725
|
|
|
713
|
-
|
|
726
|
+
Manage support agents:
|
|
714
727
|
|
|
715
728
|
```typescript
|
|
716
729
|
// List agents
|
|
717
730
|
const { agents } = await client.agents.list();
|
|
731
|
+
|
|
732
|
+
// Retrieve an agent
|
|
733
|
+
const { agent } = await client.agents.retrieve('agent_123');
|
|
734
|
+
|
|
735
|
+
// Create an agent
|
|
736
|
+
const { agent } = await client.agents.create({
|
|
737
|
+
email: 'agent@company.com',
|
|
738
|
+
name: 'Support Agent',
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
// Find or create an agent (upsert by email)
|
|
742
|
+
const { agent } = await client.agents.findOrCreate({
|
|
743
|
+
email: 'agent@company.com',
|
|
744
|
+
name: 'Support Agent',
|
|
745
|
+
});
|
|
718
746
|
```
|
|
719
747
|
|
|
720
748
|
### Metrics
|
|
@@ -798,6 +826,12 @@ const metricData = await client.metrics.usageMetric({
|
|
|
798
826
|
dateRange: 'last_30_days',
|
|
799
827
|
});
|
|
800
828
|
|
|
829
|
+
// Sales metrics
|
|
830
|
+
const salesData = await client.metrics.sales({
|
|
831
|
+
appId: 'app_123',
|
|
832
|
+
dateRange: 'last_30_days',
|
|
833
|
+
});
|
|
834
|
+
|
|
801
835
|
// Custom metric query
|
|
802
836
|
const data = await client.metrics.fetch({
|
|
803
837
|
metric: 'PlatformApp.activeInstalls',
|
|
@@ -935,11 +969,6 @@ const { commissions, hasNextPage } = await client.affiliateCommissions.list({
|
|
|
935
969
|
|
|
936
970
|
// Retrieve a commission
|
|
937
971
|
const { commission } = await client.affiliateCommissions.retrieve('commission_123');
|
|
938
|
-
|
|
939
|
-
// Update a commission
|
|
940
|
-
const { commission } = await client.affiliateCommissions.update('commission_123', {
|
|
941
|
-
status: 'approved',
|
|
942
|
-
});
|
|
943
972
|
```
|
|
944
973
|
|
|
945
974
|
### Affiliate Payouts
|
|
@@ -953,13 +982,6 @@ const { payouts, hasNextPage } = await client.affiliatePayouts.list({
|
|
|
953
982
|
|
|
954
983
|
// Retrieve a payout
|
|
955
984
|
const { payout } = await client.affiliatePayouts.retrieve('payout_123');
|
|
956
|
-
|
|
957
|
-
// Create a payout
|
|
958
|
-
const { payout } = await client.affiliatePayouts.create({
|
|
959
|
-
affiliateId: 'affiliate_123',
|
|
960
|
-
amount: 10000, // $100.00
|
|
961
|
-
currencyCode: 'USD',
|
|
962
|
-
});
|
|
963
985
|
```
|
|
964
986
|
|
|
965
987
|
### Affiliate Referrals
|
|
@@ -1010,51 +1032,75 @@ const { customerSegments } = await client.customerSegments.list();
|
|
|
1010
1032
|
|
|
1011
1033
|
// Retrieve a segment
|
|
1012
1034
|
const { customerSegment } = await client.customerSegments.retrieve('segment_123');
|
|
1013
|
-
|
|
1014
|
-
// Create a segment
|
|
1015
|
-
const { customerSegment } = await client.customerSegments.create({
|
|
1016
|
-
name: 'Enterprise Customers',
|
|
1017
|
-
filters: { lifetimeValue: { gte: 10000 } },
|
|
1018
|
-
});
|
|
1019
|
-
|
|
1020
|
-
// Update a segment
|
|
1021
|
-
const { customerSegment } = await client.customerSegments.update('segment_123', {
|
|
1022
|
-
name: 'Enterprise Customers (Updated)',
|
|
1023
|
-
});
|
|
1024
|
-
|
|
1025
|
-
// Delete a segment
|
|
1026
|
-
await client.customerSegments.del('segment_123');
|
|
1027
1035
|
```
|
|
1028
1036
|
|
|
1029
1037
|
### Tasks
|
|
1030
1038
|
|
|
1039
|
+
Tasks support todo items as a nested sub-resource. Updating a task's status can trigger deal progression if the task is linked to a deal activity.
|
|
1040
|
+
|
|
1031
1041
|
```typescript
|
|
1032
1042
|
// List tasks
|
|
1033
1043
|
const { tasks, hasNextPage } = await client.tasks.list({
|
|
1034
|
-
status: '
|
|
1035
|
-
|
|
1044
|
+
status: 'new', // 'new' | 'in_progress' | 'complete'
|
|
1045
|
+
priority: 'high', // 'low' | 'medium' | 'high'
|
|
1046
|
+
assigneeId: 'user_123',
|
|
1036
1047
|
customerId: 'cust_123',
|
|
1048
|
+
dealId: 'deal_123',
|
|
1037
1049
|
});
|
|
1038
1050
|
|
|
1039
1051
|
// Retrieve a task
|
|
1040
1052
|
const { task } = await client.tasks.retrieve('task_123');
|
|
1041
1053
|
|
|
1042
|
-
// Create a task
|
|
1043
|
-
const
|
|
1054
|
+
// Create a task with todo items
|
|
1055
|
+
const task = await client.tasks.create({
|
|
1044
1056
|
title: 'Follow up with customer',
|
|
1045
1057
|
description: 'Discuss renewal options',
|
|
1046
|
-
|
|
1047
|
-
|
|
1058
|
+
priority: 'high',
|
|
1059
|
+
dueDate: '2024-02-15',
|
|
1060
|
+
assigneeId: 'user_123',
|
|
1048
1061
|
customerId: 'cust_123',
|
|
1062
|
+
dealId: 'deal_123',
|
|
1063
|
+
dealActivityId: 'activity_123',
|
|
1064
|
+
tags: ['follow-up'],
|
|
1065
|
+
todoItems: [
|
|
1066
|
+
{ content: 'Prepare pricing proposal', completed: false },
|
|
1067
|
+
{ content: 'Review contract terms', completed: false },
|
|
1068
|
+
],
|
|
1049
1069
|
});
|
|
1050
1070
|
|
|
1051
|
-
// Update a task
|
|
1052
|
-
const { task } = await client.tasks.update('task_123', {
|
|
1053
|
-
status: '
|
|
1071
|
+
// Update a task (may trigger deal progression)
|
|
1072
|
+
const { task, dealProgressed, dealProgression } = await client.tasks.update('task_123', {
|
|
1073
|
+
status: 'complete',
|
|
1054
1074
|
});
|
|
1075
|
+
if (dealProgressed) {
|
|
1076
|
+
console.log(`Deal "${dealProgression.dealName}" moved to stage "${dealProgression.nextStage.name}"`);
|
|
1077
|
+
}
|
|
1055
1078
|
|
|
1056
1079
|
// Delete a task
|
|
1057
1080
|
await client.tasks.del('task_123');
|
|
1081
|
+
|
|
1082
|
+
// --- Todo Items ---
|
|
1083
|
+
|
|
1084
|
+
// List todo items for a task
|
|
1085
|
+
const { items, total } = await client.tasks.listTodoItems('task_123');
|
|
1086
|
+
|
|
1087
|
+
// Retrieve a todo item
|
|
1088
|
+
const { item } = await client.tasks.retrieveTodoItem('task_123', 'item_123');
|
|
1089
|
+
|
|
1090
|
+
// Create a todo item
|
|
1091
|
+
const { item } = await client.tasks.createTodoItem('task_123', {
|
|
1092
|
+
content: 'Send follow-up email',
|
|
1093
|
+
completed: false,
|
|
1094
|
+
displayOrder: 3,
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
// Update a todo item
|
|
1098
|
+
const { item } = await client.tasks.updateTodoItem('task_123', 'item_123', {
|
|
1099
|
+
completed: true,
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
// Delete a todo item
|
|
1103
|
+
await client.tasks.deleteTodoItem('task_123', 'item_123');
|
|
1058
1104
|
```
|
|
1059
1105
|
|
|
1060
1106
|
### Flows (Automation)
|
|
@@ -1102,9 +1148,6 @@ const { charges, hasNextPage } = await client.charges.list({
|
|
|
1102
1148
|
customerId: 'cust_123',
|
|
1103
1149
|
appId: 'app_123',
|
|
1104
1150
|
});
|
|
1105
|
-
|
|
1106
|
-
// Retrieve a charge
|
|
1107
|
-
const { charge } = await client.charges.retrieve('charge_123');
|
|
1108
1151
|
```
|
|
1109
1152
|
|
|
1110
1153
|
### Users
|
|
@@ -1129,63 +1172,417 @@ const { organization } = await client.organization.retrieve();
|
|
|
1129
1172
|
|
|
1130
1173
|
### Documentation
|
|
1131
1174
|
|
|
1175
|
+
Manage documentation collections, groups, pages, repositories, and the doc tree:
|
|
1176
|
+
|
|
1132
1177
|
```typescript
|
|
1133
|
-
//
|
|
1178
|
+
// --- Collections ---
|
|
1134
1179
|
const { collections } = await client.docs.listCollections();
|
|
1135
|
-
|
|
1136
|
-
// Retrieve a collection
|
|
1137
1180
|
const { collection } = await client.docs.retrieveCollection('collection_123');
|
|
1181
|
+
const { collection } = await client.docs.createCollection({
|
|
1182
|
+
name: 'API Docs',
|
|
1183
|
+
slug: 'api-docs',
|
|
1184
|
+
description: 'API documentation',
|
|
1185
|
+
});
|
|
1186
|
+
const { collection } = await client.docs.updateCollection('collection_123', {
|
|
1187
|
+
name: 'Updated API Docs',
|
|
1188
|
+
});
|
|
1189
|
+
await client.docs.deleteCollection('collection_123');
|
|
1138
1190
|
|
|
1139
|
-
//
|
|
1191
|
+
// --- Groups ---
|
|
1192
|
+
const { groups } = await client.docs.listGroups();
|
|
1193
|
+
const { group } = await client.docs.retrieveGroup('group_123');
|
|
1194
|
+
const { group } = await client.docs.createGroup({ name: 'Guides' });
|
|
1195
|
+
const { group } = await client.docs.updateGroup('group_123', { name: 'Updated Guides' });
|
|
1196
|
+
await client.docs.deleteGroup('group_123');
|
|
1197
|
+
|
|
1198
|
+
// --- Pages ---
|
|
1140
1199
|
const { pages } = await client.docs.listPages({
|
|
1141
1200
|
collectionId: 'collection_123',
|
|
1142
1201
|
});
|
|
1143
|
-
|
|
1144
|
-
// Retrieve a page
|
|
1145
1202
|
const { page } = await client.docs.retrievePage('page_123');
|
|
1146
|
-
|
|
1147
|
-
// Create a page
|
|
1148
1203
|
const { page } = await client.docs.createPage({
|
|
1149
1204
|
title: 'Getting Started',
|
|
1150
1205
|
content: '# Getting Started\n\nWelcome to our docs...',
|
|
1151
1206
|
collectionId: 'collection_123',
|
|
1152
1207
|
});
|
|
1153
|
-
|
|
1154
|
-
// Update a page
|
|
1155
1208
|
const { page } = await client.docs.updatePage('page_123', {
|
|
1156
1209
|
content: 'Updated content',
|
|
1157
1210
|
});
|
|
1158
|
-
|
|
1159
|
-
|
|
1211
|
+
const { page } = await client.docs.publishPage('page_123');
|
|
1212
|
+
const { page } = await client.docs.archivePage('page_123');
|
|
1160
1213
|
await client.docs.deletePage('page_123');
|
|
1214
|
+
|
|
1215
|
+
// --- Tree ---
|
|
1216
|
+
const { tree } = await client.docs.getTree();
|
|
1217
|
+
|
|
1218
|
+
// --- Repositories ---
|
|
1219
|
+
const { repositories } = await client.docs.listRepositories();
|
|
1220
|
+
const { repository } = await client.docs.retrieveRepository('repo_123');
|
|
1161
1221
|
```
|
|
1162
1222
|
|
|
1163
1223
|
### Entities
|
|
1164
1224
|
|
|
1165
|
-
|
|
1225
|
+
Unified search across contacts and customers:
|
|
1226
|
+
|
|
1227
|
+
```typescript
|
|
1228
|
+
// Search entities (returns contacts and customers in a single result set)
|
|
1229
|
+
const { entities, hasNextPage } = await client.entities.search({
|
|
1230
|
+
search: 'acme',
|
|
1231
|
+
take: 25,
|
|
1232
|
+
});
|
|
1233
|
+
|
|
1234
|
+
// Each entity has a _type discriminator
|
|
1235
|
+
entities.forEach((entity) => {
|
|
1236
|
+
if (entity._type === 'customer') {
|
|
1237
|
+
console.log('Customer:', entity.name, entity.domain);
|
|
1238
|
+
} else if (entity._type === 'contact') {
|
|
1239
|
+
console.log('Contact:', entity.name, entity.email);
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
```
|
|
1243
|
+
|
|
1244
|
+
### Meetings
|
|
1245
|
+
|
|
1246
|
+
Record, transcribe, and analyze meetings with AI enrichment:
|
|
1166
1247
|
|
|
1167
1248
|
```typescript
|
|
1168
|
-
// List
|
|
1169
|
-
const {
|
|
1170
|
-
|
|
1249
|
+
// List meetings
|
|
1250
|
+
const { meetings, hasNextPage } = await client.meetings.list({
|
|
1251
|
+
dealId: 'deal_123',
|
|
1252
|
+
customerId: 'cust_123',
|
|
1253
|
+
platform: 'google_meet', // 'google_meet' | 'zoom' | 'teams'
|
|
1254
|
+
startTimeFrom: '2024-01-01T00:00:00Z',
|
|
1255
|
+
startTimeTo: '2024-12-31T23:59:59Z',
|
|
1256
|
+
search: 'quarterly review',
|
|
1257
|
+
includeArchived: false,
|
|
1171
1258
|
});
|
|
1172
1259
|
|
|
1173
|
-
// Retrieve
|
|
1174
|
-
const
|
|
1260
|
+
// Retrieve a meeting (includes attendees, transcript, AI insights)
|
|
1261
|
+
const meeting = await client.meetings.retrieve('meeting_123');
|
|
1175
1262
|
|
|
1176
|
-
// Create
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1263
|
+
// Create a meeting with attendees and transcript
|
|
1264
|
+
const meeting = await client.meetings.create({
|
|
1265
|
+
meetingData: {
|
|
1266
|
+
title: 'Q1 Review',
|
|
1267
|
+
platform: 'zoom',
|
|
1268
|
+
startTime: '2024-01-15T14:00:00Z',
|
|
1269
|
+
endTime: '2024-01-15T15:00:00Z',
|
|
1270
|
+
duration: 3600,
|
|
1271
|
+
dealId: 'deal_123',
|
|
1272
|
+
customerId: 'cust_123',
|
|
1273
|
+
},
|
|
1274
|
+
attendees: [
|
|
1275
|
+
{ name: 'John Doe', email: 'john@acme.com', externalId: 'A' },
|
|
1276
|
+
{ name: 'Jane Smith', email: 'jane@company.com', externalId: 'B' },
|
|
1277
|
+
],
|
|
1278
|
+
transcript: {
|
|
1279
|
+
language: 'en',
|
|
1280
|
+
utterances: [
|
|
1281
|
+
{ attendeeId: 'A', text: 'Welcome to the review.', startTime: 0, endTime: 3000, sequence: 1 },
|
|
1282
|
+
{ attendeeId: 'B', text: 'Thanks for having me.', startTime: 3500, endTime: 6000, sequence: 2 },
|
|
1283
|
+
],
|
|
1284
|
+
},
|
|
1180
1285
|
});
|
|
1181
1286
|
|
|
1182
|
-
// Update
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1287
|
+
// Update a meeting
|
|
1288
|
+
const meeting = await client.meetings.update('meeting_123', {
|
|
1289
|
+
title: 'Q1 Business Review',
|
|
1290
|
+
dealId: 'deal_456',
|
|
1185
1291
|
});
|
|
1186
1292
|
|
|
1187
|
-
// Delete
|
|
1188
|
-
await client.
|
|
1293
|
+
// Delete a meeting
|
|
1294
|
+
await client.meetings.del('meeting_123');
|
|
1295
|
+
|
|
1296
|
+
// --- Recording Upload & Transcription Workflow ---
|
|
1297
|
+
|
|
1298
|
+
// Step 1: Get a signed upload URL
|
|
1299
|
+
const { uploadUrl, recordingKey, expiresIn } = await client.meetings.getUploadUrl('meeting_123', 'recording.webm');
|
|
1300
|
+
|
|
1301
|
+
// Step 2: Upload the file to the signed URL (use fetch/axios)
|
|
1302
|
+
await fetch(uploadUrl, { method: 'PUT', body: recordingFile });
|
|
1303
|
+
|
|
1304
|
+
// Step 3: Start transcription
|
|
1305
|
+
const meeting = await client.meetings.startTranscription('meeting_123', { recordingKey });
|
|
1306
|
+
|
|
1307
|
+
// Step 4: Check transcription status
|
|
1308
|
+
const status = await client.meetings.getTranscriptionStatus('meeting_123');
|
|
1309
|
+
console.log(status.recordingStatus); // 'pending' | 'processing' | 'ready' | 'failed'
|
|
1310
|
+
|
|
1311
|
+
// Get a signed recording playback URL
|
|
1312
|
+
const { recordingUrl, expiresIn } = await client.meetings.getRecordingUrl('meeting_123');
|
|
1313
|
+
|
|
1314
|
+
// --- Attendee Management ---
|
|
1315
|
+
|
|
1316
|
+
// Update an attendee (link to a contact, etc.)
|
|
1317
|
+
const { attendee } = await client.meetings.updateAttendee('meeting_123', 'attendee_123', {
|
|
1318
|
+
name: 'John Doe',
|
|
1319
|
+
email: 'john@acme.com',
|
|
1320
|
+
contactId: 'contact_123',
|
|
1321
|
+
});
|
|
1322
|
+
|
|
1323
|
+
// Update by external ID instead of attendee ID
|
|
1324
|
+
const { attendee } = await client.meetings.updateAttendee('meeting_123', 'A', {
|
|
1325
|
+
contactId: 'contact_123',
|
|
1326
|
+
}, { useExternalId: true });
|
|
1327
|
+
|
|
1328
|
+
// --- AI Task Suggestions ---
|
|
1329
|
+
|
|
1330
|
+
// Accept an AI-generated task suggestion (with optional overrides)
|
|
1331
|
+
const { task, suggestion } = await client.meetings.acceptTaskSuggestion('meeting_123', 'suggestion_123', {
|
|
1332
|
+
title: 'Custom task title',
|
|
1333
|
+
assigneeId: 'user_123',
|
|
1334
|
+
priority: 'high',
|
|
1335
|
+
});
|
|
1336
|
+
|
|
1337
|
+
// Dismiss a task suggestion
|
|
1338
|
+
await client.meetings.dismissTaskSuggestion('meeting_123', 'suggestion_123');
|
|
1339
|
+
```
|
|
1340
|
+
|
|
1341
|
+
### AI Agent Runs
|
|
1342
|
+
|
|
1343
|
+
Execute AI agents and poll for results:
|
|
1344
|
+
|
|
1345
|
+
```typescript
|
|
1346
|
+
// Create an agent run (returns immediately with 202 Accepted)
|
|
1347
|
+
const { run } = await client.aiAgentRuns.create('agent_123', {
|
|
1348
|
+
input: { customerId: 'cust_123' },
|
|
1349
|
+
context: 'Analyze this customer for churn risk',
|
|
1350
|
+
variables: { tone: 'professional' },
|
|
1351
|
+
});
|
|
1352
|
+
console.log(run.status); // 'pending'
|
|
1353
|
+
|
|
1354
|
+
// Check the run status
|
|
1355
|
+
const { run } = await client.aiAgentRuns.retrieve('agent_123', run.id);
|
|
1356
|
+
console.log(run.status); // 'pending' | 'running' | 'completed' | 'error'
|
|
1357
|
+
|
|
1358
|
+
// Convenience: create and wait for completion (polls automatically)
|
|
1359
|
+
const completedRun = await client.aiAgentRuns.createAndWait('agent_123', {
|
|
1360
|
+
input: { query: 'Summarize recent activity' },
|
|
1361
|
+
}, {
|
|
1362
|
+
timeout: 60000, // Max wait time in ms (default: 30000)
|
|
1363
|
+
pollInterval: 2000, // Polling interval in ms (default: 1000)
|
|
1364
|
+
});
|
|
1365
|
+
console.log(completedRun.response);
|
|
1366
|
+
console.log(completedRun.structuredResponse);
|
|
1367
|
+
console.log(completedRun.tokenUsage);
|
|
1368
|
+
```
|
|
1369
|
+
|
|
1370
|
+
### Custom Data
|
|
1371
|
+
|
|
1372
|
+
Set and retrieve custom data fields on resources:
|
|
1373
|
+
|
|
1374
|
+
```typescript
|
|
1375
|
+
// Supported resource types: 'ticket' | 'customer' | 'contact' | 'deal' | 'conversation'
|
|
1376
|
+
|
|
1377
|
+
// Set a custom data value
|
|
1378
|
+
await client.customData.set({
|
|
1379
|
+
resourceId: 'cust_123',
|
|
1380
|
+
resourceType: 'customer',
|
|
1381
|
+
key: 'industry',
|
|
1382
|
+
value: 'Technology',
|
|
1383
|
+
});
|
|
1384
|
+
|
|
1385
|
+
// Get a custom data value
|
|
1386
|
+
const data = await client.customData.getValue({
|
|
1387
|
+
resourceId: 'cust_123',
|
|
1388
|
+
resourceType: 'customer',
|
|
1389
|
+
key: 'industry',
|
|
1390
|
+
});
|
|
1391
|
+
console.log(data.value); // 'Technology'
|
|
1392
|
+
|
|
1393
|
+
// Delete a custom data value
|
|
1394
|
+
await client.customData.del({
|
|
1395
|
+
resourceId: 'cust_123',
|
|
1396
|
+
resourceType: 'customer',
|
|
1397
|
+
key: 'industry',
|
|
1398
|
+
});
|
|
1399
|
+
```
|
|
1400
|
+
|
|
1401
|
+
### Lists
|
|
1402
|
+
|
|
1403
|
+
Organize customers and contacts into lists:
|
|
1404
|
+
|
|
1405
|
+
```typescript
|
|
1406
|
+
// List all lists
|
|
1407
|
+
const { lists, hasNextPage } = await client.lists.list({
|
|
1408
|
+
all: true, // Include all lists without pagination
|
|
1409
|
+
});
|
|
1410
|
+
|
|
1411
|
+
// Retrieve a list with its entities
|
|
1412
|
+
const { list, entities, hasNextPage } = await client.lists.retrieve('list_123', {
|
|
1413
|
+
page: 0,
|
|
1414
|
+
take: 25,
|
|
1415
|
+
type: 'customer', // Filter by entity type: 'customer' | 'contact'
|
|
1416
|
+
search: 'acme',
|
|
1417
|
+
sort: 'name',
|
|
1418
|
+
sortDirection: 'asc',
|
|
1419
|
+
});
|
|
1420
|
+
|
|
1421
|
+
// Create a list
|
|
1422
|
+
const { list } = await client.lists.create({
|
|
1423
|
+
name: 'Enterprise Accounts',
|
|
1424
|
+
description: 'Top-tier enterprise customers',
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
// Update a list
|
|
1428
|
+
const { list } = await client.lists.update('list_123', {
|
|
1429
|
+
name: 'Updated Name',
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
// Delete a list
|
|
1433
|
+
await client.lists.del('list_123');
|
|
1434
|
+
|
|
1435
|
+
// Add entities to a list
|
|
1436
|
+
const { added, skipped } = await client.lists.addEntities('list_123', {
|
|
1437
|
+
customerIds: ['cust_123', 'cust_456'],
|
|
1438
|
+
contactIds: ['contact_123'],
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
// Remove entities from a list
|
|
1442
|
+
const { removed } = await client.lists.removeEntities('list_123', {
|
|
1443
|
+
customerIds: ['cust_456'],
|
|
1444
|
+
});
|
|
1445
|
+
```
|
|
1446
|
+
|
|
1447
|
+
### Timeline Comments
|
|
1448
|
+
|
|
1449
|
+
Add comments to customer and contact timelines:
|
|
1450
|
+
|
|
1451
|
+
```typescript
|
|
1452
|
+
// List timeline comments
|
|
1453
|
+
const { timelineComments, hasNextPage } = await client.timelineComments.list({
|
|
1454
|
+
customerId: 'cust_123',
|
|
1455
|
+
// or contactId: 'contact_123',
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1458
|
+
// Retrieve a comment
|
|
1459
|
+
const { timelineComment } = await client.timelineComments.retrieve('comment_123');
|
|
1460
|
+
|
|
1461
|
+
// Create a comment with attachments and tagged users
|
|
1462
|
+
const { timelineComment } = await client.timelineComments.create({
|
|
1463
|
+
customerId: 'cust_123',
|
|
1464
|
+
body: 'Discussed renewal terms with @John',
|
|
1465
|
+
attachments: [
|
|
1466
|
+
{ filename: 'notes.pdf', url: 'https://storage.example.com/notes.pdf' },
|
|
1467
|
+
],
|
|
1468
|
+
taggedUsers: [
|
|
1469
|
+
{ userId: 'user_123' },
|
|
1470
|
+
],
|
|
1471
|
+
});
|
|
1472
|
+
|
|
1473
|
+
// Update a comment
|
|
1474
|
+
const { timelineComment } = await client.timelineComments.update('comment_123', {
|
|
1475
|
+
body: 'Updated comment text',
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
// Delete a comment
|
|
1479
|
+
await client.timelineComments.del('comment_123');
|
|
1480
|
+
```
|
|
1481
|
+
|
|
1482
|
+
### Journal Entries
|
|
1483
|
+
|
|
1484
|
+
Track journal entries for apps:
|
|
1485
|
+
|
|
1486
|
+
```typescript
|
|
1487
|
+
// List journal entries
|
|
1488
|
+
const { journalEntries, hasNextPage } = await client.journalEntries.list({
|
|
1489
|
+
appId: 'app_123',
|
|
1490
|
+
startDate: '2024-01-01',
|
|
1491
|
+
endDate: '2024-12-31',
|
|
1492
|
+
tags: ['release', 'update'],
|
|
1493
|
+
});
|
|
1494
|
+
|
|
1495
|
+
// Retrieve a journal entry
|
|
1496
|
+
const { journalEntry } = await client.journalEntries.retrieve('entry_123');
|
|
1497
|
+
|
|
1498
|
+
// Create a journal entry
|
|
1499
|
+
const { journalEntry } = await client.journalEntries.create({
|
|
1500
|
+
date: '2024-01-15',
|
|
1501
|
+
title: 'v2.0 Release',
|
|
1502
|
+
description: 'Major release with new billing features',
|
|
1503
|
+
appId: 'app_123',
|
|
1504
|
+
tags: ['release'],
|
|
1505
|
+
url: 'https://changelog.example.com/v2',
|
|
1506
|
+
emoji: '🚀',
|
|
1507
|
+
});
|
|
1508
|
+
|
|
1509
|
+
// Update a journal entry
|
|
1510
|
+
const { journalEntry } = await client.journalEntries.update('entry_123', {
|
|
1511
|
+
description: 'Updated description',
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1514
|
+
// Delete a journal entry
|
|
1515
|
+
await client.journalEntries.del('entry_123');
|
|
1516
|
+
```
|
|
1517
|
+
|
|
1518
|
+
### Email Unsubscribe Groups
|
|
1519
|
+
|
|
1520
|
+
Manage email unsubscribe groups and their members:
|
|
1521
|
+
|
|
1522
|
+
```typescript
|
|
1523
|
+
// List unsubscribe groups
|
|
1524
|
+
const { unsubscribeGroups } = await client.emailUnsubscribeGroups.list();
|
|
1525
|
+
|
|
1526
|
+
// Retrieve an unsubscribe group
|
|
1527
|
+
const { unsubscribeGroup } = await client.emailUnsubscribeGroups.retrieve('group_123');
|
|
1528
|
+
|
|
1529
|
+
// List members of a group
|
|
1530
|
+
const { members, hasNextPage } = await client.emailUnsubscribeGroups.listMembers('group_123');
|
|
1531
|
+
|
|
1532
|
+
// Add members to a group
|
|
1533
|
+
const result = await client.emailUnsubscribeGroups.addMembers('group_123', {
|
|
1534
|
+
emails: ['user1@example.com', 'user2@example.com'],
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1537
|
+
// Remove multiple members
|
|
1538
|
+
await client.emailUnsubscribeGroups.removeMembers('group_123', {
|
|
1539
|
+
emails: ['user1@example.com'],
|
|
1540
|
+
});
|
|
1541
|
+
|
|
1542
|
+
// Remove a single member by ID
|
|
1543
|
+
await client.emailUnsubscribeGroups.removeMember('group_123', 'member_123');
|
|
1544
|
+
```
|
|
1545
|
+
|
|
1546
|
+
### Flow Extensions
|
|
1547
|
+
|
|
1548
|
+
Extend automation flows with custom actions:
|
|
1549
|
+
|
|
1550
|
+
```typescript
|
|
1551
|
+
// List flow extension actions
|
|
1552
|
+
const { actions, hasNextPage } = await client.flowExtensions.listActions({
|
|
1553
|
+
enabled: true,
|
|
1554
|
+
});
|
|
1555
|
+
|
|
1556
|
+
// Retrieve an action
|
|
1557
|
+
const { action } = await client.flowExtensions.retrieveAction('action_123');
|
|
1558
|
+
|
|
1559
|
+
// Create a custom action
|
|
1560
|
+
const { action } = await client.flowExtensions.createAction({
|
|
1561
|
+
name: 'Send Slack Notification',
|
|
1562
|
+
description: 'Posts a message to a Slack channel',
|
|
1563
|
+
key: 'send_slack_notification',
|
|
1564
|
+
schema: {
|
|
1565
|
+
channel: { type: 'string', required: true },
|
|
1566
|
+
message: { type: 'string', required: true },
|
|
1567
|
+
},
|
|
1568
|
+
callbackUrl: 'https://your-app.com/flow-actions/slack',
|
|
1569
|
+
enabled: true,
|
|
1570
|
+
});
|
|
1571
|
+
|
|
1572
|
+
// Update an action
|
|
1573
|
+
const { action } = await client.flowExtensions.updateAction('action_123', {
|
|
1574
|
+
description: 'Updated description',
|
|
1575
|
+
enabled: false,
|
|
1576
|
+
});
|
|
1577
|
+
|
|
1578
|
+
// Delete an action
|
|
1579
|
+
await client.flowExtensions.deleteAction('action_123');
|
|
1580
|
+
|
|
1581
|
+
// Update a flow action run status (called from your callback handler)
|
|
1582
|
+
const { run } = await client.flowExtensions.updateActionRun('run_123', {
|
|
1583
|
+
status: 'completed', // 'pending' | 'running' | 'completed' | 'failed'
|
|
1584
|
+
output: { messageId: 'slack_msg_123' },
|
|
1585
|
+
});
|
|
1189
1586
|
```
|
|
1190
1587
|
|
|
1191
1588
|
## Pagination
|
|
@@ -1212,6 +1609,7 @@ import {
|
|
|
1212
1609
|
MantleAPIError,
|
|
1213
1610
|
MantleAuthenticationError,
|
|
1214
1611
|
MantlePermissionError,
|
|
1612
|
+
MantleNotFoundError,
|
|
1215
1613
|
MantleValidationError,
|
|
1216
1614
|
MantleRateLimitError,
|
|
1217
1615
|
} from '@heymantle/core-api-client';
|
|
@@ -1225,6 +1623,9 @@ try {
|
|
|
1225
1623
|
} else if (error instanceof MantlePermissionError) {
|
|
1226
1624
|
// Handle permission error (403)
|
|
1227
1625
|
console.log('Access denied');
|
|
1626
|
+
} else if (error instanceof MantleNotFoundError) {
|
|
1627
|
+
// Handle not found error (404)
|
|
1628
|
+
console.log('Resource not found');
|
|
1228
1629
|
} else if (error instanceof MantleValidationError) {
|
|
1229
1630
|
// Handle validation error (422)
|
|
1230
1631
|
console.log('Validation failed:', error.details);
|
|
@@ -1246,43 +1647,181 @@ All types are exported for use in your application:
|
|
|
1246
1647
|
import type {
|
|
1247
1648
|
// Client config
|
|
1248
1649
|
MantleCoreClientConfig,
|
|
1650
|
+
PaginatedResponse,
|
|
1651
|
+
ListParams,
|
|
1652
|
+
DeleteResponse,
|
|
1249
1653
|
|
|
1250
|
-
//
|
|
1654
|
+
// Customers
|
|
1251
1655
|
Customer,
|
|
1656
|
+
CustomerListParams,
|
|
1657
|
+
CustomerListResponse,
|
|
1658
|
+
CustomerCreateParams,
|
|
1659
|
+
CustomerUpdateParams,
|
|
1660
|
+
AccountOwner,
|
|
1661
|
+
CustomField,
|
|
1662
|
+
|
|
1663
|
+
// Contacts
|
|
1252
1664
|
Contact,
|
|
1665
|
+
ContactCreateParams,
|
|
1666
|
+
ContactCreateResponse,
|
|
1667
|
+
SocialProfile,
|
|
1668
|
+
SocialProfileType,
|
|
1669
|
+
|
|
1670
|
+
// Deals
|
|
1253
1671
|
Deal,
|
|
1672
|
+
DealListParams,
|
|
1673
|
+
DealListResponse,
|
|
1674
|
+
DealCreateParams,
|
|
1675
|
+
DealUpdateParams,
|
|
1676
|
+
DealCustomerInput,
|
|
1677
|
+
DealContactInput,
|
|
1678
|
+
DealFlow,
|
|
1679
|
+
DealStage,
|
|
1680
|
+
DealActivity,
|
|
1681
|
+
DealEvent,
|
|
1682
|
+
DealEventCreateParams,
|
|
1683
|
+
|
|
1684
|
+
// Subscriptions
|
|
1254
1685
|
Subscription,
|
|
1686
|
+
|
|
1687
|
+
// Tickets
|
|
1255
1688
|
Ticket,
|
|
1256
1689
|
TicketMessage,
|
|
1690
|
+
TicketCreateParams,
|
|
1691
|
+
Channel,
|
|
1692
|
+
|
|
1693
|
+
// Apps
|
|
1257
1694
|
App,
|
|
1258
1695
|
Plan,
|
|
1696
|
+
PlanCreateParams,
|
|
1259
1697
|
Feature,
|
|
1698
|
+
UsageMetric,
|
|
1699
|
+
Review,
|
|
1700
|
+
AppEvent,
|
|
1701
|
+
|
|
1702
|
+
// Affiliates
|
|
1260
1703
|
Affiliate,
|
|
1261
1704
|
AffiliateProgram,
|
|
1262
1705
|
AffiliateCommission,
|
|
1263
1706
|
AffiliatePayout,
|
|
1264
1707
|
AffiliateReferral,
|
|
1265
1708
|
|
|
1266
|
-
//
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1709
|
+
// Meetings
|
|
1710
|
+
Meeting,
|
|
1711
|
+
MeetingAttendee,
|
|
1712
|
+
MeetingTranscript,
|
|
1713
|
+
MeetingUtterance,
|
|
1714
|
+
MeetingCreateParams,
|
|
1715
|
+
MeetingUpdateParams,
|
|
1716
|
+
MeetingUploadUrlResponse,
|
|
1717
|
+
MeetingTranscriptionStatusResponse,
|
|
1718
|
+
MeetingKeyPoint,
|
|
1719
|
+
MeetingDecision,
|
|
1720
|
+
MeetingOpenQuestion,
|
|
1721
|
+
MeetingTopic,
|
|
1722
|
+
SentimentDataPoint,
|
|
1723
|
+
MeetingDealInsights,
|
|
1724
|
+
MeetingTaskSuggestion,
|
|
1725
|
+
AcceptTaskSuggestionParams,
|
|
1726
|
+
AcceptTaskSuggestionResponse,
|
|
1727
|
+
|
|
1728
|
+
// AI Agents
|
|
1729
|
+
AgentRun,
|
|
1730
|
+
AgentRunStatus,
|
|
1731
|
+
AgentRunTokenUsage,
|
|
1732
|
+
AgentRunCreateParams,
|
|
1733
|
+
|
|
1734
|
+
// Tasks
|
|
1735
|
+
Task,
|
|
1736
|
+
TaskStatus,
|
|
1737
|
+
TaskPriority,
|
|
1738
|
+
TaskCreateParams,
|
|
1739
|
+
TaskUpdateResponse,
|
|
1740
|
+
DealProgression,
|
|
1741
|
+
TodoItem,
|
|
1742
|
+
TodoItemCreateParams,
|
|
1743
|
+
TodoItemUpdateParams,
|
|
1744
|
+
|
|
1745
|
+
// Lists
|
|
1746
|
+
List,
|
|
1747
|
+
ListEntity,
|
|
1748
|
+
ListCreateParams,
|
|
1749
|
+
ListAddEntitiesParams,
|
|
1750
|
+
ListRemoveEntitiesParams,
|
|
1751
|
+
|
|
1752
|
+
// Timeline Comments
|
|
1753
|
+
TimelineComment,
|
|
1754
|
+
TimelineCommentCreateParams,
|
|
1755
|
+
TimelineCommentAttachmentInput,
|
|
1756
|
+
TimelineCommentTaggedUserInput,
|
|
1757
|
+
|
|
1758
|
+
// Journal Entries
|
|
1759
|
+
JournalEntry,
|
|
1760
|
+
JournalEntryCreateParams,
|
|
1761
|
+
|
|
1762
|
+
// Documentation
|
|
1763
|
+
DocCollection,
|
|
1764
|
+
DocGroup,
|
|
1765
|
+
DocPage,
|
|
1766
|
+
DocPageStatus,
|
|
1767
|
+
DocTreeNode,
|
|
1768
|
+
DocTreeResponse,
|
|
1769
|
+
DocRepository,
|
|
1770
|
+
|
|
1771
|
+
// Entities (unified search)
|
|
1772
|
+
Entity,
|
|
1773
|
+
EntityType,
|
|
1774
|
+
ContactEntity,
|
|
1775
|
+
CustomerEntity,
|
|
1776
|
+
EntitiesSearchParams,
|
|
1777
|
+
|
|
1778
|
+
// Custom Data
|
|
1779
|
+
CustomDataResourceType,
|
|
1780
|
+
CustomDataSetParams,
|
|
1781
|
+
CustomDataResponse,
|
|
1782
|
+
|
|
1783
|
+
// Email
|
|
1784
|
+
EmailUnsubscribeGroup,
|
|
1785
|
+
EmailUnsubscribeGroupMember,
|
|
1786
|
+
|
|
1787
|
+
// Flow Extensions
|
|
1788
|
+
FlowExtensionAction,
|
|
1789
|
+
FlowActionRun,
|
|
1790
|
+
FlowActionRunStatus,
|
|
1791
|
+
|
|
1792
|
+
// Flows
|
|
1793
|
+
Flow,
|
|
1794
|
+
FlowStatus,
|
|
1795
|
+
|
|
1796
|
+
// Metrics
|
|
1283
1797
|
DateRangeType,
|
|
1284
1798
|
MetricType,
|
|
1285
|
-
|
|
1799
|
+
MetricsResponse,
|
|
1800
|
+
SalesMetrics,
|
|
1801
|
+
SalesMetricsResponse,
|
|
1802
|
+
|
|
1803
|
+
// Organizations & Users
|
|
1804
|
+
Organization,
|
|
1805
|
+
User,
|
|
1806
|
+
Agent,
|
|
1807
|
+
|
|
1808
|
+
// Companies
|
|
1809
|
+
Company,
|
|
1810
|
+
|
|
1811
|
+
// Customer Segments
|
|
1812
|
+
CustomerSegment,
|
|
1813
|
+
|
|
1814
|
+
// Webhooks
|
|
1815
|
+
Webhook,
|
|
1816
|
+
WebhookTopic,
|
|
1817
|
+
|
|
1818
|
+
// Usage Events
|
|
1819
|
+
UsageEvent,
|
|
1820
|
+
UsageEventCreateParams,
|
|
1821
|
+
|
|
1822
|
+
// Transactions & Charges
|
|
1823
|
+
Transaction,
|
|
1824
|
+
Charge,
|
|
1286
1825
|
|
|
1287
1826
|
// Middleware
|
|
1288
1827
|
Middleware,
|