@dench.com/cli 2.8.8-staging.192 → 2.9.1-staging.200
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 +31 -0
- package/campaign.ts +2316 -0
- package/crm.ts +54 -12
- package/dench.ts +63 -1
- package/email.ts +6 -2
- package/lib/api-schemas.ts +655 -0
- package/lib/command-registry.ts +332 -0
- package/members.ts +274 -6
- package/package.json +2 -1
package/lib/api-schemas.ts
CHANGED
|
@@ -225,6 +225,202 @@ const campaignRecipientInput = z.object({
|
|
|
225
225
|
.describe("Values for {{variable}} placeholders in the template."),
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
+
// ---------------------------------------------------------------------------
|
|
229
|
+
// Outreach campaign fragments (mirror convex/functions/outreachSequences.ts)
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
|
|
232
|
+
const campaignSendSchedule = z
|
|
233
|
+
.object({
|
|
234
|
+
name: z.string().describe('Label, e.g. "Mon-Fri 9-18".'),
|
|
235
|
+
timezone: z.string().describe("IANA timezone, e.g. America/Los_Angeles."),
|
|
236
|
+
startHour: z
|
|
237
|
+
.number()
|
|
238
|
+
.int()
|
|
239
|
+
.min(0)
|
|
240
|
+
.max(23)
|
|
241
|
+
.describe("First hour sends may go out (0-23)."),
|
|
242
|
+
endHour: z
|
|
243
|
+
.number()
|
|
244
|
+
.int()
|
|
245
|
+
.min(1)
|
|
246
|
+
.max(24)
|
|
247
|
+
.describe("Hour sends stop (1-24); must be after startHour."),
|
|
248
|
+
weekdays: z
|
|
249
|
+
.array(z.number().int().min(0).max(6))
|
|
250
|
+
.min(1)
|
|
251
|
+
.describe("Days sends may go out: 0 = Sunday ... 6 = Saturday."),
|
|
252
|
+
})
|
|
253
|
+
.describe(
|
|
254
|
+
"One send window. A campaign has one to eight; the first one's timezone is the campaign's.",
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
const campaignStepType = z
|
|
258
|
+
.enum([
|
|
259
|
+
"email",
|
|
260
|
+
"wait",
|
|
261
|
+
"linkedin_visit",
|
|
262
|
+
"linkedin_connection",
|
|
263
|
+
"linkedin_message",
|
|
264
|
+
])
|
|
265
|
+
.describe("Step type.");
|
|
266
|
+
|
|
267
|
+
const campaignStepInput = z
|
|
268
|
+
.object({
|
|
269
|
+
type: campaignStepType,
|
|
270
|
+
waitHours: z
|
|
271
|
+
.number()
|
|
272
|
+
.optional()
|
|
273
|
+
.describe("wait steps: hours to wait before the next step."),
|
|
274
|
+
emailMailboxAccountId: z
|
|
275
|
+
.string()
|
|
276
|
+
.optional()
|
|
277
|
+
.describe(
|
|
278
|
+
"email steps: the connected mailbox that sends (an emailMailboxAccounts id from `dench campaign accounts`).",
|
|
279
|
+
),
|
|
280
|
+
emailSubject: z
|
|
281
|
+
.string()
|
|
282
|
+
.optional()
|
|
283
|
+
.describe("email steps: subject; {{Column}} merge tokens allowed."),
|
|
284
|
+
emailHtmlBody: z.string().optional(),
|
|
285
|
+
emailTextBody: z.string().optional(),
|
|
286
|
+
emailReplyToPrevious: z
|
|
287
|
+
.boolean()
|
|
288
|
+
.optional()
|
|
289
|
+
.describe(
|
|
290
|
+
"email steps: thread under the previous email step instead of a new subject.",
|
|
291
|
+
),
|
|
292
|
+
onlyIf: z
|
|
293
|
+
.enum(["always", "connected", "not_connected"])
|
|
294
|
+
.optional()
|
|
295
|
+
.describe(
|
|
296
|
+
"Run this step only when the person is / is not a LinkedIn connection.",
|
|
297
|
+
),
|
|
298
|
+
linkedinAccountId: z
|
|
299
|
+
.string()
|
|
300
|
+
.optional()
|
|
301
|
+
.describe("LinkedIn steps: the connected LinkedIn account that acts."),
|
|
302
|
+
linkedinMessageBody: z
|
|
303
|
+
.string()
|
|
304
|
+
.optional()
|
|
305
|
+
.describe(
|
|
306
|
+
"linkedin_connection: the invite note (optional); linkedin_message: the message (up to 3000 chars).",
|
|
307
|
+
),
|
|
308
|
+
linkedinMessageMode: z
|
|
309
|
+
.enum(["skip_if_not_connected", "wait_until_connected"])
|
|
310
|
+
.optional()
|
|
311
|
+
.describe(
|
|
312
|
+
"linkedin_message: what to do when the invite is still pending.",
|
|
313
|
+
),
|
|
314
|
+
connectionTimeoutHours: z
|
|
315
|
+
.number()
|
|
316
|
+
.optional()
|
|
317
|
+
.describe(
|
|
318
|
+
"linkedin_message with linkedinMessageMode=wait_until_connected: give up waiting for the accept after this many hours (default 720).",
|
|
319
|
+
),
|
|
320
|
+
})
|
|
321
|
+
.describe("One campaign step, in order.");
|
|
322
|
+
|
|
323
|
+
const campaignStatus = z
|
|
324
|
+
.enum(["draft", "active", "paused", "completed", "archived"])
|
|
325
|
+
.describe("Campaign lifecycle status.");
|
|
326
|
+
|
|
327
|
+
const campaignRow = z
|
|
328
|
+
.object({
|
|
329
|
+
_id: z.string(),
|
|
330
|
+
name: z.string(),
|
|
331
|
+
status: campaignStatus,
|
|
332
|
+
stopOnReply: z.boolean(),
|
|
333
|
+
timezone: z.string().optional(),
|
|
334
|
+
startsAt: z.number().optional(),
|
|
335
|
+
endsAt: z.number().optional(),
|
|
336
|
+
sendSchedules: z.array(campaignSendSchedule).optional(),
|
|
337
|
+
dailySendCap: z.number().optional(),
|
|
338
|
+
stepCount: z.number(),
|
|
339
|
+
totalEnrolled: z.number(),
|
|
340
|
+
activeCount: z.number(),
|
|
341
|
+
pausedCount: z.number(),
|
|
342
|
+
finishedCount: z.number(),
|
|
343
|
+
repliedCount: z.number(),
|
|
344
|
+
failedCount: z.number(),
|
|
345
|
+
stoppedCount: z.number(),
|
|
346
|
+
launchedAt: z.number().optional(),
|
|
347
|
+
ownerName: z.string().optional(),
|
|
348
|
+
isOwner: z.boolean().optional(),
|
|
349
|
+
createdAt: z.number(),
|
|
350
|
+
updatedAt: z.number(),
|
|
351
|
+
})
|
|
352
|
+
.passthrough();
|
|
353
|
+
|
|
354
|
+
const campaignEnrollResult = z.object({
|
|
355
|
+
added: z.number(),
|
|
356
|
+
requested: z.number(),
|
|
357
|
+
cappedAtLimit: z
|
|
358
|
+
.number()
|
|
359
|
+
.nullable()
|
|
360
|
+
.describe(
|
|
361
|
+
"The campaign's people cap when it cut the batch short (300), else null.",
|
|
362
|
+
),
|
|
363
|
+
duplicates: z.number().describe("Already in this campaign."),
|
|
364
|
+
merged: z
|
|
365
|
+
.number()
|
|
366
|
+
.describe("Duplicates that gained a missing email or LinkedIn URL."),
|
|
367
|
+
duplicatesElsewhere: z
|
|
368
|
+
.number()
|
|
369
|
+
.describe(
|
|
370
|
+
"Active in another campaign; skipped unless checkDuplicatesAcrossWorkspace is false.",
|
|
371
|
+
),
|
|
372
|
+
suppressed: z.number(),
|
|
373
|
+
invalid: z.number(),
|
|
374
|
+
skippedNoIdentity: z
|
|
375
|
+
.number()
|
|
376
|
+
.describe("No usable email or LinkedIn URL on the record."),
|
|
377
|
+
skippedSample: z.number(),
|
|
378
|
+
skippedMissingInfo: z
|
|
379
|
+
.number()
|
|
380
|
+
.describe(
|
|
381
|
+
"Launched campaigns only: a merge token the steps use is empty for them.",
|
|
382
|
+
),
|
|
383
|
+
missingInfoSample: z
|
|
384
|
+
.object({
|
|
385
|
+
displayName: z.string().optional(),
|
|
386
|
+
missingKeys: z.array(z.string()),
|
|
387
|
+
})
|
|
388
|
+
.optional(),
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
const campaignLaunchBlocker = z
|
|
392
|
+
.object({
|
|
393
|
+
code: z.string(),
|
|
394
|
+
scope: z.enum(["sequence", "step", "person"]),
|
|
395
|
+
target: z.enum(["sequence", "people", "schedule"]),
|
|
396
|
+
title: z.string(),
|
|
397
|
+
hint: z.string().optional(),
|
|
398
|
+
stepIndex: z.number().optional(),
|
|
399
|
+
people: z.array(
|
|
400
|
+
z.object({ enrollmentId: z.string().optional(), name: z.string() }),
|
|
401
|
+
),
|
|
402
|
+
count: z.number(),
|
|
403
|
+
})
|
|
404
|
+
.passthrough();
|
|
405
|
+
|
|
406
|
+
const campaignReadiness = z
|
|
407
|
+
.object({
|
|
408
|
+
ready: z.boolean(),
|
|
409
|
+
fingerprint: z
|
|
410
|
+
.string()
|
|
411
|
+
.describe(
|
|
412
|
+
"Pass this to `launch`; it changes whenever the campaign changes.",
|
|
413
|
+
),
|
|
414
|
+
blockingReasons: z.array(z.string()),
|
|
415
|
+
blockers: z.array(campaignLaunchBlocker),
|
|
416
|
+
warnings: z.array(z.string()),
|
|
417
|
+
stepCount: z.number(),
|
|
418
|
+
audienceCount: z.number(),
|
|
419
|
+
usesEmail: z.boolean(),
|
|
420
|
+
usesLinkedin: z.boolean(),
|
|
421
|
+
})
|
|
422
|
+
.passthrough();
|
|
423
|
+
|
|
228
424
|
// ---------------------------------------------------------------------------
|
|
229
425
|
// Response fragments. These mirror the real backend return shapes (Convex
|
|
230
426
|
// `returns` validators / handler code / gateway response mapping). Objects
|
|
@@ -487,6 +683,12 @@ const savedViewDefinition = z
|
|
|
487
683
|
})
|
|
488
684
|
.passthrough();
|
|
489
685
|
|
|
686
|
+
const objectVisibility = z
|
|
687
|
+
.enum(["workspace", "owner_only", "owner_plus_members"])
|
|
688
|
+
.describe(
|
|
689
|
+
"Who can read the object's records. Always reported as the value the object behaves as: `meeting` defaults to owner_plus_members, `calendar_event` to owner_only, anything else to workspace.",
|
|
690
|
+
);
|
|
691
|
+
|
|
490
692
|
const crmObjectDoc = z
|
|
491
693
|
.object({
|
|
492
694
|
_id: z.string(),
|
|
@@ -497,6 +699,7 @@ const crmObjectDoc = z
|
|
|
497
699
|
defaultView: viewKind,
|
|
498
700
|
sortOrder: z.number(),
|
|
499
701
|
immutable: z.boolean(),
|
|
702
|
+
visibility: objectVisibility.optional(),
|
|
500
703
|
icon: z.string().optional(),
|
|
501
704
|
viewSettings: z.record(z.string(), z.unknown()).optional(),
|
|
502
705
|
savedViews: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
@@ -624,15 +827,82 @@ const crmBatchResults = z.object({
|
|
|
624
827
|
count: z.number(),
|
|
625
828
|
});
|
|
626
829
|
|
|
830
|
+
const presenceState = z.enum(["online", "away", "offline"]);
|
|
831
|
+
|
|
627
832
|
const memberShape = z.object({
|
|
628
833
|
userId: z.string(),
|
|
629
834
|
name: z.string().nullable(),
|
|
630
835
|
email: z.string().nullable(),
|
|
631
836
|
image: z.string().nullable(),
|
|
837
|
+
tagline: z.string().nullable(),
|
|
838
|
+
timezone: z
|
|
839
|
+
.string()
|
|
840
|
+
.nullable()
|
|
841
|
+
.describe("IANA zone, when the member set one."),
|
|
842
|
+
presence: presenceState,
|
|
843
|
+
lastActiveAt: z.number().nullable(),
|
|
632
844
|
role: z.string(),
|
|
633
845
|
joinedAt: z.number(),
|
|
634
846
|
});
|
|
635
847
|
|
|
848
|
+
const memberProfileShape = z.object({
|
|
849
|
+
userId: z.string(),
|
|
850
|
+
name: z.string().nullable(),
|
|
851
|
+
email: z.string().nullable(),
|
|
852
|
+
image: z.string().nullable(),
|
|
853
|
+
tagline: z.string().nullable(),
|
|
854
|
+
role: z.enum(["ADMIN", "MEMBER"]),
|
|
855
|
+
joinedAt: z.number(),
|
|
856
|
+
timezone: z
|
|
857
|
+
.object({
|
|
858
|
+
value: z.string(),
|
|
859
|
+
source: z.enum(["auto", "manual", "agent"]),
|
|
860
|
+
updatedAt: z.number(),
|
|
861
|
+
})
|
|
862
|
+
.nullable(),
|
|
863
|
+
presence: z.object({
|
|
864
|
+
state: presenceState,
|
|
865
|
+
lastActiveAt: z.number().nullable(),
|
|
866
|
+
}),
|
|
867
|
+
openTaskCount: z.number(),
|
|
868
|
+
commentCount: z.number().describe("Capped at 200."),
|
|
869
|
+
changeCount: z.number().describe("Capped at 200."),
|
|
870
|
+
lastContributionAt: z.number().nullable(),
|
|
871
|
+
isSelf: z.boolean(),
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
const memberActivityRow = z.union([
|
|
875
|
+
z.object({
|
|
876
|
+
kind: z.literal("comment"),
|
|
877
|
+
id: z.string(),
|
|
878
|
+
entryId: z.string(),
|
|
879
|
+
objectName: z.string(),
|
|
880
|
+
entryLabel: z.string(),
|
|
881
|
+
body: z.string(),
|
|
882
|
+
parentCommentId: z.string().optional(),
|
|
883
|
+
deleted: z.boolean(),
|
|
884
|
+
at: z.number(),
|
|
885
|
+
}),
|
|
886
|
+
z
|
|
887
|
+
.object({
|
|
888
|
+
kind: z.literal("change"),
|
|
889
|
+
id: z.string(),
|
|
890
|
+
entryId: z.string(),
|
|
891
|
+
objectName: z.string(),
|
|
892
|
+
entryLabel: z.string(),
|
|
893
|
+
changeKind: z.enum(["create", "update", "delete"]),
|
|
894
|
+
changes: z.array(
|
|
895
|
+
z.object({
|
|
896
|
+
fieldName: z.string(),
|
|
897
|
+
before: z.unknown().optional(),
|
|
898
|
+
after: z.unknown().optional(),
|
|
899
|
+
}),
|
|
900
|
+
),
|
|
901
|
+
at: z.number(),
|
|
902
|
+
})
|
|
903
|
+
.passthrough(),
|
|
904
|
+
]);
|
|
905
|
+
|
|
636
906
|
// -- routines ------------------------------------------------------------------
|
|
637
907
|
|
|
638
908
|
const cronJobShape = z
|
|
@@ -1488,6 +1758,121 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
|
|
|
1488
1758
|
// Meta
|
|
1489
1759
|
"commands.list": noInput,
|
|
1490
1760
|
|
|
1761
|
+
// Outreach campaigns (dench campaign)
|
|
1762
|
+
"campaigns.list": z.object({
|
|
1763
|
+
includeArchived: z
|
|
1764
|
+
.boolean()
|
|
1765
|
+
.optional()
|
|
1766
|
+
.describe("Include archived campaigns."),
|
|
1767
|
+
}),
|
|
1768
|
+
"campaigns.create": z.object({
|
|
1769
|
+
name: z.string(),
|
|
1770
|
+
timezone: z
|
|
1771
|
+
.string()
|
|
1772
|
+
.optional()
|
|
1773
|
+
.describe("IANA timezone for the default Mon-Fri 9-18 send window."),
|
|
1774
|
+
}),
|
|
1775
|
+
"campaigns.get": z.object({ sequenceId: z.string() }),
|
|
1776
|
+
"campaigns.analytics": z.object({ sequenceId: z.string() }),
|
|
1777
|
+
"campaigns.live": z.object({ sequenceId: z.string() }),
|
|
1778
|
+
"campaigns.update": z.object({
|
|
1779
|
+
sequenceId: z.string(),
|
|
1780
|
+
name: z.string().optional(),
|
|
1781
|
+
stopOnReply: z
|
|
1782
|
+
.boolean()
|
|
1783
|
+
.optional()
|
|
1784
|
+
.describe("Stop a person's remaining steps when they reply."),
|
|
1785
|
+
startsAt: z
|
|
1786
|
+
.number()
|
|
1787
|
+
.nullable()
|
|
1788
|
+
.optional()
|
|
1789
|
+
.describe("Epoch ms; null clears the start."),
|
|
1790
|
+
endsAt: z
|
|
1791
|
+
.number()
|
|
1792
|
+
.nullable()
|
|
1793
|
+
.optional()
|
|
1794
|
+
.describe("Epoch ms; null clears the end."),
|
|
1795
|
+
sendSchedules: z.array(campaignSendSchedule).min(1).max(8).optional(),
|
|
1796
|
+
dailySendCap: z
|
|
1797
|
+
.number()
|
|
1798
|
+
.int()
|
|
1799
|
+
.min(1)
|
|
1800
|
+
.max(100)
|
|
1801
|
+
.optional()
|
|
1802
|
+
.describe("Cold emails per day, 1-100."),
|
|
1803
|
+
}),
|
|
1804
|
+
"campaigns.steps.replace": z.object({
|
|
1805
|
+
sequenceId: z.string(),
|
|
1806
|
+
steps: z.array(campaignStepInput).min(1).max(20),
|
|
1807
|
+
}),
|
|
1808
|
+
"campaigns.people.addFromCrm": z.object({
|
|
1809
|
+
sequenceId: z.string(),
|
|
1810
|
+
objectName: z
|
|
1811
|
+
.string()
|
|
1812
|
+
.describe("CRM object the ids belong to, e.g. lead or people."),
|
|
1813
|
+
entryIds: z.array(z.string()).min(1).max(100),
|
|
1814
|
+
emailFieldName: z
|
|
1815
|
+
.string()
|
|
1816
|
+
.optional()
|
|
1817
|
+
.describe('Column holding the email when it is not "Email".'),
|
|
1818
|
+
linkedinUrlFieldName: z
|
|
1819
|
+
.string()
|
|
1820
|
+
.optional()
|
|
1821
|
+
.describe("Column holding the LinkedIn profile URL."),
|
|
1822
|
+
nameFieldName: z.string().optional(),
|
|
1823
|
+
relationFieldName: z
|
|
1824
|
+
.string()
|
|
1825
|
+
.optional()
|
|
1826
|
+
.describe("Follow this relation to the person record first."),
|
|
1827
|
+
relationDirection: z.literal("reverse").optional(),
|
|
1828
|
+
checkDuplicatesAcrossWorkspace: z
|
|
1829
|
+
.boolean()
|
|
1830
|
+
.optional()
|
|
1831
|
+
.describe("Default true: skip people active in another campaign."),
|
|
1832
|
+
}),
|
|
1833
|
+
"campaigns.people.add": z.object({
|
|
1834
|
+
sequenceId: z.string(),
|
|
1835
|
+
displayName: z.string().optional(),
|
|
1836
|
+
email: z.string().optional(),
|
|
1837
|
+
linkedinProfileUrl: z.string().optional(),
|
|
1838
|
+
entryId: z
|
|
1839
|
+
.string()
|
|
1840
|
+
.optional()
|
|
1841
|
+
.describe("Existing CRM people entry to link."),
|
|
1842
|
+
sourceEntryId: z.string().optional(),
|
|
1843
|
+
sourceObjectName: z.string().optional(),
|
|
1844
|
+
personalization: z.record(z.string(), z.unknown()).optional(),
|
|
1845
|
+
checkDuplicatesAcrossWorkspace: z.boolean().optional(),
|
|
1846
|
+
}),
|
|
1847
|
+
"campaigns.launch.preview": z.object({ sequenceId: z.string() }),
|
|
1848
|
+
"campaigns.launch": z.object({
|
|
1849
|
+
sequenceId: z.string(),
|
|
1850
|
+
fingerprint: z.string().describe("From the launch preview."),
|
|
1851
|
+
linkedinRiskAcknowledged: z
|
|
1852
|
+
.boolean()
|
|
1853
|
+
.optional()
|
|
1854
|
+
.describe("Required when the campaign has LinkedIn steps."),
|
|
1855
|
+
}),
|
|
1856
|
+
"campaigns.pause": z.object({ sequenceId: z.string() }),
|
|
1857
|
+
"campaigns.resume": z.object({ sequenceId: z.string() }),
|
|
1858
|
+
"campaigns.archive": z.object({ sequenceId: z.string() }),
|
|
1859
|
+
"campaigns.events": z.object({
|
|
1860
|
+
sequenceId: z.string(),
|
|
1861
|
+
numItems: z
|
|
1862
|
+
.number()
|
|
1863
|
+
.int()
|
|
1864
|
+
.min(1)
|
|
1865
|
+
.max(200)
|
|
1866
|
+
.optional()
|
|
1867
|
+
.describe("Page size, default 50."),
|
|
1868
|
+
cursor: z
|
|
1869
|
+
.string()
|
|
1870
|
+
.optional()
|
|
1871
|
+
.describe("continueCursor from the previous page."),
|
|
1872
|
+
}),
|
|
1873
|
+
"campaigns.people.stop": z.object({ enrollmentId: z.string() }),
|
|
1874
|
+
"campaigns.people.resume": z.object({ enrollmentId: z.string() }),
|
|
1875
|
+
|
|
1491
1876
|
// Auth
|
|
1492
1877
|
"auth.signin.create": z.object({
|
|
1493
1878
|
codeHash: z.string(),
|
|
@@ -1671,6 +2056,11 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
|
|
|
1671
2056
|
icon: z.string().optional(),
|
|
1672
2057
|
viewSettings: z.record(z.string(), z.unknown()).optional(),
|
|
1673
2058
|
savedViews: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
2059
|
+
visibility: objectVisibility
|
|
2060
|
+
.optional()
|
|
2061
|
+
.describe(
|
|
2062
|
+
"Who can see the object's records: every workspace member, only the record's owner, or the owner plus the members listed on the record. Admins only (a signed-in admin; an org-scoped key cannot change it). Records created before the switch have no owner and are hidden from everyone until one is set; switch back to workspace to see them again.",
|
|
2063
|
+
),
|
|
1674
2064
|
}),
|
|
1675
2065
|
"crm.objects.rename": z.object({
|
|
1676
2066
|
from: z.string().describe("Current object name (path)."),
|
|
@@ -1959,6 +2349,47 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
|
|
|
1959
2349
|
"crm.tasks.complete": z.object({ entryId: z.string() }),
|
|
1960
2350
|
"crm.tasks.reopen": z.object({ entryId: z.string() }),
|
|
1961
2351
|
|
|
2352
|
+
// Members + my profile
|
|
2353
|
+
"members.presence": z.object({
|
|
2354
|
+
userIds: z
|
|
2355
|
+
.string()
|
|
2356
|
+
.optional()
|
|
2357
|
+
.describe("Comma-separated user ids; omit for every member."),
|
|
2358
|
+
}),
|
|
2359
|
+
"members.get": z.object({ userId: z.string() }),
|
|
2360
|
+
"members.activity": z.object({
|
|
2361
|
+
userId: z.string(),
|
|
2362
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
2363
|
+
kinds: z
|
|
2364
|
+
.string()
|
|
2365
|
+
.optional()
|
|
2366
|
+
.describe("Comma-separated subset of comments,changes."),
|
|
2367
|
+
}),
|
|
2368
|
+
"members.tasks": z.object({
|
|
2369
|
+
userId: z.string(),
|
|
2370
|
+
limit: z.coerce.number().int().min(1).max(50).optional(),
|
|
2371
|
+
todayStartMs: z.coerce.number().optional(),
|
|
2372
|
+
}),
|
|
2373
|
+
"me.profile.get": noInput,
|
|
2374
|
+
"me.profile.update": z.object({
|
|
2375
|
+
name: z.string().min(1).max(80).optional(),
|
|
2376
|
+
tagline: z.string().max(160).optional().describe("Empty string clears."),
|
|
2377
|
+
imageUrl: z
|
|
2378
|
+
.string()
|
|
2379
|
+
.optional()
|
|
2380
|
+
.describe("http(s) image URL; empty string clears the avatar."),
|
|
2381
|
+
timezone: z
|
|
2382
|
+
.string()
|
|
2383
|
+
.nullable()
|
|
2384
|
+
.optional()
|
|
2385
|
+
.describe("IANA zone; null returns to browser detection."),
|
|
2386
|
+
}),
|
|
2387
|
+
"me.avatar.uploadUrl": noInput,
|
|
2388
|
+
"me.avatar.set": z.object({
|
|
2389
|
+
storageId: z.string().describe("storageId returned by the upload POST."),
|
|
2390
|
+
}),
|
|
2391
|
+
"me.avatar.clear": noInput,
|
|
2392
|
+
|
|
1962
2393
|
// CRM cells
|
|
1963
2394
|
"crm.cells.get": z.object({
|
|
1964
2395
|
objectName: z.string(),
|
|
@@ -2461,6 +2892,94 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
|
|
|
2461
2892
|
|
|
2462
2893
|
export const responseSchemas: Record<string, ZodTypeAny> = {
|
|
2463
2894
|
// Meta
|
|
2895
|
+
// Outreach campaigns (dench campaign)
|
|
2896
|
+
"campaigns.list": z.array(campaignRow),
|
|
2897
|
+
"campaigns.create": z.object({ sequenceId: z.string() }),
|
|
2898
|
+
"campaigns.get": z
|
|
2899
|
+
.object({
|
|
2900
|
+
sequence: campaignRow,
|
|
2901
|
+
steps: z.array(campaignStepInput.passthrough()),
|
|
2902
|
+
enrollments: z.array(z.record(z.string(), z.unknown())),
|
|
2903
|
+
currentRuns: z
|
|
2904
|
+
.record(z.string(), z.unknown())
|
|
2905
|
+
.describe(
|
|
2906
|
+
"enrollmentId -> the step run in progress, its hold and LinkedIn action.",
|
|
2907
|
+
),
|
|
2908
|
+
lastTouches: z.record(
|
|
2909
|
+
z.string(),
|
|
2910
|
+
z.object({ type: z.string(), at: z.number() }),
|
|
2911
|
+
),
|
|
2912
|
+
connectedEntries: z
|
|
2913
|
+
.record(z.string(), z.unknown())
|
|
2914
|
+
.describe("enrollmentId -> linked CRM record and lead status."),
|
|
2915
|
+
connectedFieldNames: z.array(z.string()),
|
|
2916
|
+
isOwner: z.boolean(),
|
|
2917
|
+
})
|
|
2918
|
+
.passthrough()
|
|
2919
|
+
.nullable(),
|
|
2920
|
+
"campaigns.analytics": z
|
|
2921
|
+
.object({
|
|
2922
|
+
audience: z.number(),
|
|
2923
|
+
contacted: z.number(),
|
|
2924
|
+
linkedinInvited: z.number(),
|
|
2925
|
+
linkedinConnected: z.number(),
|
|
2926
|
+
linkedinMessaged: z.number(),
|
|
2927
|
+
linkedinReplied: z.number(),
|
|
2928
|
+
active: z.number(),
|
|
2929
|
+
paused: z.number(),
|
|
2930
|
+
finished: z.number(),
|
|
2931
|
+
replied: z.number(),
|
|
2932
|
+
failed: z.number(),
|
|
2933
|
+
stopped: z.number(),
|
|
2934
|
+
emailSent: z.number(),
|
|
2935
|
+
opened: z.number(),
|
|
2936
|
+
clicked: z.number(),
|
|
2937
|
+
linkedinSent: z.number(),
|
|
2938
|
+
replyRate: z.number(),
|
|
2939
|
+
openRate: z.number(),
|
|
2940
|
+
clickRate: z.number(),
|
|
2941
|
+
truncated: z.boolean(),
|
|
2942
|
+
})
|
|
2943
|
+
.passthrough(),
|
|
2944
|
+
"campaigns.live": z
|
|
2945
|
+
.object({
|
|
2946
|
+
status: campaignStatus,
|
|
2947
|
+
usesEmail: z.boolean(),
|
|
2948
|
+
usesLinkedin: z.boolean(),
|
|
2949
|
+
emailsToday: z.number(),
|
|
2950
|
+
dailySendCap: z.number().nullable(),
|
|
2951
|
+
nextEmailAt: z.number().nullable(),
|
|
2952
|
+
now: z.record(z.string(), z.unknown()).nullable(),
|
|
2953
|
+
next: z.record(z.string(), z.unknown()).nullable(),
|
|
2954
|
+
paused: z.record(z.string(), z.unknown()).nullable(),
|
|
2955
|
+
senders: z.array(z.record(z.string(), z.unknown())),
|
|
2956
|
+
})
|
|
2957
|
+
.passthrough(),
|
|
2958
|
+
"campaigns.update": okResponse,
|
|
2959
|
+
"campaigns.steps.replace": z.object({
|
|
2960
|
+
ok: z.boolean(),
|
|
2961
|
+
stepCount: z.number(),
|
|
2962
|
+
}),
|
|
2963
|
+
"campaigns.people.addFromCrm": campaignEnrollResult,
|
|
2964
|
+
"campaigns.people.add": z.object({ enrollmentId: z.string() }),
|
|
2965
|
+
"campaigns.launch.preview": campaignReadiness,
|
|
2966
|
+
"campaigns.launch": z.object({
|
|
2967
|
+
ok: z.boolean(),
|
|
2968
|
+
status: z.literal("active"),
|
|
2969
|
+
}),
|
|
2970
|
+
"campaigns.pause": okResponse,
|
|
2971
|
+
"campaigns.resume": okResponse,
|
|
2972
|
+
"campaigns.archive": okResponse,
|
|
2973
|
+
"campaigns.events": z
|
|
2974
|
+
.object({
|
|
2975
|
+
page: z.array(z.record(z.string(), z.unknown())),
|
|
2976
|
+
isDone: z.boolean(),
|
|
2977
|
+
continueCursor: z.string(),
|
|
2978
|
+
})
|
|
2979
|
+
.passthrough(),
|
|
2980
|
+
"campaigns.people.stop": okResponse,
|
|
2981
|
+
"campaigns.people.resume": okResponse,
|
|
2982
|
+
|
|
2464
2983
|
"commands.list": z.object({
|
|
2465
2984
|
operations: z.array(
|
|
2466
2985
|
z.object({
|
|
@@ -2926,6 +3445,30 @@ export const responseSchemas: Record<string, ZodTypeAny> = {
|
|
|
2926
3445
|
organizationSlug: z.string().nullable(),
|
|
2927
3446
|
organizationName: z.string(),
|
|
2928
3447
|
}),
|
|
3448
|
+
"members.presence": z.array(
|
|
3449
|
+
z.object({
|
|
3450
|
+
userId: z.string(),
|
|
3451
|
+
state: presenceState,
|
|
3452
|
+
lastActiveAt: z.number().nullable(),
|
|
3453
|
+
}),
|
|
3454
|
+
),
|
|
3455
|
+
"members.get": memberProfileShape.nullable(),
|
|
3456
|
+
"members.activity": z.array(memberActivityRow),
|
|
3457
|
+
"members.tasks": z.array(
|
|
3458
|
+
z.object({
|
|
3459
|
+
id: z.string(),
|
|
3460
|
+
name: z.string(),
|
|
3461
|
+
status: z.string().nullable(),
|
|
3462
|
+
dueDate: z.number().nullable(),
|
|
3463
|
+
dueDateKey: z.string().nullable(),
|
|
3464
|
+
done: z.boolean(),
|
|
3465
|
+
}),
|
|
3466
|
+
),
|
|
3467
|
+
"me.profile.get": memberProfileShape.nullable(),
|
|
3468
|
+
"me.profile.update": memberProfileShape,
|
|
3469
|
+
"me.avatar.uploadUrl": z.string().describe("One-time upload URL."),
|
|
3470
|
+
"me.avatar.set": z.object({ image: z.string() }),
|
|
3471
|
+
"me.avatar.clear": okResponse,
|
|
2929
3472
|
"crm.reports.generate": z.object({
|
|
2930
3473
|
spec: z.object({
|
|
2931
3474
|
objectName: z.string(),
|
|
@@ -3265,6 +3808,17 @@ export type ConvexExtras = {
|
|
|
3265
3808
|
};
|
|
3266
3809
|
|
|
3267
3810
|
export const convexExtras: Record<string, ConvexExtras> = {
|
|
3811
|
+
// The events query paginates with Convex's `paginationOpts`; the flat
|
|
3812
|
+
// `numItems` / `cursor` query params are folded into it here.
|
|
3813
|
+
"campaigns.events": {
|
|
3814
|
+
transformArgs: (input) => ({
|
|
3815
|
+
sequenceId: input.sequenceId,
|
|
3816
|
+
paginationOpts: {
|
|
3817
|
+
numItems: typeof input.numItems === "number" ? input.numItems : 50,
|
|
3818
|
+
cursor: typeof input.cursor === "string" ? input.cursor : null,
|
|
3819
|
+
},
|
|
3820
|
+
}),
|
|
3821
|
+
},
|
|
3268
3822
|
"cron.enable": { fixedArgs: { enabled: true } },
|
|
3269
3823
|
"cron.disable": { fixedArgs: { enabled: false } },
|
|
3270
3824
|
// Archive/unarchive are one mutation behind two paths, so the flag comes
|
|
@@ -3335,6 +3889,52 @@ export const convexExtras: Record<string, ConvexExtras> = {
|
|
|
3335
3889
|
// ---------------------------------------------------------------------------
|
|
3336
3890
|
|
|
3337
3891
|
export const requestExamples: Record<string, unknown> = {
|
|
3892
|
+
"campaigns.create": {
|
|
3893
|
+
name: "Founder outreach",
|
|
3894
|
+
timezone: "America/Los_Angeles",
|
|
3895
|
+
},
|
|
3896
|
+
"campaigns.update": {
|
|
3897
|
+
sequenceId: "<sequenceId>",
|
|
3898
|
+
dailySendCap: 30,
|
|
3899
|
+
sendSchedules: [
|
|
3900
|
+
{
|
|
3901
|
+
name: "Mon-Fri 9-18",
|
|
3902
|
+
timezone: "America/Los_Angeles",
|
|
3903
|
+
startHour: 9,
|
|
3904
|
+
endHour: 18,
|
|
3905
|
+
weekdays: [1, 2, 3, 4, 5],
|
|
3906
|
+
},
|
|
3907
|
+
],
|
|
3908
|
+
},
|
|
3909
|
+
"campaigns.steps.replace": {
|
|
3910
|
+
sequenceId: "<sequenceId>",
|
|
3911
|
+
steps: [
|
|
3912
|
+
{ type: "linkedin_visit", linkedinAccountId: "<linkedinAccountId>" },
|
|
3913
|
+
{
|
|
3914
|
+
type: "linkedin_connection",
|
|
3915
|
+
linkedinAccountId: "<linkedinAccountId>",
|
|
3916
|
+
linkedinMessageBody:
|
|
3917
|
+
"Hi {{First name}}, enjoyed your post on {{Topic}}.",
|
|
3918
|
+
},
|
|
3919
|
+
{ type: "wait", waitHours: 48 },
|
|
3920
|
+
{
|
|
3921
|
+
type: "email",
|
|
3922
|
+
emailMailboxAccountId: "<emailMailboxAccountId>",
|
|
3923
|
+
emailSubject: "Quick question, {{First name}}",
|
|
3924
|
+
emailTextBody: "Hi {{First name}}, ...",
|
|
3925
|
+
},
|
|
3926
|
+
],
|
|
3927
|
+
},
|
|
3928
|
+
"campaigns.people.addFromCrm": {
|
|
3929
|
+
sequenceId: "<sequenceId>",
|
|
3930
|
+
objectName: "lead",
|
|
3931
|
+
entryIds: ["<entryId1>", "<entryId2>"],
|
|
3932
|
+
},
|
|
3933
|
+
"campaigns.launch": {
|
|
3934
|
+
sequenceId: "<sequenceId>",
|
|
3935
|
+
fingerprint: "<fingerprint from the launch preview>",
|
|
3936
|
+
linkedinRiskAcknowledged: true,
|
|
3937
|
+
},
|
|
3338
3938
|
"browser.action": {
|
|
3339
3939
|
action: "open",
|
|
3340
3940
|
url: "https://example.com",
|
|
@@ -3398,6 +3998,11 @@ export const requestExamples: Record<string, unknown> = {
|
|
|
3398
3998
|
emailEnabled: true,
|
|
3399
3999
|
perKind: { entry_activity: { email: false } },
|
|
3400
4000
|
},
|
|
4001
|
+
"me.profile.update": {
|
|
4002
|
+
tagline: "Head of Ops",
|
|
4003
|
+
timezone: "America/New_York",
|
|
4004
|
+
},
|
|
4005
|
+
"me.avatar.set": { storageId: "kg2abc123def456" },
|
|
3401
4006
|
"crm.entries.createMany": {
|
|
3402
4007
|
entries: [
|
|
3403
4008
|
{ Name: "Jane", Email: "jane@example.com" },
|
|
@@ -4186,6 +4791,10 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
4186
4791
|
name: "Jane Doe",
|
|
4187
4792
|
email: "jane@acme.com",
|
|
4188
4793
|
image: null,
|
|
4794
|
+
tagline: "Head of Ops",
|
|
4795
|
+
timezone: "America/New_York",
|
|
4796
|
+
presence: "online",
|
|
4797
|
+
lastActiveAt: 1765612790000,
|
|
4189
4798
|
role: "ADMIN",
|
|
4190
4799
|
joinedAt: 1765440000000,
|
|
4191
4800
|
},
|
|
@@ -4194,6 +4803,52 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
4194
4803
|
organizationSlug: "acme",
|
|
4195
4804
|
organizationName: "Acme",
|
|
4196
4805
|
},
|
|
4806
|
+
"members.get": {
|
|
4807
|
+
userId: "us_xyz789",
|
|
4808
|
+
name: "Jane Doe",
|
|
4809
|
+
email: "jane@acme.com",
|
|
4810
|
+
image: null,
|
|
4811
|
+
tagline: "Head of Ops",
|
|
4812
|
+
role: "ADMIN",
|
|
4813
|
+
joinedAt: 1765440000000,
|
|
4814
|
+
timezone: {
|
|
4815
|
+
value: "America/New_York",
|
|
4816
|
+
source: "manual",
|
|
4817
|
+
updatedAt: 1765440000000,
|
|
4818
|
+
},
|
|
4819
|
+
presence: { state: "online", lastActiveAt: 1765612790000 },
|
|
4820
|
+
openTaskCount: 4,
|
|
4821
|
+
commentCount: 31,
|
|
4822
|
+
changeCount: 118,
|
|
4823
|
+
lastContributionAt: 1765612800000,
|
|
4824
|
+
isSelf: false,
|
|
4825
|
+
},
|
|
4826
|
+
"members.activity": [
|
|
4827
|
+
{
|
|
4828
|
+
kind: "comment",
|
|
4829
|
+
id: "cmt_01",
|
|
4830
|
+
entryId: "ent_lead99",
|
|
4831
|
+
objectName: "company",
|
|
4832
|
+
entryLabel: "Ramp",
|
|
4833
|
+
body: "Kickoff went well.",
|
|
4834
|
+
deleted: false,
|
|
4835
|
+
at: 1765612800000,
|
|
4836
|
+
},
|
|
4837
|
+
{
|
|
4838
|
+
kind: "change",
|
|
4839
|
+
id: "hist_01",
|
|
4840
|
+
entryId: "ent_lead99",
|
|
4841
|
+
objectName: "company",
|
|
4842
|
+
entryLabel: "Ramp",
|
|
4843
|
+
changeKind: "update",
|
|
4844
|
+
changes: [{ fieldName: "Status", before: "New", after: "Qualified" }],
|
|
4845
|
+
at: 1765612700000,
|
|
4846
|
+
},
|
|
4847
|
+
],
|
|
4848
|
+
"members.presence": [
|
|
4849
|
+
{ userId: "us_xyz789", state: "online", lastActiveAt: 1765612790000 },
|
|
4850
|
+
{ userId: "us_abc123", state: "offline", lastActiveAt: null },
|
|
4851
|
+
],
|
|
4197
4852
|
"crm.reports.generate": {
|
|
4198
4853
|
spec: {
|
|
4199
4854
|
objectName: "lead",
|