outbound-sdk 0.5.0 → 0.7.0
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/dist/alerts/check-schema.d.ts +1 -1
- package/dist/alerts/index.js +6 -6
- package/dist/audit/index.js +2 -2
- package/dist/benchmarks/index.js +4 -4
- package/dist/budget/index.js +2 -2
- package/dist/cards/format.d.ts +1 -1
- package/dist/cards/index.js +101 -62
- package/dist/cards/parts.d.ts +1 -6
- package/dist/chunks/{chunk-BLCJHP5H.js → chunk-45TXPJW7.js} +1 -0
- package/dist/chunks/chunk-4AVYRVN5.js +239 -0
- package/dist/chunks/{chunk-YYCT3NGV.js → chunk-65YAGEWZ.js} +24 -7
- package/dist/chunks/{chunk-BN6WCAWX.js → chunk-7I3EPR23.js} +3 -3
- package/dist/chunks/{chunk-3S32R2MH.js → chunk-BNDHEDHD.js} +2 -53
- package/dist/chunks/chunk-DNPNTD5W.js +81 -0
- package/dist/chunks/chunk-FALWG5U3.js +56 -0
- package/dist/chunks/{chunk-OLPMBRXM.js → chunk-GL7BABF2.js} +2 -2
- package/dist/chunks/{chunk-ZOAG2C6V.js → chunk-HIAK2GCI.js} +9 -2
- package/dist/chunks/{chunk-6TKFISG4.js → chunk-I7DXXGNZ.js} +42 -9
- package/dist/chunks/{chunk-BK5SLY32.js → chunk-JRL3QRBS.js} +264 -76
- package/dist/chunks/{chunk-EHSJGQ5K.js → chunk-KTYTE2BU.js} +4 -3
- package/dist/chunks/{chunk-JWGSB7PT.js → chunk-LD6F46UT.js} +2 -2
- package/dist/chunks/{chunk-2D42TQFU.js → chunk-LVZGIKNF.js} +2 -2
- package/dist/chunks/{chunk-PQSTQKRD.js → chunk-M2VXGLLZ.js} +35 -2
- package/dist/chunks/{chunk-5J7GGV62.js → chunk-MW4C6LTN.js} +2 -2
- package/dist/chunks/chunk-OK3GAZMT.js +51 -0
- package/dist/chunks/{chunk-BOWXGMN3.js → chunk-POBAY3TI.js} +80 -4
- package/dist/chunks/{chunk-J7DDZ4C2.js → chunk-QFC4ZHD3.js} +1 -1
- package/dist/chunks/{chunk-GFDNRWR3.js → chunk-UFQ4WMLU.js} +1 -1
- package/dist/chunks/{chunk-WGW3ROLY.js → chunk-Y7KECJAV.js} +1 -1
- package/dist/chunks/{chunk-QAKJ76HB.js → chunk-YW6FFVSZ.js} +1 -1
- package/dist/chunks/{chunk-X4RDBD4J.js → chunk-ZJCVLBAE.js} +445 -119
- package/dist/cli/bin.js +14 -14
- package/dist/cli/by-name.d.ts +28 -0
- package/dist/cli/commands.d.ts +2 -1
- package/dist/cli/config.d.ts +3 -2
- package/dist/cli/envelope.d.ts +50 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +13 -13
- package/dist/cli/listing.d.ts +13 -0
- package/dist/cli/native.d.ts +4 -0
- package/dist/cli/options.d.ts +88 -0
- package/dist/cli/output.d.ts +21 -0
- package/dist/cli/suggest.d.ts +10 -0
- package/dist/clients/index.js +6 -6
- package/dist/combine/index.js +7 -7
- package/dist/emailbison/capabilities.d.ts +1 -0
- package/dist/emailbison/index.js +38 -13
- package/dist/emailbison/map-stats.d.ts +10 -0
- package/dist/exporter/index.js +2 -2
- package/dist/failover/index.js +2 -2
- package/dist/fixtures/index.js +4 -4
- package/dist/heyreach/capabilities.d.ts +3 -0
- package/dist/heyreach/index.js +36 -12
- package/dist/heyreach/map-account.d.ts +2 -2
- package/dist/identity/index.js +2 -2
- package/dist/index.js +9 -7
- package/dist/insights/copy/audit-samples.d.ts +24 -0
- package/dist/insights/copy/audit-variant.d.ts +34 -0
- package/dist/insights/copy/copy-audit.d.ts +26 -12
- package/dist/insights/copy/copy-preview.d.ts +71 -0
- package/dist/insights/copy/copy-reuse.d.ts +0 -13
- package/dist/insights/copy/index.d.ts +15 -0
- package/dist/insights/copy/reply-timing.d.ts +4 -0
- package/dist/insights/copy/reuse-base.d.ts +0 -2
- package/dist/insights/copy/shared.d.ts +7 -9
- package/dist/insights/copy/step-funnel.d.ts +21 -18
- package/dist/insights/copy/variant-test.d.ts +2 -8
- package/dist/insights/index.js +1357 -717
- package/dist/insights/inputs.generated.d.ts +67 -34
- package/dist/insights/ops/campaign-diagnosis.d.ts +2 -2
- package/dist/insights/ops/client-report.d.ts +0 -2
- package/dist/insights/ops/diagnosis-checks.d.ts +20 -1
- package/dist/insights/ops/index.d.ts +2 -4
- package/dist/insights/ops/pipeline-forecast.d.ts +17 -6
- package/dist/insights/ops/shared.d.ts +0 -2
- package/dist/insights/people/account-summary.d.ts +14 -1
- package/dist/insights/people/auto-replies.d.ts +14 -0
- package/dist/insights/people/dropped-replies.d.ts +1 -1
- package/dist/insights/people/hot-leads.d.ts +5 -1
- package/dist/insights/people/index.d.ts +4 -0
- package/dist/insights/people/lead-collisions.d.ts +11 -2
- package/dist/insights/people/person-summary.d.ts +19 -3
- package/dist/insights/people/personalization-gaps.d.ts +14 -8
- package/dist/insights/people/suppression-check.d.ts +9 -0
- package/dist/insights/registry.d.ts +20 -8
- package/dist/insights/senders/bounce-watch.d.ts +0 -11
- package/dist/insights/senders/domain-health.d.ts +0 -7
- package/dist/insights/senders/index.d.ts +0 -4
- package/dist/insights/senders/sender-load.d.ts +0 -2
- package/dist/insights/step.d.ts +15 -0
- package/dist/insights/types.d.ts +1 -1
- package/dist/insights/variables.d.ts +35 -0
- package/dist/instantly/capabilities.d.ts +4 -0
- package/dist/instantly/index.js +265 -53
- package/dist/instantly/map-stats.d.ts +4 -0
- package/dist/instantly/stats-tracking.d.ts +19 -0
- package/dist/instantly/thread.d.ts +9 -0
- package/dist/internal/adapter.d.ts +5 -0
- package/dist/internal/auto-reply.d.ts +20 -0
- package/dist/internal/capabilities.d.ts +2 -0
- package/dist/internal/entities-account.d.ts +1 -0
- package/dist/internal/entities.d.ts +79 -2
- package/dist/internal/fields.d.ts +37 -1
- package/dist/internal/metrics.d.ts +23 -1
- package/dist/internal/outbound/api.d.ts +2 -0
- package/dist/internal/records.d.ts +2 -2
- package/dist/internal/reply-people.d.ts +37 -0
- package/dist/internal/runway.d.ts +42 -0
- package/dist/internal/sender-screen.d.ts +9 -0
- package/dist/internal/tracking.d.ts +33 -0
- package/dist/loader/index.js +4 -4
- package/dist/memory/data.d.ts +2 -1
- package/dist/memory/index.js +23 -12
- package/dist/redact/index.js +3 -3
- package/dist/smartlead/capabilities.d.ts +4 -0
- package/dist/smartlead/index.js +154 -38
- package/dist/smartlead/map-account.d.ts +3 -0
- package/dist/smartlead/stats-tracking.d.ts +22 -0
- package/dist/sync/index.js +2 -2
- package/dist/tools/ai-sdk.js +8 -7
- package/dist/tools/by-name.d.ts +18 -0
- package/dist/tools/campaign-tools.d.ts +6 -2
- package/dist/tools/claude-agent.js +8 -7
- package/dist/tools/index.js +9 -8
- package/dist/tools/shared.d.ts +7 -0
- package/dist/tracing/index.js +2 -2
- package/dist/webhooks/index.js +12 -10
- package/package.json +1 -1
- package/dist/chunks/chunk-HWHI4LFY.js +0 -102
- package/dist/internal/renamed.d.ts +0 -28
package/dist/instantly/index.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EVENT_TYPES,
|
|
3
3
|
instantlyEvents
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-7I3EPR23.js";
|
|
5
|
+
import {
|
|
6
|
+
applyTracking,
|
|
7
|
+
ownTracking,
|
|
8
|
+
unlessFailed
|
|
9
|
+
} from "../chunks/chunk-DNPNTD5W.js";
|
|
10
|
+
import {
|
|
11
|
+
answeredAtOnce,
|
|
12
|
+
detectAutoReply
|
|
13
|
+
} from "../chunks/chunk-OK3GAZMT.js";
|
|
5
14
|
import {
|
|
6
15
|
flatMapPage,
|
|
7
16
|
mapPage,
|
|
@@ -12,10 +21,12 @@ import {
|
|
|
12
21
|
createVendorClient,
|
|
13
22
|
leadStanding,
|
|
14
23
|
listIn,
|
|
15
|
-
normalizeBody,
|
|
16
24
|
toVariant,
|
|
17
25
|
variantKey
|
|
18
|
-
} from "../chunks/chunk-
|
|
26
|
+
} from "../chunks/chunk-BNDHEDHD.js";
|
|
27
|
+
import {
|
|
28
|
+
normalizeBody
|
|
29
|
+
} from "../chunks/chunk-FALWG5U3.js";
|
|
19
30
|
import {
|
|
20
31
|
defineNative,
|
|
21
32
|
inBody,
|
|
@@ -29,28 +40,28 @@ import {
|
|
|
29
40
|
recordBase,
|
|
30
41
|
refTo,
|
|
31
42
|
refsTo
|
|
32
|
-
} from "../chunks/chunk-
|
|
33
|
-
import "../chunks/chunk-
|
|
43
|
+
} from "../chunks/chunk-LVZGIKNF.js";
|
|
44
|
+
import "../chunks/chunk-POBAY3TI.js";
|
|
34
45
|
import {
|
|
35
46
|
emptyCounts,
|
|
36
47
|
metricRow,
|
|
37
48
|
sumCounts
|
|
38
|
-
} from "../chunks/chunk-
|
|
49
|
+
} from "../chunks/chunk-M2VXGLLZ.js";
|
|
39
50
|
import "../chunks/chunk-QGRZDTX4.js";
|
|
40
51
|
import {
|
|
41
52
|
assertWorkspaceId
|
|
42
|
-
} from "../chunks/chunk-
|
|
53
|
+
} from "../chunks/chunk-YW6FFVSZ.js";
|
|
43
54
|
import "../chunks/chunk-NAWZ73QS.js";
|
|
44
55
|
import "../chunks/chunk-FHKSLCVW.js";
|
|
45
56
|
import {
|
|
46
57
|
readEnv,
|
|
47
58
|
requireCredential
|
|
48
|
-
} from "../chunks/chunk-
|
|
59
|
+
} from "../chunks/chunk-UFQ4WMLU.js";
|
|
49
60
|
import {
|
|
50
61
|
OutboundError,
|
|
51
62
|
makeErrorMapper,
|
|
52
63
|
requireObject
|
|
53
|
-
} from "../chunks/chunk-
|
|
64
|
+
} from "../chunks/chunk-QFC4ZHD3.js";
|
|
54
65
|
import {
|
|
55
66
|
count,
|
|
56
67
|
emailAddress,
|
|
@@ -65,7 +76,7 @@ import {
|
|
|
65
76
|
text,
|
|
66
77
|
timestamp,
|
|
67
78
|
withoutKeys
|
|
68
|
-
} from "../chunks/chunk-
|
|
79
|
+
} from "../chunks/chunk-45TXPJW7.js";
|
|
69
80
|
|
|
70
81
|
// src/instantly/map-account.ts
|
|
71
82
|
var CLOCK = /^\d{2}:\d{2}$/u;
|
|
@@ -114,6 +125,7 @@ var toCampaignProgress = (identity, campaignId, raw) => ({
|
|
|
114
125
|
inProgress: null,
|
|
115
126
|
leads: count(raw.leads_count),
|
|
116
127
|
notStarted: null,
|
|
128
|
+
skipped: null,
|
|
117
129
|
stopped: null
|
|
118
130
|
});
|
|
119
131
|
var ACCOUNT_ISSUE = /* @__PURE__ */ new Map([
|
|
@@ -419,6 +431,9 @@ var capabilities = {
|
|
|
419
431
|
// Instantly does not sign webhooks. Use a secret header or URL path.
|
|
420
432
|
"events.verify": "secret",
|
|
421
433
|
"leads.byCampaign": true,
|
|
434
|
+
// The `search` field of POST /leads/list, which matches whole words of the
|
|
435
|
+
// lead's email; the adapter keeps only addresses at exactly that domain.
|
|
436
|
+
"leads.byDomain": true,
|
|
422
437
|
"leads.engagement": true,
|
|
423
438
|
"leads.get": true,
|
|
424
439
|
"leads.list": true,
|
|
@@ -476,6 +491,7 @@ var fields = {
|
|
|
476
491
|
failed: false,
|
|
477
492
|
inProgress: false,
|
|
478
493
|
notStarted: false,
|
|
494
|
+
skipped: false,
|
|
479
495
|
stopped: false
|
|
480
496
|
},
|
|
481
497
|
lead: {
|
|
@@ -484,6 +500,9 @@ var fields = {
|
|
|
484
500
|
location: false,
|
|
485
501
|
tags: false
|
|
486
502
|
},
|
|
503
|
+
// No email carried is_auto_reply live: a fixed rule decides, and in a
|
|
504
|
+
// timeline the step comes from the send a reply answers.
|
|
505
|
+
message: { isAuto: "derived", isAutoSource: "derived" },
|
|
487
506
|
metricRow: {
|
|
488
507
|
connectionsAccepted: false,
|
|
489
508
|
connectionsSent: false,
|
|
@@ -494,6 +513,7 @@ var fields = {
|
|
|
494
513
|
},
|
|
495
514
|
// A test has a creation time and a next run, and no start or end date.
|
|
496
515
|
placementTest: { endsAt: false, startsAt: false },
|
|
516
|
+
reply: { isAuto: "derived", isAutoSource: "derived", leftCompany: "derived" },
|
|
497
517
|
sender: { linkedinUrl: false },
|
|
498
518
|
senderHealth: { blacklisted: false, checkedAt: false }
|
|
499
519
|
};
|
|
@@ -516,6 +536,8 @@ var costs = {
|
|
|
516
536
|
"campaigns.get": { perPage: 3 },
|
|
517
537
|
// The campaigns, their tag assignments, then the tags' names.
|
|
518
538
|
"campaigns.list": { pageSize: PAGE_SIZE, perPage: 3, perWalk: 1 },
|
|
539
|
+
// The per-campaign report, asked for one campaign.
|
|
540
|
+
"campaigns.progress": { perPage: 1 },
|
|
519
541
|
"campaigns.settings": { perPage: 1 },
|
|
520
542
|
// A custom interest label costs one more read of the label list, made only
|
|
521
543
|
// when the lead or a page of leads holds one.
|
|
@@ -541,7 +563,10 @@ var costs = {
|
|
|
541
563
|
"senders.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
542
564
|
"sequence.get": { perPage: 1 },
|
|
543
565
|
"sequence.subsequences": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
544
|
-
|
|
566
|
+
// The counts, then the tracking settings: the campaign, or for a workspace
|
|
567
|
+
// or mailbox the per-campaign report and the campaign listing. The bound
|
|
568
|
+
// is for up to 100 campaigns; each further 100 adds a listing page.
|
|
569
|
+
stats: { perPage: 2, perPageAtMost: 3 },
|
|
545
570
|
"tags.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
546
571
|
"webhooks.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
547
572
|
"workspaces.list": { perPage: 1 }
|
|
@@ -552,7 +577,7 @@ var caveats = [
|
|
|
552
577
|
"A lead's progress is its status when that is 1 (active), 2 (paused) or 3 (completed). Status -1 is bounced and -2 unsubscribed: they say what came back, so progress is then unknown. replied is email_reply_count above 0, and a lead that replied has the status replied whatever its progress.",
|
|
553
578
|
"A placement test's kind reads type 1 as a one-time test and 2 as an automated one: the reference names the two kinds in that order and gives the numbers no names. A test's results stay native, because Instantly reports them as one row per test email.",
|
|
554
579
|
"Instantly sends next_starting_after on a last page too (seen live), and the page after it is empty. A listing therefore ends one request late; the small lookups for tags and labels stop at the first page that is not full.",
|
|
555
|
-
|
|
580
|
+
`A reply's category is read from the email's i_status using the lead interest status values (seen live: 0, 1, -1 and -2). An email names its lead by address (lead_id was absent live), so a message's or reply's leadRef holds the lead's lowercased address, from lead or, on a received email, from_address_email. leads.get and leads.timeline take that ref; leads.get then returns the first record with the address, one of several when the person is in several campaigns. No live email carried the documented is_auto_reply and the email list cannot filter by it, so when it is missing isAuto is decided by a fixed rule (isAutoSource rule): a machine sender address (noreply, auto-responder, mailer-daemon), an automatic subject (OOO, Out of Office, Automatic reply, "is no longer at"), a canned autoresponder phrase in the body, or, in a timeline or thread, a reply within a minute of the send it answers. An Out of Office i_status counts as the vendor saying so. leftCompany is true when the reply says the person left or the contact changed. In a timeline or thread a received email takes its stepIndex from the send it answers, since its own step lags on the last step.`,
|
|
556
581
|
"An email's step and a lead's last step are ids of the form sequence_step_variant, each counted from 0 (seen live, not documented); any other form gives a null step. Step analytics count steps from 0 too, and can hold a row with no step for counts Instantly could not tie to one.",
|
|
557
582
|
"Whether reply_count includes automatic replies is not documented; replied uses the unique reply count and repliedAuto the unique automatic count.",
|
|
558
583
|
"Open counts are returned even when a campaign has open tracking turned off, because the analytics response does not say whether tracking was on.",
|
|
@@ -566,6 +591,7 @@ var caveats = [
|
|
|
566
591
|
"connected is true for an Active account and false for a Connection Error; every other account status is null.",
|
|
567
592
|
"A lead's engagement.stepIndex is the last step sent, read from its status summary; lastOpenedAt is null when open tracking is off. A lead has no tags in Instantly, and the lead object was seen without a job title.",
|
|
568
593
|
"A lead is found by email with the contacts filter of POST /leads/list, documented only as the emails a lead needs to have. Whether it compares whole addresses and ignores case is not documented and was not run live, so the adapter keeps only the records whose address equals the one asked for, and a page can hold fewer records than Instantly returned. One record comes back per campaign or list the address is in. A lead has no LinkedIn profile: a lookup by profile returns nothing and sends no request.",
|
|
594
|
+
"Leads at one domain are found with the search field of POST /leads/list, documented (read 2026-11-16) as matched against the lead's email and profile fields on whole words and the start of a value. Whether an address's domain counts as a whole word was not run live. The search also matches names, companies and titles, so the adapter keeps only the records whose address is at exactly that domain, and a page can hold fewer records than Instantly returned.",
|
|
569
595
|
"A lead's interest is the documented label for lt_interest_status. A custom label costs one more read (lead-labels, first 100 labels), made only when a page holds a status that is not a built-in one; the same read gives a reply with a custom status its category.",
|
|
570
596
|
"A listed lead list's size is null: the list object has no count. lists.get reads GET /lead-lists/{id}/verification-stats as well and takes total_leads from it, so one list by id costs two requests. kind is always leads.",
|
|
571
597
|
"Native reads return what Instantly sends, unmapped. dfyAccounts never asks for passwords. Instantly refuses per-mailbox daily analytics (413) on a large workspace unless a mailbox is named, which the per-sender stats always do.",
|
|
@@ -619,10 +645,16 @@ var category = (value, labels) => {
|
|
|
619
645
|
return INTEREST.get(code)?.[1] ?? SENTIMENT.get(text(labels.get(code)?.interest_status_label) ?? "");
|
|
620
646
|
};
|
|
621
647
|
var LEAD_PROGRESS = /* @__PURE__ */ new Map([
|
|
648
|
+
[-3, "skipped"],
|
|
622
649
|
[1, "active"],
|
|
623
650
|
[2, "paused"],
|
|
624
651
|
[3, "completed"]
|
|
625
652
|
]);
|
|
653
|
+
var RECIPIENT_PROVIDER = new Map([
|
|
654
|
+
[1, "google"],
|
|
655
|
+
[2, "microsoft"],
|
|
656
|
+
...[3, 8, 9, 10, 12, 13, 999].map((code) => [code, "other"])
|
|
657
|
+
]);
|
|
626
658
|
var BOUNCED = -1;
|
|
627
659
|
var UNSUBSCRIBED = -2;
|
|
628
660
|
var standing = (raw) => {
|
|
@@ -683,6 +715,7 @@ var toLead = (identity, raw, labels = NO_LABELS) => ({
|
|
|
683
715
|
linkedinUrl: null,
|
|
684
716
|
location: null,
|
|
685
717
|
phone: text(raw.phone),
|
|
718
|
+
recipientMailProvider: RECIPIENT_PROVIDER.get(count(raw.esp_code) ?? Number.NaN) ?? null,
|
|
686
719
|
// Instantly tags mailboxes and campaigns, never leads.
|
|
687
720
|
tags: [],
|
|
688
721
|
title: text(raw.job_title),
|
|
@@ -690,6 +723,7 @@ var toLead = (identity, raw, labels = NO_LABELS) => ({
|
|
|
690
723
|
});
|
|
691
724
|
var SCHEDULED = 4;
|
|
692
725
|
var RECEIVED = 2;
|
|
726
|
+
var leadOf = (raw) => emailAddress(raw.lead) ?? (count(raw.ue_type) === RECEIVED ? emailAddress(raw.from_address_email) : null) ?? text(raw.lead_id);
|
|
693
727
|
var messageFields = (identity, raw, includeBody) => {
|
|
694
728
|
const body = field(raw.body, "html") ?? field(raw.body, "text");
|
|
695
729
|
return {
|
|
@@ -697,7 +731,7 @@ var messageFields = (identity, raw, includeBody) => {
|
|
|
697
731
|
...normalizeBody(text(body), includeBody),
|
|
698
732
|
campaignRef: refTo(identity, text(raw.campaign_id)),
|
|
699
733
|
channel: "email",
|
|
700
|
-
leadRef: refTo(identity,
|
|
734
|
+
leadRef: refTo(identity, leadOf(raw)),
|
|
701
735
|
senderRef: refTo(identity, emailAddress(raw.eaccount)),
|
|
702
736
|
sentAt: timestamp(raw.timestamp_email) ?? timestamp(raw.timestamp_created),
|
|
703
737
|
subject: text(raw.subject),
|
|
@@ -707,11 +741,36 @@ var messageFields = (identity, raw, includeBody) => {
|
|
|
707
741
|
};
|
|
708
742
|
var isScheduled = (raw) => count(raw.ue_type) === SCHEDULED;
|
|
709
743
|
var isTruncated = (raw) => text(raw.body_fallback_reason) !== null;
|
|
710
|
-
var toMessage = (identity, raw, includeBody) => ({
|
|
711
|
-
...messageFields(identity, raw, includeBody),
|
|
712
|
-
direction: count(raw.ue_type) === RECEIVED ? "in" : "out"
|
|
713
|
-
});
|
|
714
744
|
var oneOrZero = (value) => flag(value) ?? (count(value) === null ? null : count(value) === 1);
|
|
745
|
+
var rawBody = (raw) => text(field(raw.body, "text")) ?? text(field(raw.body, "html")) ?? text(raw.content_preview);
|
|
746
|
+
var autoOf = (raw, mapped) => {
|
|
747
|
+
const verdict = detectAutoReply({
|
|
748
|
+
body: rawBody(raw),
|
|
749
|
+
from: text(raw.from_address_email),
|
|
750
|
+
subject: text(raw.subject)
|
|
751
|
+
});
|
|
752
|
+
const vendor = oneOrZero(raw.is_auto_reply) ?? (mapped === "ooo" ? true : null);
|
|
753
|
+
return {
|
|
754
|
+
isAuto: vendor ?? verdict.isAuto,
|
|
755
|
+
isAutoSource: vendor === null ? "rule" : "vendor",
|
|
756
|
+
leftCompany: verdict.leftCompany
|
|
757
|
+
};
|
|
758
|
+
};
|
|
759
|
+
var toMessage = (identity, raw, includeBody) => {
|
|
760
|
+
if (count(raw.ue_type) !== RECEIVED) {
|
|
761
|
+
return { ...messageFields(identity, raw, includeBody), direction: "out" };
|
|
762
|
+
}
|
|
763
|
+
const { isAuto, isAutoSource } = autoOf(
|
|
764
|
+
raw,
|
|
765
|
+
category(raw.i_status, NO_LABELS)
|
|
766
|
+
);
|
|
767
|
+
return {
|
|
768
|
+
...messageFields(identity, raw, includeBody),
|
|
769
|
+
direction: "in",
|
|
770
|
+
isAuto,
|
|
771
|
+
isAutoSource
|
|
772
|
+
};
|
|
773
|
+
};
|
|
715
774
|
var toReply = (identity, raw, includeBody, labels = NO_LABELS) => {
|
|
716
775
|
const mapped = category(raw.i_status, labels);
|
|
717
776
|
return {
|
|
@@ -719,7 +778,7 @@ var toReply = (identity, raw, includeBody, labels = NO_LABELS) => {
|
|
|
719
778
|
category: mapped ?? "unknown",
|
|
720
779
|
categorySource: mapped === void 0 ? null : "vendor",
|
|
721
780
|
direction: "in",
|
|
722
|
-
|
|
781
|
+
...autoOf(raw, mapped),
|
|
723
782
|
unread: oneOrZero(raw.is_unread)
|
|
724
783
|
};
|
|
725
784
|
};
|
|
@@ -853,6 +912,41 @@ var accountReaders = (client) => {
|
|
|
853
912
|
};
|
|
854
913
|
};
|
|
855
914
|
|
|
915
|
+
// src/instantly/thread.ts
|
|
916
|
+
var timeOf = (message) => message.sentAt === null ? Number.NaN : Date.parse(message.sentAt);
|
|
917
|
+
var answering = (message, answered) => {
|
|
918
|
+
const next = { ...message };
|
|
919
|
+
if (answered.stepIndex !== null) {
|
|
920
|
+
next.stepIndex = answered.stepIndex;
|
|
921
|
+
next.variantKey = answered.variantKey;
|
|
922
|
+
}
|
|
923
|
+
if (message.isAutoSource !== "vendor" && answeredAtOnce(answered.sentAt, message.sentAt)) {
|
|
924
|
+
next.isAuto = true;
|
|
925
|
+
next.isAutoSource = "rule";
|
|
926
|
+
}
|
|
927
|
+
return next;
|
|
928
|
+
};
|
|
929
|
+
var withAnsweredSteps = (messages) => {
|
|
930
|
+
const order = messages.flatMap(
|
|
931
|
+
(message, index) => Number.isNaN(timeOf(message)) ? [] : [{ index, message }]
|
|
932
|
+
).toSorted(
|
|
933
|
+
(left, right) => timeOf(left.message) - timeOf(right.message) || left.index - right.index
|
|
934
|
+
);
|
|
935
|
+
const lastSent = /* @__PURE__ */ new Map();
|
|
936
|
+
const result = [...messages];
|
|
937
|
+
for (const { index, message } of order) {
|
|
938
|
+
const thread = message.threadId;
|
|
939
|
+
if (thread !== null && message.direction === "out") {
|
|
940
|
+
lastSent.set(thread, message);
|
|
941
|
+
}
|
|
942
|
+
const answered = thread === null || message.direction === "out" ? void 0 : lastSent.get(thread);
|
|
943
|
+
if (answered !== void 0) {
|
|
944
|
+
result[index] = answering(message, answered);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
return result;
|
|
948
|
+
};
|
|
949
|
+
|
|
856
950
|
// src/instantly/adapter-mail.ts
|
|
857
951
|
var emailCursor = (next) => ({
|
|
858
952
|
after: text(field(next, "after")) ?? void 0,
|
|
@@ -862,6 +956,10 @@ var leadAddress = async (client, ctx, leadId, cursor) => {
|
|
|
862
956
|
if (leadId === void 0 || cursor.lead !== void 0) {
|
|
863
957
|
return cursor.lead;
|
|
864
958
|
}
|
|
959
|
+
const given = emailAddress(leadId);
|
|
960
|
+
if (given !== null) {
|
|
961
|
+
return given;
|
|
962
|
+
}
|
|
865
963
|
const lead = await client.getObject(
|
|
866
964
|
ctx,
|
|
867
965
|
`/leads/${encodeURIComponent(leadId)}`
|
|
@@ -914,10 +1012,11 @@ var listEmails = async (client, ctx, query, received) => {
|
|
|
914
1012
|
var mailReaders = (client) => ({
|
|
915
1013
|
listMessages: async (query, ctx) => {
|
|
916
1014
|
const page = await listEmails(client, ctx, query, false);
|
|
917
|
-
|
|
1015
|
+
const mapped = mapPage(
|
|
918
1016
|
page,
|
|
919
1017
|
(item) => toMessage(client.identity, item, query.includeBody)
|
|
920
1018
|
);
|
|
1019
|
+
return { ...mapped, items: withAnsweredSteps(mapped.items) };
|
|
921
1020
|
},
|
|
922
1021
|
listReplies: async (query, ctx) => {
|
|
923
1022
|
const page = await listEmails(client, ctx, query, true);
|
|
@@ -944,12 +1043,17 @@ var overviewRow = (scope, raw) => metricRow(scope, {
|
|
|
944
1043
|
bounced: count(raw.bounced_count),
|
|
945
1044
|
clicked: count(raw.link_click_count_unique),
|
|
946
1045
|
clickedTotal: count(raw.link_click_count),
|
|
947
|
-
|
|
1046
|
+
completed: count(raw.completed_count),
|
|
1047
|
+
contacted: count(raw.new_leads_contacted_count),
|
|
948
1048
|
opened: count(raw.open_count_unique),
|
|
949
1049
|
openedTotal: count(raw.open_count),
|
|
1050
|
+
opportunities: count(raw.total_opportunities),
|
|
1051
|
+
opportunityValue: count(raw.total_opportunity_value),
|
|
950
1052
|
positive: count(raw.total_interested),
|
|
951
1053
|
replied: count(raw.reply_count_unique),
|
|
952
1054
|
repliedAuto: count(raw.reply_count_automatic_unique),
|
|
1055
|
+
repliedAutoTotal: count(raw.reply_count_automatic),
|
|
1056
|
+
repliedTotal: count(raw.reply_count),
|
|
953
1057
|
sent: count(raw.emails_sent_count),
|
|
954
1058
|
unsubscribed: count(raw.unsubscribed_count)
|
|
955
1059
|
});
|
|
@@ -958,36 +1062,96 @@ var campaignRow = (scope, raw) => metricRow(scope, {
|
|
|
958
1062
|
bounced: count(raw.bounced_count),
|
|
959
1063
|
clicked: count(raw.link_click_count_unique),
|
|
960
1064
|
clickedTotal: count(raw.link_click_count),
|
|
961
|
-
|
|
1065
|
+
completed: count(raw.completed_count),
|
|
1066
|
+
contacted: count(raw.new_leads_contacted_count),
|
|
1067
|
+
leads: count(raw.leads_count),
|
|
962
1068
|
opened: count(raw.open_count_unique),
|
|
1069
|
+
opportunities: count(raw.total_opportunities),
|
|
1070
|
+
opportunityValue: count(raw.total_opportunity_value),
|
|
963
1071
|
replied: count(raw.reply_count_unique),
|
|
964
1072
|
repliedAuto: count(raw.reply_count_automatic_unique),
|
|
1073
|
+
repliedAutoTotal: count(raw.reply_count_automatic),
|
|
1074
|
+
repliedTotal: count(raw.reply_count),
|
|
965
1075
|
sent: count(raw.emails_sent_count),
|
|
966
1076
|
unsubscribed: count(raw.unsubscribed_count)
|
|
967
1077
|
});
|
|
968
|
-
var
|
|
1078
|
+
var reportCounts = (raw, contacted) => ({
|
|
969
1079
|
...emptyCounts(),
|
|
970
1080
|
bounced: count(raw.bounced),
|
|
971
1081
|
clicked: count(raw.unique_clicks),
|
|
972
1082
|
clickedTotal: count(raw.clicks),
|
|
973
|
-
contacted
|
|
1083
|
+
contacted,
|
|
974
1084
|
opened: count(raw.unique_opened),
|
|
975
1085
|
openedTotal: count(raw.opened),
|
|
976
1086
|
replied: count(raw.unique_replies),
|
|
977
1087
|
repliedAuto: count(raw.unique_replies_automatic),
|
|
1088
|
+
repliedAutoTotal: count(raw.replies_automatic),
|
|
1089
|
+
repliedTotal: count(raw.replies),
|
|
978
1090
|
sent: count(raw.sent)
|
|
979
1091
|
});
|
|
1092
|
+
var dailyCounts = (raw) => reportCounts(raw, count(raw.new_leads_contacted));
|
|
980
1093
|
var dailyRow = (scope, raw) => metricRow(scope, dailyCounts(raw), { date: text(raw.date) });
|
|
981
1094
|
var summedRow = (scope, days2) => metricRow(scope, sumCounts(days2.map(dailyCounts)), { evidence: "derived" });
|
|
982
1095
|
var stepRow = (scope, raw) => {
|
|
983
1096
|
const step = count(raw.step);
|
|
984
1097
|
const variant = count(raw.variant);
|
|
985
|
-
return metricRow(scope,
|
|
1098
|
+
return metricRow(scope, reportCounts(raw, count(raw.contacted)), {
|
|
986
1099
|
stepIndex: step !== null && Number.isInteger(step) ? step : null,
|
|
987
1100
|
variantKey: variant === null ? null : variantKey(variant)
|
|
988
1101
|
});
|
|
989
1102
|
};
|
|
990
1103
|
|
|
1104
|
+
// src/instantly/stats-tracking.ts
|
|
1105
|
+
var LISTING_PAGES = 10;
|
|
1106
|
+
var UNKNOWN = { clicks: null, opens: null };
|
|
1107
|
+
var trackingFlags = (raw) => ({
|
|
1108
|
+
clicks: flag(raw.link_tracking),
|
|
1109
|
+
opens: flag(raw.open_tracking)
|
|
1110
|
+
});
|
|
1111
|
+
var campaignFlags = async (client, ctx, campaignId) => await unlessFailed(
|
|
1112
|
+
async () => trackingFlags(
|
|
1113
|
+
await client.getObject(
|
|
1114
|
+
ctx,
|
|
1115
|
+
`/campaigns/${encodeURIComponent(campaignId)}`
|
|
1116
|
+
)
|
|
1117
|
+
)
|
|
1118
|
+
);
|
|
1119
|
+
var everyCampaignFlags = async (client, ctx) => await unlessFailed(async () => {
|
|
1120
|
+
const campaigns = await readLookup(client, ctx, {
|
|
1121
|
+
filters: {},
|
|
1122
|
+
pages: LISTING_PAGES,
|
|
1123
|
+
path: "/campaigns"
|
|
1124
|
+
});
|
|
1125
|
+
return new Map(
|
|
1126
|
+
campaigns.flatMap((campaign) => {
|
|
1127
|
+
const id = text(campaign.id);
|
|
1128
|
+
return id === null ? [] : [[id, trackingFlags(campaign)]];
|
|
1129
|
+
})
|
|
1130
|
+
);
|
|
1131
|
+
});
|
|
1132
|
+
var plus = (left, right) => left === null && right === null ? null : (left ?? 0) + (right ?? 0);
|
|
1133
|
+
var reportTracking = (raw, flags) => ({
|
|
1134
|
+
clicked: plus(
|
|
1135
|
+
count(raw.link_click_count_unique),
|
|
1136
|
+
count(raw.link_click_count)
|
|
1137
|
+
),
|
|
1138
|
+
flags: flags ?? UNKNOWN,
|
|
1139
|
+
opened: plus(count(raw.open_count_unique), count(raw.open_count)),
|
|
1140
|
+
sent: count(raw.emails_sent_count)
|
|
1141
|
+
});
|
|
1142
|
+
var workspaceTracking = async (client, ctx, range2) => {
|
|
1143
|
+
const report = await unlessFailed(
|
|
1144
|
+
async () => await client.getRows(ctx, "/campaigns/analytics", { query: range2 })
|
|
1145
|
+
);
|
|
1146
|
+
if (report === null) {
|
|
1147
|
+
return null;
|
|
1148
|
+
}
|
|
1149
|
+
const flags = await everyCampaignFlags(client, ctx);
|
|
1150
|
+
return flags === null ? null : report.map(
|
|
1151
|
+
(raw) => reportTracking(raw, flags.get(text(raw.campaign_id) ?? ""))
|
|
1152
|
+
);
|
|
1153
|
+
};
|
|
1154
|
+
|
|
991
1155
|
// src/instantly/stats.ts
|
|
992
1156
|
var range = (query) => ({
|
|
993
1157
|
end_date: query.to,
|
|
@@ -997,8 +1161,20 @@ var senderStats = async (client, ctx, scope, query) => {
|
|
|
997
1161
|
const days2 = await client.getRows(ctx, "/accounts/analytics/daily", {
|
|
998
1162
|
query: { ...range(query), emails: scope.scopeId }
|
|
999
1163
|
});
|
|
1000
|
-
|
|
1164
|
+
const rows = query.by === "day" ? days2.map((day) => dailyRow(scope, day)) : [summedRow(scope, days2)];
|
|
1165
|
+
return applyTracking(
|
|
1166
|
+
rows,
|
|
1167
|
+
await workspaceTracking(client, ctx, range(query))
|
|
1168
|
+
);
|
|
1169
|
+
};
|
|
1170
|
+
var ownRows = async (client, ctx, campaignId, rows) => {
|
|
1171
|
+
const flags = await campaignFlags(client, ctx, campaignId);
|
|
1172
|
+
return applyTracking(
|
|
1173
|
+
rows,
|
|
1174
|
+
flags === null ? null : [ownTracking(flags, rows)]
|
|
1175
|
+
);
|
|
1001
1176
|
};
|
|
1177
|
+
var judged = async (client, ctx, query, rows) => query.scopeId === void 0 ? applyTracking(rows, await workspaceTracking(client, ctx, range(query))) : await ownRows(client, ctx, query.scopeId, rows);
|
|
1002
1178
|
var readStats = async (client, ctx, query) => {
|
|
1003
1179
|
const { identity } = client;
|
|
1004
1180
|
const scope = {
|
|
@@ -1020,9 +1196,17 @@ var readStats = async (client, ctx, query) => {
|
|
|
1020
1196
|
const campaigns = await client.getRows(ctx, "/campaigns/analytics", {
|
|
1021
1197
|
query: range(query)
|
|
1022
1198
|
});
|
|
1199
|
+
const flags = await everyCampaignFlags(client, ctx);
|
|
1023
1200
|
return campaigns.flatMap((campaign) => {
|
|
1024
1201
|
const scopeId = text(campaign.campaign_id);
|
|
1025
|
-
|
|
1202
|
+
if (scopeId === null) {
|
|
1203
|
+
return [];
|
|
1204
|
+
}
|
|
1205
|
+
const row = campaignRow({ ...scope, scopeId }, campaign);
|
|
1206
|
+
return applyTracking(
|
|
1207
|
+
[row],
|
|
1208
|
+
flags === null ? null : [{ ...reportTracking(campaign, flags.get(scopeId)), sent: null }]
|
|
1209
|
+
);
|
|
1026
1210
|
});
|
|
1027
1211
|
}
|
|
1028
1212
|
if (query.scope === "step") {
|
|
@@ -1038,13 +1222,23 @@ var readStats = async (client, ctx, query) => {
|
|
|
1038
1222
|
const steps = await client.getRows(ctx, "/campaigns/analytics/steps", {
|
|
1039
1223
|
query: { ...range(query), campaign_id: query.scopeId }
|
|
1040
1224
|
});
|
|
1041
|
-
return
|
|
1225
|
+
return await judged(
|
|
1226
|
+
client,
|
|
1227
|
+
ctx,
|
|
1228
|
+
query,
|
|
1229
|
+
steps.map((step) => stepRow(scope, step))
|
|
1230
|
+
);
|
|
1042
1231
|
}
|
|
1043
1232
|
if (query.by === "day") {
|
|
1044
1233
|
const days2 = await client.getRows(ctx, "/campaigns/analytics/daily", {
|
|
1045
1234
|
query: { ...range(query), campaign_id: query.scopeId }
|
|
1046
1235
|
});
|
|
1047
|
-
return
|
|
1236
|
+
return await judged(
|
|
1237
|
+
client,
|
|
1238
|
+
ctx,
|
|
1239
|
+
query,
|
|
1240
|
+
days2.map((day) => dailyRow(scope, day))
|
|
1241
|
+
);
|
|
1048
1242
|
}
|
|
1049
1243
|
const overview = await client.getObject(
|
|
1050
1244
|
ctx,
|
|
@@ -1053,7 +1247,7 @@ var readStats = async (client, ctx, query) => {
|
|
|
1053
1247
|
query: { ...range(query), id: query.scopeId }
|
|
1054
1248
|
}
|
|
1055
1249
|
);
|
|
1056
|
-
return [overviewRow(scope, overview)];
|
|
1250
|
+
return await judged(client, ctx, query, [overviewRow(scope, overview)]);
|
|
1057
1251
|
};
|
|
1058
1252
|
|
|
1059
1253
|
// src/instantly/adapter.ts
|
|
@@ -1175,13 +1369,54 @@ var leadListBody = (query) => {
|
|
|
1175
1369
|
if (query.email !== void 0) {
|
|
1176
1370
|
body.contacts = [query.email];
|
|
1177
1371
|
}
|
|
1372
|
+
if (query.domain !== void 0) {
|
|
1373
|
+
body.search = query.domain;
|
|
1374
|
+
}
|
|
1178
1375
|
if (isString(query.next)) {
|
|
1179
1376
|
body.starting_after = query.next;
|
|
1180
1377
|
}
|
|
1181
1378
|
return body;
|
|
1182
1379
|
};
|
|
1380
|
+
var listLeads = async (client, query, ctx) => {
|
|
1381
|
+
if (query.linkedinUrl !== void 0) {
|
|
1382
|
+
return { items: [] };
|
|
1383
|
+
}
|
|
1384
|
+
const envelope = listEnvelope(
|
|
1385
|
+
await client.post(ctx, "/leads/list", leadListBody(query)),
|
|
1386
|
+
client.identity.provider,
|
|
1387
|
+
"/leads/list"
|
|
1388
|
+
);
|
|
1389
|
+
const labels = await readLabels(
|
|
1390
|
+
client,
|
|
1391
|
+
ctx,
|
|
1392
|
+
envelope.items.map((item) => item.lt_interest_status)
|
|
1393
|
+
);
|
|
1394
|
+
const leads = envelope.items.map(
|
|
1395
|
+
(item) => toLead(client.identity, item, labels)
|
|
1396
|
+
);
|
|
1397
|
+
return {
|
|
1398
|
+
// `contacts` is documented as the emails a lead needs to have, but not
|
|
1399
|
+
// how it compares them, and `search` matches more than the address, so
|
|
1400
|
+
// both matches are made exact here.
|
|
1401
|
+
items: leads.filter(
|
|
1402
|
+
(lead) => (query.email === void 0 || lead.email === query.email) && (query.domain === void 0 || lead.email?.split("@").at(-1) === query.domain)
|
|
1403
|
+
),
|
|
1404
|
+
next: envelope.next
|
|
1405
|
+
};
|
|
1406
|
+
};
|
|
1183
1407
|
var leadReaders = (client) => ({
|
|
1184
1408
|
getLead: async (id, ctx) => {
|
|
1409
|
+
const address = emailAddress(id);
|
|
1410
|
+
if (address !== null) {
|
|
1411
|
+
const page = await listLeads(client, { email: address }, ctx);
|
|
1412
|
+
const [lead2] = page.items;
|
|
1413
|
+
if (lead2 === void 0) {
|
|
1414
|
+
throw new OutboundError("NotFound", "No lead has that address", {
|
|
1415
|
+
provider: client.identity.provider
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
return lead2;
|
|
1419
|
+
}
|
|
1185
1420
|
const lead = await client.getObject(
|
|
1186
1421
|
ctx,
|
|
1187
1422
|
`/leads/${encodeURIComponent(id)}`
|
|
@@ -1192,30 +1427,7 @@ var leadReaders = (client) => ({
|
|
|
1192
1427
|
await readLabels(client, ctx, [lead.lt_interest_status])
|
|
1193
1428
|
);
|
|
1194
1429
|
},
|
|
1195
|
-
listLeads: async (query, ctx) =>
|
|
1196
|
-
if (query.linkedinUrl !== void 0) {
|
|
1197
|
-
return { items: [] };
|
|
1198
|
-
}
|
|
1199
|
-
const envelope = listEnvelope(
|
|
1200
|
-
await client.post(ctx, "/leads/list", leadListBody(query)),
|
|
1201
|
-
client.identity.provider,
|
|
1202
|
-
"/leads/list"
|
|
1203
|
-
);
|
|
1204
|
-
const labels = await readLabels(
|
|
1205
|
-
client,
|
|
1206
|
-
ctx,
|
|
1207
|
-
envelope.items.map((item) => item.lt_interest_status)
|
|
1208
|
-
);
|
|
1209
|
-
const leads = envelope.items.map(
|
|
1210
|
-
(item) => toLead(client.identity, item, labels)
|
|
1211
|
-
);
|
|
1212
|
-
return {
|
|
1213
|
-
// `contacts` is documented as the emails a lead needs to have, but not
|
|
1214
|
-
// how it compares them, so the match is made exact here.
|
|
1215
|
-
items: query.email === void 0 ? leads : leads.filter((lead) => lead.email === query.email),
|
|
1216
|
-
next: envelope.next
|
|
1217
|
-
};
|
|
1218
|
-
}
|
|
1430
|
+
listLeads: async (query, ctx) => await listLeads(client, query, ctx)
|
|
1219
1431
|
});
|
|
1220
1432
|
var readers = (client) => {
|
|
1221
1433
|
const { identity } = client;
|
|
@@ -21,5 +21,9 @@ export declare const summedRow: (scope: RowScope, days: readonly JsonObject[]) =
|
|
|
21
21
|
* `GET /campaigns/analytics/steps`. Step and variant are both counted from 0
|
|
22
22
|
* (seen live: a seven-step campaign reports steps "0" to "6"). A row whose
|
|
23
23
|
* step is null or `\N` holds counts Instantly could not tie to a step.
|
|
24
|
+
*
|
|
25
|
+
* The reference lists no contacted count for a step. Where a row has
|
|
26
|
+
* `contacted`, it is the leads that step reached, so it is read as it is:
|
|
27
|
+
* a step's leads, not leads whose sequence started.
|
|
24
28
|
*/
|
|
25
29
|
export declare const stepRow: (scope: RowScope, raw: JsonObject) => MetricRow;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AdapterContext } from "../internal/adapter.ts";
|
|
2
|
+
import type { JsonObject } from "../internal/json.ts";
|
|
3
|
+
import type { CampaignTracking, TrackingFlags } from "../internal/tracking.ts";
|
|
4
|
+
import type { InstantlyClient } from "./client.ts";
|
|
5
|
+
export declare const trackingFlags: (raw: JsonObject) => TrackingFlags;
|
|
6
|
+
/** One campaign's settings, or `null` when they could not be read. */
|
|
7
|
+
export declare const campaignFlags: (client: InstantlyClient, ctx: AdapterContext, campaignId: string) => Promise<TrackingFlags | null>;
|
|
8
|
+
/** Every campaign's settings by id, or `null` when the listing failed. */
|
|
9
|
+
export declare const everyCampaignFlags: (client: InstantlyClient, ctx: AdapterContext) => Promise<Map<string, TrackingFlags> | null>;
|
|
10
|
+
/** One campaign's row of `GET /campaigns/analytics` with its settings. */
|
|
11
|
+
export declare const reportTracking: (raw: JsonObject, flags: TrackingFlags | undefined) => CampaignTracking;
|
|
12
|
+
/**
|
|
13
|
+
* Every campaign behind a workspace or sender total over the range, or
|
|
14
|
+
* `null` when either read failed.
|
|
15
|
+
*/
|
|
16
|
+
export declare const workspaceTracking: (client: InstantlyClient, ctx: AdapterContext, range: {
|
|
17
|
+
readonly start_date: string | undefined;
|
|
18
|
+
readonly end_date: string | undefined;
|
|
19
|
+
}) => Promise<CampaignTracking[] | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Message } from "../internal/entities.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Sets each received email's step from the sent email it answers: the last
|
|
4
|
+
* one sent before it in its thread. A received email's own `step` lags on a
|
|
5
|
+
* sequence's last step (seen live 2026-11-15: a reply to step 3 carried step
|
|
6
|
+
* 2). A reply under a minute after that send is automatic unless Instantly
|
|
7
|
+
* said otherwise. A reply with no earlier send in its thread is left as it is.
|
|
8
|
+
*/
|
|
9
|
+
export declare const withAnsweredSteps: (messages: readonly Message[]) => Message[];
|
|
@@ -59,6 +59,11 @@ export interface LeadQuery extends PageQuery, TimeRange {
|
|
|
59
59
|
readonly email?: string | undefined;
|
|
60
60
|
/** Only the lead records with exactly this LinkedIn profile URL. */
|
|
61
61
|
readonly linkedinUrl?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Only the lead records whose address is at exactly this domain, lowercased.
|
|
64
|
+
* A subdomain is another domain.
|
|
65
|
+
*/
|
|
66
|
+
readonly domain?: string | undefined;
|
|
62
67
|
}
|
|
63
68
|
export interface MessageQuery extends PageQuery, TimeRange {
|
|
64
69
|
readonly campaignId?: string | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** What a received email says about itself. Any field may be unknown. */
|
|
2
|
+
export interface AutoReplyInput {
|
|
3
|
+
/** The address the reply came from. */
|
|
4
|
+
readonly from: string | null;
|
|
5
|
+
readonly subject: string | null;
|
|
6
|
+
/** The body, HTML or plain text, quoted history included or not. */
|
|
7
|
+
readonly body: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface AutoReplyVerdict {
|
|
10
|
+
/** `true` when a rule matched. */
|
|
11
|
+
readonly isAuto: boolean;
|
|
12
|
+
/** `true` when the reply says the person left the company or the contact changed. */
|
|
13
|
+
readonly leftCompany: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Under this many milliseconds after the message it answers, no person wrote the reply. */
|
|
16
|
+
export declare const AUTO_REPLY_WITHIN_MS = 60000;
|
|
17
|
+
/** Reads a received email by the fixed rules above. */
|
|
18
|
+
export declare const detectAutoReply: (input: AutoReplyInput) => AutoReplyVerdict;
|
|
19
|
+
/** `true` when a reply came so soon after the message it answers that no person wrote it. */
|
|
20
|
+
export declare const answeredAtOnce: (sentAt: string | null, repliedAt: string | null) => boolean;
|
|
@@ -31,6 +31,8 @@ export interface Capabilities {
|
|
|
31
31
|
"leads.since": FilterGrade;
|
|
32
32
|
/** Find a lead by its exact email address or LinkedIn profile, without walking every lead. */
|
|
33
33
|
"leads.lookup": boolean;
|
|
34
|
+
/** Find the leads whose email address is at one domain, without walking every lead. */
|
|
35
|
+
"leads.byDomain": boolean;
|
|
34
36
|
/** Leads carry open, click and reply counts. */
|
|
35
37
|
"leads.engagement": boolean;
|
|
36
38
|
/** List the saved lead lists. */
|