outbound-sdk 0.10.0 → 0.12.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.
Files changed (85) hide show
  1. package/dist/alerts/index.js +1 -1
  2. package/dist/cards/index.js +201 -92
  3. package/dist/cards/sender-tool-cards.d.ts +6 -0
  4. package/dist/chunks/{chunk-MEEJIIIA.js → chunk-2ADIGC2N.js} +77 -8
  5. package/dist/chunks/{chunk-NAYVG7SI.js → chunk-3DDYXUDG.js} +1 -1
  6. package/dist/chunks/{chunk-UAHYPASH.js → chunk-3LRIWQEJ.js} +2 -1
  7. package/dist/chunks/{chunk-UZLFZZ2U.js → chunk-AWNH4I5D.js} +11 -2
  8. package/dist/chunks/{chunk-A7DLJUA6.js → chunk-B72F56HF.js} +3 -1
  9. package/dist/chunks/{chunk-KMQHXFIZ.js → chunk-CTRYCW4G.js} +648 -182
  10. package/dist/chunks/{chunk-OVTYA3IB.js → chunk-HDTOGEVN.js} +532 -182
  11. package/dist/chunks/{chunk-POBAY3TI.js → chunk-HXCZMMSD.js} +21 -0
  12. package/dist/chunks/chunk-I7GBBHD2.js +80 -0
  13. package/dist/chunks/{chunk-FTK4JS65.js → chunk-KNWJIJVO.js} +73 -4
  14. package/dist/chunks/{chunk-UOJG4VYF.js → chunk-LD5OAELW.js} +1 -1
  15. package/dist/chunks/{chunk-YFJ3OQZS.js → chunk-OPLXELPS.js} +5 -1
  16. package/dist/chunks/{chunk-KQCIF5IT.js → chunk-UIINRLHQ.js} +23 -9
  17. package/dist/chunks/{chunk-OMCDMELK.js → chunk-UWNQEQIX.js} +1 -1
  18. package/dist/chunks/{chunk-MPE6VLLY.js → chunk-UZ4YWUZ7.js} +1 -1
  19. package/dist/chunks/{tools-AVJ3XJ5A.js → tools-EKLZKXZU.js} +5 -4
  20. package/dist/cli/bin.js +11 -10
  21. package/dist/cli/config.d.ts +2 -0
  22. package/dist/cli/index.js +10 -9
  23. package/dist/combine/index.js +36 -2
  24. package/dist/emailbison/index.js +4 -4
  25. package/dist/fixtures/index.js +4 -4
  26. package/dist/heyreach/index.js +14 -6
  27. package/dist/identity/index.js +46 -11
  28. package/dist/identity/keys.d.ts +1 -1
  29. package/dist/index.js +8 -6
  30. package/dist/insights/define.d.ts +1 -1
  31. package/dist/insights/index.js +5 -4
  32. package/dist/insights/inputs.generated.d.ts +68 -5
  33. package/dist/insights/ops/channel-mix.d.ts +8 -1
  34. package/dist/insights/ops/period-comparison.d.ts +13 -2
  35. package/dist/insights/ops/shared.d.ts +11 -1
  36. package/dist/insights/ops/tag-rollup.d.ts +8 -1
  37. package/dist/insights/people/dropped-replies-check.d.ts +14 -2
  38. package/dist/insights/people/find.d.ts +5 -4
  39. package/dist/insights/people/hot-leads.d.ts +10 -1
  40. package/dist/insights/people/index.d.ts +26 -2
  41. package/dist/insights/people/person-summary.d.ts +15 -3
  42. package/dist/insights/people/thread-context.d.ts +79 -0
  43. package/dist/insights/people/thread-contexts.d.ts +59 -0
  44. package/dist/insights/people/thread-read.d.ts +22 -0
  45. package/dist/insights/registry.d.ts +25 -3
  46. package/dist/insights/senders/domain-health.d.ts +1 -1
  47. package/dist/insights/senders/index.d.ts +1 -1
  48. package/dist/insights/senders/read.d.ts +9 -0
  49. package/dist/instantly/adapter.d.ts +3 -2
  50. package/dist/instantly/capabilities.d.ts +5 -0
  51. package/dist/instantly/index.js +148 -45
  52. package/dist/instantly/senders.d.ts +3 -0
  53. package/dist/internal/adapter.d.ts +7 -0
  54. package/dist/internal/capabilities.d.ts +8 -0
  55. package/dist/internal/entities.d.ts +20 -0
  56. package/dist/internal/fields.d.ts +8 -0
  57. package/dist/internal/outbound/api.d.ts +12 -0
  58. package/dist/internal/outbound/operations-account.d.ts +4 -1
  59. package/dist/internal/outbound/outbound.d.ts +2 -1
  60. package/dist/internal/outbound/specs-account.d.ts +2 -1
  61. package/dist/internal/person.d.ts +32 -0
  62. package/dist/internal/records.d.ts +2 -2
  63. package/dist/internal/url.d.ts +2 -1
  64. package/dist/loader/index.js +1 -1
  65. package/dist/memory/data.d.ts +2 -1
  66. package/dist/memory/index.js +6 -4
  67. package/dist/redact/index.d.ts +1 -1
  68. package/dist/redact/index.js +48 -26
  69. package/dist/redact/plugin.d.ts +12 -4
  70. package/dist/redact/tokens.d.ts +21 -0
  71. package/dist/smartlead/index.js +18 -7
  72. package/dist/tools/account-tools.d.ts +0 -5
  73. package/dist/tools/ai-sdk.js +5 -3
  74. package/dist/tools/campaign-tools.d.ts +0 -4
  75. package/dist/tools/claude-agent.js +5 -3
  76. package/dist/tools/deliverability-check.d.ts +9 -0
  77. package/dist/tools/index.js +6 -4
  78. package/dist/tools/people-tools.d.ts +4 -1
  79. package/dist/tools/person-input.d.ts +17 -0
  80. package/dist/tools/sender-health.d.ts +8 -0
  81. package/dist/tools/sender-impact.d.ts +38 -0
  82. package/dist/tools/shared.d.ts +5 -0
  83. package/dist/webhooks/index.js +6 -6
  84. package/package.json +1 -1
  85. /package/dist/chunks/{chunk-5XLR6XVV.js → chunk-TOZKA7JR.js} +0 -0
@@ -0,0 +1,79 @@
1
+ import type { Lead, MeetingStatus, Message, ReplyCategory } from "../../internal/entities.ts";
2
+ import type { OutboundApi } from "../../internal/outbound/api.ts";
3
+ /** A wait as a person says it: in hours under two days, in whole days after. */
4
+ export declare const waited: (hours: number) => string;
5
+ /** The newest message of a conversation, without its body. */
6
+ export type LatestMessage = Omit<Message, "bodyHtml" | "bodyText">;
7
+ /** Who wrote last in a conversation, and when, from the messages read. */
8
+ export interface ThreadActivity {
9
+ /** Messages read in the conversation. 0 when it was not read. */
10
+ readonly messagesRead: number;
11
+ /** The newest message with a time. `null` when none was read. */
12
+ readonly latest: LatestMessage | null;
13
+ readonly lastInboundAt: string | null;
14
+ readonly lastOutboundAt: string | null;
15
+ }
16
+ /** What the vendor says about interest, kept apart from the follow-up assessment. */
17
+ export interface VendorSentiment {
18
+ /** The vendor's category on the reply the result is about. `null` when it is not about one. */
19
+ readonly replyCategory: ReplyCategory | null;
20
+ /** The vendor's label on the lead, such as `Interested`. */
21
+ readonly leadLabel: string | null;
22
+ /** What `leadLabel` means, in reply categories. */
23
+ readonly leadCategory: ReplyCategory | null;
24
+ }
25
+ /**
26
+ * The rule that decided `needed`: `answered` (the latest message is
27
+ * outbound), `meeting` (the vendor records a meeting booked, held or won),
28
+ * `inbound_unanswered` (the latest message is inbound and not automatic),
29
+ * `automatic` (the latest message is an automatic reply), `no_messages` (the
30
+ * conversation read holds none with a time), `not_read` (it was not read).
31
+ */
32
+ export type FollowUpBasis = "answered" | "automatic" | "inbound_unanswered" | "meeting" | "no_messages" | "not_read";
33
+ export interface FollowUpAssessment {
34
+ /**
35
+ * `true` when the latest message is inbound, not automatic and the vendor
36
+ * records no meeting; `false` when the vendor records a meeting booked,
37
+ * held or won, read or not, or the latest message is outbound; `null` when
38
+ * the rules cannot tell. A vendor label alone never sets it.
39
+ */
40
+ readonly needed: boolean | null;
41
+ readonly basis: FollowUpBasis;
42
+ /** The facts the rules used, as sentences. */
43
+ readonly evidence: readonly string[];
44
+ /** What the rules could not check, as sentences. */
45
+ readonly unchecked: readonly string[];
46
+ }
47
+ export interface ThreadContext {
48
+ readonly activity: ThreadActivity;
49
+ /** The meeting the vendor records on the lead. `null` when it records none or the lead was not read. */
50
+ readonly meeting: MeetingStatus | null;
51
+ readonly vendorSentiment: VendorSentiment;
52
+ readonly followUp: FollowUpAssessment;
53
+ }
54
+ /** The reply a result is about, when the vendor labelled it. */
55
+ export interface LabelledReply {
56
+ readonly ref: string;
57
+ readonly category: ReplyCategory;
58
+ readonly sentAt: string | null;
59
+ }
60
+ export interface ThreadFacts {
61
+ /** The conversation's messages, in any order. `null` when it was not read. */
62
+ readonly messages: readonly Message[] | null;
63
+ /** Why the conversation was not read. */
64
+ readonly notRead?: string | undefined;
65
+ /** The lead record. `null` when it was not read or there is none. */
66
+ readonly lead: Lead | null;
67
+ readonly provider: string;
68
+ /** `false` where the vendor records no meeting on a lead. */
69
+ readonly meetingsRecorded: boolean;
70
+ readonly labelled?: LabelledReply | null | undefined;
71
+ readonly now: number;
72
+ }
73
+ /** `false` where the adapter never fills a lead's `meeting`. */
74
+ export declare const recordsMeetings: (outbound: OutboundApi) => boolean;
75
+ export declare const withoutBody: ({ bodyHtml: _html, bodyText: _text, ...rest }: Message) => LatestMessage;
76
+ export declare const activityOf: (messages: readonly Message[] | null) => ThreadActivity;
77
+ export declare const assessFollowUp: (facts: ThreadFacts, activity: ThreadActivity) => FollowUpAssessment;
78
+ /** Activity, meeting, vendor sentiment and the follow-up assessment of one conversation. */
79
+ export declare const threadContext: (facts: ThreadFacts) => ThreadContext;
@@ -0,0 +1,59 @@
1
+ import { untrusted } from "../../tools/shared.ts";
2
+ import type { LatestMessage, ThreadContext } from "./thread-context.ts";
3
+ import type { Target } from "./thread-read.ts";
4
+ /** One message of a conversation, with a snippet instead of its body. */
5
+ export type ThreadMessage = LatestMessage & {
6
+ readonly snippet: ReturnType<typeof untrusted>;
7
+ };
8
+ export interface ThreadRecord extends ThreadContext {
9
+ readonly target: Target;
10
+ /** The lead the conversation is with. `null` when no message names one. */
11
+ readonly lead: string | null;
12
+ readonly email: string | null;
13
+ readonly linkedinUrl: string | null;
14
+ readonly campaign: string | null;
15
+ readonly threadIds: readonly string[];
16
+ /** The newest `max_messages` messages, oldest first. */
17
+ readonly messages: readonly ThreadMessage[];
18
+ /** Messages read but left out by `max_messages`. */
19
+ readonly messagesOmitted: number;
20
+ }
21
+ export interface Uncovered {
22
+ readonly target: Target;
23
+ readonly reason: string;
24
+ }
25
+ export interface ThreadContexts {
26
+ /** In the order asked: leads first, then threads. */
27
+ readonly threads: readonly ThreadRecord[];
28
+ readonly coverage: {
29
+ /** Distinct leads and threads asked for, over every page. */
30
+ readonly requested: number;
31
+ /** Asked for and read on this page. */
32
+ readonly checked: number;
33
+ /** Read, with at least one message. */
34
+ readonly found: number;
35
+ /** Read and empty: an unknown thread, or a lead never written to. */
36
+ readonly notFound: readonly Uncovered[];
37
+ /** Asked for on this page but not read, with why. Their records say the same. */
38
+ readonly unchecked: readonly Uncovered[];
39
+ /** Asked for and left to later pages. */
40
+ readonly remaining: number;
41
+ /** Pass as `cursor` to read the next page. `null` on the last page. */
42
+ readonly nextCursor: string | null;
43
+ };
44
+ }
45
+ export declare const threadContexts: import("../define.ts").InsightDefinition<"threadContext", {
46
+ bodies: "none" | "snippet";
47
+ cursor: string | null;
48
+ leads: string[];
49
+ max_messages: number;
50
+ page_size: number;
51
+ threads: string[];
52
+ }, ThreadContexts, {
53
+ bodies?: "none" | "snippet" | undefined;
54
+ cursor?: string | null | undefined;
55
+ leads?: string[] | undefined;
56
+ max_messages?: number | undefined;
57
+ page_size?: number | undefined;
58
+ threads?: string[] | undefined;
59
+ }>;
@@ -0,0 +1,22 @@
1
+ import type { Lead, Message } from "../../internal/entities.ts";
2
+ import type { InsightContext } from "../define.ts";
3
+ import type { ThreadContext } from "./thread-context.ts";
4
+ export interface Target {
5
+ readonly kind: "lead" | "thread";
6
+ readonly id: string;
7
+ }
8
+ export interface Read {
9
+ readonly target: Target;
10
+ /** `null` when the read failed. */
11
+ readonly messages: readonly Message[] | null;
12
+ /** Why the conversation was not read, such as `the read failed with NotFound`. */
13
+ readonly failed: string | null;
14
+ }
15
+ export declare const readConversation: (context: InsightContext, target: Target, bodies: boolean) => Promise<Read>;
16
+ /** A lead's messages in its own campaign: a vendor that uses one id in every campaign returns them all. */
17
+ export declare const inCampaign: (messages: readonly Message[], lead: Lead | null | undefined) => Message[];
18
+ /**
19
+ * The context of each lead's conversation, read from its timeline, by lead
20
+ * ref. Where the tool cannot read a timeline, each is unread with that reason.
21
+ */
22
+ export declare const leadContexts: (context: InsightContext, leads: readonly Lead[], skipped?: string | null) => Promise<Map<string, ThreadContext>>;
@@ -1,9 +1,15 @@
1
1
  import type { InsightEntry } from "./define.ts";
2
2
  export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition<"personSummary", {
3
3
  max_campaigns: number;
4
- person: string;
4
+ email?: string | undefined;
5
+ lead_ref?: string | undefined;
6
+ linkedin_url?: string | undefined;
7
+ person?: string | undefined;
5
8
  }, import("./people/person-summary.ts").PersonSummary, {
6
- person: string;
9
+ email?: string | undefined;
10
+ lead_ref?: string | undefined;
11
+ linkedin_url?: string | undefined;
12
+ person?: string | undefined;
7
13
  max_campaigns?: number | undefined;
8
14
  }>, import("./define.ts").InsightDefinition<"accountSummary", {
9
15
  allow_free_domains: boolean;
@@ -62,6 +68,7 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
62
68
  max_age_days: number;
63
69
  include_engagement_only: boolean;
64
70
  positive_labels: string[];
71
+ read_threads: boolean;
65
72
  recency_days: number;
66
73
  weight_click: number;
67
74
  weight_interest: number;
@@ -77,12 +84,27 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
77
84
  max_age_days?: number | undefined;
78
85
  include_engagement_only?: boolean | undefined;
79
86
  positive_labels?: string[] | undefined;
87
+ read_threads?: boolean | undefined;
80
88
  recency_days?: number | undefined;
81
89
  weight_click?: number | undefined;
82
90
  weight_interest?: number | undefined;
83
91
  weight_open?: number | undefined;
84
92
  weight_recency?: number | undefined;
85
93
  weight_reply?: number | undefined;
94
+ }>, import("./define.ts").InsightDefinition<"threadContext", {
95
+ bodies: "none" | "snippet";
96
+ cursor: string | null;
97
+ leads: string[];
98
+ max_messages: number;
99
+ page_size: number;
100
+ threads: string[];
101
+ }, import("./people/thread-contexts.ts").ThreadContexts, {
102
+ bodies?: "none" | "snippet" | undefined;
103
+ cursor?: string | null | undefined;
104
+ leads?: string[] | undefined;
105
+ max_messages?: number | undefined;
106
+ page_size?: number | undefined;
107
+ threads?: string[] | undefined;
86
108
  }>, import("./define.ts").InsightDefinition<"personalizationGaps", {
87
109
  campaign: string;
88
110
  limit: number;
@@ -168,8 +190,8 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
168
190
  since?: string | null | undefined;
169
191
  timezone_offset_minutes?: number | undefined;
170
192
  }>, import("./define.ts").InsightDefinition<"domainHealth", {
171
- max_senders: number;
172
193
  max_spam_rate: number;
194
+ max_senders?: number | undefined;
173
195
  }, import("./senders/domain-health.ts").DomainHealth, {
174
196
  max_senders?: number | undefined;
175
197
  max_spam_rate?: number | undefined;
@@ -60,8 +60,8 @@ export interface DomainHealth {
60
60
  };
61
61
  }
62
62
  export declare const domainHealth: import("../define.ts").InsightDefinition<"domainHealth", {
63
- max_senders: number;
64
63
  max_spam_rate: number;
64
+ max_senders?: number | undefined;
65
65
  }, DomainHealth, {
66
66
  max_senders?: number | undefined;
67
67
  max_spam_rate?: number | undefined;
@@ -1,6 +1,6 @@
1
1
  export declare const SENDERS_INSIGHTS: readonly [import("../define.ts").InsightDefinition<"domainHealth", {
2
- max_senders: number;
3
2
  max_spam_rate: number;
3
+ max_senders?: number | undefined;
4
4
  }, import("./domain-health.ts").DomainHealth, {
5
5
  max_senders?: number | undefined;
6
6
  max_spam_rate?: number | undefined;
@@ -14,6 +14,15 @@ export declare const readSenders: (context: InsightContext, max: number) => Prom
14
14
  * naming it, and the answer is marked incomplete. Any other error throws.
15
15
  */
16
16
  export declare const readHealth: (context: InsightContext, sender: Sender) => Promise<SenderHealth | null>;
17
+ /**
18
+ * Every sender's health from `senderHealth`, a page at a time, matched to
19
+ * the senders read. A sender the listing did not return is left out, with
20
+ * one note counting them, and the answer is marked incomplete.
21
+ */
22
+ export declare const readHealthInPages: (context: InsightContext, senders: readonly Sender[], max: number) => Promise<{
23
+ readonly health: SenderHealth | null;
24
+ readonly sender: Sender;
25
+ }[]>;
17
26
  /** The part after the `@`, lowercased. `null` for a LinkedIn seat. */
18
27
  export declare const domainOf: (address: string | null) => string | null;
19
28
  export declare const DNS_RECORDS: readonly ["spf", "dkim", "dmarc", "mx"];
@@ -2,6 +2,7 @@ import type { Adapter } from "../internal/adapter.ts";
2
2
  import { accountReaders } from "./adapter-account.ts";
3
3
  import { mailReaders } from "./adapter-mail.ts";
4
4
  import type { InstantlyClient } from "./client.ts";
5
- type Readers = Pick<Adapter, "getCampaign" | "getLead" | "getSender" | "getSequence" | "listCampaigns" | "listLeads" | "listSenders" | "listWorkspaces" | "stats">;
6
- export declare const readers: (client: InstantlyClient) => Readers & ReturnType<typeof accountReaders> & ReturnType<typeof mailReaders>;
5
+ import { senderReaders } from "./senders.ts";
6
+ type Readers = Pick<Adapter, "getCampaign" | "getLead" | "getSender" | "getSequence" | "listCampaigns" | "listLeads" | "listWorkspaces" | "stats">;
7
+ export declare const readers: (client: InstantlyClient) => Readers & ReturnType<typeof accountReaders> & ReturnType<typeof mailReaders> & ReturnType<typeof senderReaders>;
7
8
  export {};
@@ -75,6 +75,11 @@ export declare const costs: {
75
75
  "senders.health": {
76
76
  perPage: number;
77
77
  };
78
+ "senders.healthList": {
79
+ pageSize: number;
80
+ perPage: number;
81
+ perPageAtMost: number;
82
+ };
78
83
  "senders.byCampaign": {
79
84
  pageSize: number;
80
85
  perPage: number;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EVENT_TYPES,
3
3
  instantlyEvents
4
- } from "../chunks/chunk-MPE6VLLY.js";
4
+ } from "../chunks/chunk-UZ4YWUZ7.js";
5
5
  import {
6
6
  applyTracking,
7
7
  ownTracking,
@@ -24,7 +24,7 @@ import {
24
24
  listIn,
25
25
  toVariant,
26
26
  variantKey
27
- } from "../chunks/chunk-UOJG4VYF.js";
27
+ } from "../chunks/chunk-LD5OAELW.js";
28
28
  import {
29
29
  normalizeBody
30
30
  } from "../chunks/chunk-FALWG5U3.js";
@@ -42,17 +42,17 @@ import {
42
42
  refTo,
43
43
  refsTo
44
44
  } from "../chunks/chunk-U5AK6OJM.js";
45
- import "../chunks/chunk-POBAY3TI.js";
45
+ import "../chunks/chunk-HXCZMMSD.js";
46
46
  import {
47
47
  emptyCounts,
48
48
  metricRow,
49
49
  sumCounts
50
50
  } from "../chunks/chunk-CPACP4YD.js";
51
51
  import "../chunks/chunk-QGRZDTX4.js";
52
+ import "../chunks/chunk-OPLXELPS.js";
52
53
  import {
53
54
  assertWorkspaceId
54
55
  } from "../chunks/chunk-HXB2IOJJ.js";
55
- import "../chunks/chunk-YFJ3OQZS.js";
56
56
  import "../chunks/chunk-KVAG5GM2.js";
57
57
  import {
58
58
  readEnv,
@@ -501,6 +501,7 @@ var capabilities = {
501
501
  "senders.byCampaign": true,
502
502
  "senders.get": true,
503
503
  "senders.health": true,
504
+ "senders.healthList": true,
504
505
  "senders.list": true,
505
506
  "senders.warmup": true,
506
507
  sequence: true,
@@ -508,6 +509,8 @@ var capabilities = {
508
509
  "stats.byDay": "exact",
509
510
  // Per-mailbox numbers exist by day only; a total is summed by the adapter.
510
511
  "stats.bySender": "derived",
512
+ // GET /accounts/analytics/daily names up to 200 mailboxes in one read.
513
+ "stats.bySenders": "derived",
511
514
  "stats.byStep": "exact",
512
515
  // GET /campaigns/analytics with no id: a row per campaign, totals only.
513
516
  // Partial: it has no count of interested leads and no total of opens.
@@ -537,8 +540,9 @@ var fields = {
537
540
  tags: false
538
541
  },
539
542
  // No email carried is_auto_reply live: a fixed rule decides, and in a
540
- // timeline the step comes from the send a reply answers.
541
- message: { isAuto: "derived", isAutoSource: "derived" },
543
+ // timeline the step comes from the send a reply answers. The Unibox link is
544
+ // built from the thread and workspace, as Instantly's own unibox_url is.
545
+ message: { isAuto: "derived", isAutoSource: "derived", url: "derived" },
542
546
  metricRow: {
543
547
  connectionsAccepted: false,
544
548
  connectionsSent: false,
@@ -549,7 +553,12 @@ var fields = {
549
553
  },
550
554
  // A test has a creation time and a next run, and no start or end date.
551
555
  placementTest: { endsAt: false, startsAt: false },
552
- reply: { isAuto: "derived", isAutoSource: "derived", leftCompany: "derived" },
556
+ reply: {
557
+ isAuto: "derived",
558
+ isAutoSource: "derived",
559
+ leftCompany: "derived",
560
+ url: "derived"
561
+ },
553
562
  sender: { linkedinUrl: false },
554
563
  senderHealth: { blacklisted: false, checkedAt: false }
555
564
  };
@@ -596,6 +605,10 @@ var costs = {
596
605
  "senders.get": { perPage: 1 },
597
606
  // The account, its DNS test, then its warmup analytics.
598
607
  "senders.health": { perPage: 3 },
608
+ // Every mailbox's health: a page of accounts, one DNS test for the page's
609
+ // domains and one warmup report for its mailboxes. A campaign's page reads
610
+ // the campaign again first.
611
+ "senders.healthList": { pageSize: PAGE_SIZE, perPage: 3, perPageAtMost: 4 },
599
612
  // A campaign's senders: the campaign again with each page of every mailbox,
600
613
  // kept when the campaign names it (see the caveats). Pages follow the
601
614
  // workspace's mailboxes, not the senders kept.
@@ -629,6 +642,7 @@ var caveats = [
629
642
  "A campaign's settings, sequence and senders each read the whole campaign object. A sending window's days are assumed to be numbered 0 for Sunday to 6 for Saturday; the documentation only shows the keys 0 to 6.",
630
643
  "A campaign's senders are found by reading every mailbox and keeping those named in the campaign's email_list or carrying a tag in its email_tag_list, at two requests per page of mailboxes. A campaign that names tags only is filtered by Instantly.",
631
644
  "Sender health is three reads: the account, POST /accounts/test/vitals (a live DNS test, which Instantly may throttle) and POST /accounts/warmup-analytics. The warmup window is not documented. blacklisted and checkedAt are not reported. A DNS record Instantly could not resolve is null, not false.",
645
+ "Every mailbox's health (senderHealth) is read a page of 100 accounts at a time: the page, one POST /accounts/test/vitals naming one mailbox of each domain on it, and one POST /accounts/warmup-analytics naming every mailbox on it. The DNS test answers per domain, so each mailbox gets its domain's answer. Seen live on 2026-11-17: one test of 137 domains answered in about 2 seconds.",
632
646
  "connected is true for an Active account and false for a Connection Error; every other account status is null.",
633
647
  "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.",
634
648
  "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.",
@@ -640,7 +654,8 @@ var caveats = [
640
654
  "A webhook made for a custom lead label has no event_type, so its events are empty; custom_interest_value stays in raw. The headers Instantly sends with a delivery can carry a credential, so they are left out of a webhook record's raw. The native read webhook returns them and is not offered to the vendor_read tool; outbound.raw returns a response as it is.",
641
655
  "A truncated message body costs one more read of that email (GET /emails/{id}) when bodies are asked for. That read is assumed to share the 20-per-minute limit of the email list.",
642
656
  "Messages of a thread are found with the documented search value thread:<id>.",
643
- "Instantly's email list does not hold every email a campaign sent (seen live: a lead on its sixth step had one sent email and two replies). A timeline or a thread can therefore be shorter than the sequence; a lead's engagement.stepIndex says how far it got. A received email carries the step it replies to."
657
+ "Instantly's email list does not hold every email a campaign sent (seen live: a lead on its sixth step had one sent email and two replies). A timeline or a thread can therefore be shorter than the sequence; a lead's engagement.stepIndex says how far it got. A received email carries the step it replies to.",
658
+ `A message's or reply's url opens its thread in the Unibox: https://app.instantly.ai/app/unibox?thread_search=thread:<thread_id>&selected_wks=<organization_id>. Instantly documents unibox_url on reply webhooks ("URL to view the conversation in Unibox") but not how it is built; on 2026-11-17 the unibox_url of four live reply_received deliveries, all naming one email, was exactly this, from that email's thread_id and organization_id. The link needs a signed-in Instantly session, and was not opened in a browser. An email without a thread_id or organization_id has a null url.`
644
659
  ];
645
660
 
646
661
  // src/instantly/map-lead.ts
@@ -655,6 +670,12 @@ var INTEREST = /* @__PURE__ */ new Map([
655
670
  [3, ["Meeting Completed", "positive"]],
656
671
  [4, ["Won", "positive"]]
657
672
  ]);
673
+ var MEETING = /* @__PURE__ */ new Map([
674
+ [-4, "no_show"],
675
+ [2, "booked"],
676
+ [3, "completed"],
677
+ [4, "won"]
678
+ ]);
658
679
  var NO_LABELS = /* @__PURE__ */ new Map();
659
680
  var isCustomInterest = (value) => {
660
681
  const code = count(value);
@@ -755,6 +776,7 @@ var toLead = (identity, raw, labels = NO_LABELS) => ({
755
776
  lastName: text(raw.last_name),
756
777
  linkedinUrl: null,
757
778
  location: null,
779
+ meeting: MEETING.get(count(raw.lt_interest_status) ?? Number.NaN) ?? null,
758
780
  phone: text(raw.phone),
759
781
  recipientMailProvider: RECIPIENT_PROVIDER.get(count(raw.esp_code) ?? Number.NaN) ?? null,
760
782
  // Instantly tags mailboxes and campaigns, never leads.
@@ -766,6 +788,11 @@ var SCHEDULED = 4;
766
788
  var RECEIVED = 2;
767
789
  var SENT_BY_HAND = 3;
768
790
  var leadOf = (raw) => emailAddress(raw.lead) ?? (count(raw.ue_type) === RECEIVED ? emailAddress(raw.from_address_email) : null) ?? text(raw.lead_id);
791
+ var uniboxUrl = (raw) => {
792
+ const thread = text(raw.thread_id);
793
+ const workspace = text(raw.organization_id);
794
+ return thread === null || workspace === null ? null : `https://app.instantly.ai/app/unibox?thread_search=thread:${encodeURIComponent(thread)}&selected_wks=${encodeURIComponent(workspace)}`;
795
+ };
769
796
  var messageFields = (identity, raw, includeBody) => {
770
797
  const body = field(raw.body, "html") ?? field(raw.body, "text");
771
798
  return {
@@ -778,6 +805,7 @@ var messageFields = (identity, raw, includeBody) => {
778
805
  sentAt: timestamp(raw.timestamp_email) ?? timestamp(raw.timestamp_created),
779
806
  subject: text(raw.subject),
780
807
  threadId: text(raw.thread_id),
808
+ url: uniboxUrl(raw),
781
809
  ...stepPosition(raw.step)
782
810
  };
783
811
  };
@@ -1085,6 +1113,84 @@ var mailReaders = (client) => ({
1085
1113
  }
1086
1114
  });
1087
1115
 
1116
+ // src/instantly/senders.ts
1117
+ var campaignAccounts = async (client, ctx, query) => {
1118
+ const campaign = await client.getObject(
1119
+ ctx,
1120
+ `/campaigns/${encodeURIComponent(query.campaignId)}`
1121
+ );
1122
+ const addresses = new Set(
1123
+ list(campaign.email_list).flatMap((value) => emailAddress(value) ?? [])
1124
+ );
1125
+ const tagIds = new Set(
1126
+ list(campaign.email_tag_list).flatMap((value) => text(value) ?? [])
1127
+ );
1128
+ if (addresses.size === 0 && tagIds.size === 0) {
1129
+ return { items: [] };
1130
+ }
1131
+ const byTagOnly = addresses.size === 0;
1132
+ const page = await listPage(client, ctx, "/accounts", query, {
1133
+ include_tags: byTagOnly || tagIds.size === 0 ? void 0 : true,
1134
+ tag_ids: byTagOnly ? [...tagIds].join(",") : void 0
1135
+ });
1136
+ const attached = (account) => byTagOnly || addresses.has(emailAddress(account.email) ?? "") || objects(account.tags).some((tag) => tagIds.has(text(tag.id) ?? ""));
1137
+ return { items: page.items.filter(attached), next: page.next };
1138
+ };
1139
+ var accountsPage = async (client, ctx, query) => query.campaignId === void 0 ? await listPage(client, ctx, "/accounts", query, { include_tags: true }) : await campaignAccounts(client, ctx, {
1140
+ ...query,
1141
+ campaignId: query.campaignId
1142
+ });
1143
+ var domainOf = (address) => address.split("@").at(-1) ?? "";
1144
+ var vitalsOf = (vitals, domain) => {
1145
+ const mine = (key) => objects(field(vitals, key)).filter(
1146
+ (entry) => text(entry.domain)?.toLowerCase() === domain
1147
+ );
1148
+ return {
1149
+ failure_list: mine("failure_list"),
1150
+ success_list: mine("success_list")
1151
+ };
1152
+ };
1153
+ var healthOf = async (client, ctx, accounts) => {
1154
+ const addresses = accounts.flatMap(
1155
+ (account) => emailAddress(account.email) ?? []
1156
+ );
1157
+ if (addresses.length === 0) {
1158
+ return [];
1159
+ }
1160
+ const firstOfDomain = /* @__PURE__ */ new Map();
1161
+ for (const address of addresses) {
1162
+ if (!firstOfDomain.has(domainOf(address))) {
1163
+ firstOfDomain.set(domainOf(address), address);
1164
+ }
1165
+ }
1166
+ const vitals = await client.post(ctx, "/accounts/test/vitals", {
1167
+ accounts: [...firstOfDomain.values()]
1168
+ });
1169
+ const warmup = await client.post(ctx, "/accounts/warmup-analytics", {
1170
+ emails: addresses
1171
+ });
1172
+ return accounts.flatMap((account) => {
1173
+ const address = emailAddress(account.email);
1174
+ return address === null ? [] : [
1175
+ toSenderHealth(client.identity, address, {
1176
+ account,
1177
+ vitals: vitalsOf(vitals, domainOf(address)),
1178
+ warmup
1179
+ })
1180
+ ];
1181
+ });
1182
+ };
1183
+ var senderReaders = (client) => ({
1184
+ listSenderHealth: async (query, ctx) => {
1185
+ const page = await accountsPage(client, ctx, query);
1186
+ return { items: await healthOf(client, ctx, page.items), next: page.next };
1187
+ },
1188
+ listSenders: async (query, ctx) => mapPage(
1189
+ await accountsPage(client, ctx, query),
1190
+ (account) => toSender(client.identity, account, ctx.note)
1191
+ )
1192
+ });
1193
+
1088
1194
  // src/instantly/map-stats.ts
1089
1195
  var overviewRow = (scope, raw) => metricRow(scope, {
1090
1196
  ...emptyCounts(),
@@ -1215,6 +1321,36 @@ var senderStats = async (client, ctx, scope, query) => {
1215
1321
  await workspaceTracking(client, ctx, range(query))
1216
1322
  );
1217
1323
  };
1324
+ var EMAILS_AT_MOST = 200;
1325
+ var sendersStats = async (client, ctx, query, scopeIds) => {
1326
+ const chunks = Array.from(
1327
+ { length: Math.ceil(scopeIds.length / EMAILS_AT_MOST) },
1328
+ (_, index) => scopeIds.slice(index * EMAILS_AT_MOST, (index + 1) * EMAILS_AT_MOST)
1329
+ );
1330
+ const batches = await Promise.all(
1331
+ chunks.map(
1332
+ (emails) => client.getRows(ctx, "/accounts/analytics/daily", {
1333
+ query: { ...range(query), emails }
1334
+ })
1335
+ )
1336
+ );
1337
+ const days2 = batches.flat();
1338
+ const byEmail = new Map(scopeIds.map((id) => [id.toLowerCase(), id]));
1339
+ const rows = scopeIds.flatMap((scopeId) => {
1340
+ const own = days2.filter(
1341
+ (day) => byEmail.get(text(day.email_account)?.toLowerCase() ?? "") === scopeId
1342
+ );
1343
+ const scope = { ...client.identity, scope: "sender", scopeId };
1344
+ if (query.by === "day") {
1345
+ return own.map((day) => dailyRow(scope, day));
1346
+ }
1347
+ return own.length === 0 ? [] : [summedRow(scope, own)];
1348
+ });
1349
+ return applyTracking(
1350
+ rows,
1351
+ await workspaceTracking(client, ctx, range(query))
1352
+ );
1353
+ };
1218
1354
  var ownRows = async (client, ctx, campaignId, rows) => {
1219
1355
  const flags = await campaignFlags(client, ctx, campaignId);
1220
1356
  return applyTracking(
@@ -1230,6 +1366,9 @@ var readStats = async (client, ctx, query) => {
1230
1366
  scope: query.scope,
1231
1367
  scopeId: query.scopeId ?? identity.workspaceId
1232
1368
  };
1369
+ if (query.scope === "sender" && query.scopeIds !== void 0) {
1370
+ return await sendersStats(client, ctx, query, query.scopeIds);
1371
+ }
1233
1372
  if (query.scope === "sender") {
1234
1373
  return await senderStats(client, ctx, scope, query);
1235
1374
  }
@@ -1381,31 +1520,6 @@ var listCampaigns = async (client, ctx, query) => {
1381
1520
  next: page.next
1382
1521
  };
1383
1522
  };
1384
- var campaignSenders = async (client, ctx, query) => {
1385
- const campaign = await client.getObject(
1386
- ctx,
1387
- `/campaigns/${encodeURIComponent(query.campaignId)}`
1388
- );
1389
- const addresses = new Set(
1390
- list(campaign.email_list).flatMap((value) => emailAddress(value) ?? [])
1391
- );
1392
- const tagIds = new Set(
1393
- list(campaign.email_tag_list).flatMap((value) => text(value) ?? [])
1394
- );
1395
- if (addresses.size === 0 && tagIds.size === 0) {
1396
- return { items: [] };
1397
- }
1398
- const byTagOnly = addresses.size === 0;
1399
- const page = await listPage(client, ctx, "/accounts", query, {
1400
- include_tags: byTagOnly || tagIds.size === 0 ? void 0 : true,
1401
- tag_ids: byTagOnly ? [...tagIds].join(",") : void 0
1402
- });
1403
- const attached = (account) => byTagOnly || addresses.has(emailAddress(account.email) ?? "") || texts(objects(account.tags), "id").some((id) => tagIds.has(id));
1404
- return {
1405
- items: page.items.filter((account) => attached(account)).map((account) => toSender(client.identity, account, ctx.note)),
1406
- next: page.next
1407
- };
1408
- };
1409
1523
  var POSITIVE_FILTERS = [
1410
1524
  "FILTER_LEAD_INTERESTED",
1411
1525
  "FILTER_LEAD_MEETING_BOOKED",
@@ -1515,6 +1629,7 @@ var readers = (client) => {
1515
1629
  ...accountReaders(client),
1516
1630
  ...leadReaders(client),
1517
1631
  ...mailReaders(client),
1632
+ ...senderReaders(client),
1518
1633
  getCampaign: async (id, ctx) => {
1519
1634
  const campaign = await client.getObject(
1520
1635
  ctx,
@@ -1534,18 +1649,6 @@ var readers = (client) => {
1534
1649
  ctx.note
1535
1650
  ),
1536
1651
  listCampaigns: async (query, ctx) => await listCampaigns(client, ctx, query),
1537
- listSenders: async (query, ctx) => {
1538
- if (query.campaignId !== void 0) {
1539
- return await campaignSenders(client, ctx, {
1540
- ...query,
1541
- campaignId: query.campaignId
1542
- });
1543
- }
1544
- const page = await listPage(client, ctx, "/accounts", query, {
1545
- include_tags: true
1546
- });
1547
- return mapPage(page, (item) => toSender(identity, item, ctx.note));
1548
- },
1549
1652
  listWorkspaces: async (_query, ctx) => {
1550
1653
  const workspace = await client.get(ctx, "/workspaces/current");
1551
1654
  return {
@@ -0,0 +1,3 @@
1
+ import type { Adapter } from "../internal/adapter.ts";
2
+ import type { InstantlyClient } from "./client.ts";
3
+ export declare const senderReaders: (client: InstantlyClient) => Pick<Adapter, "listSenderHealth" | "listSenders">;
@@ -112,6 +112,11 @@ export interface StatsQuery {
112
112
  * campaign scope without one asks for a row per campaign.
113
113
  */
114
114
  readonly scopeId?: string | undefined;
115
+ /**
116
+ * Several senders, for the sender scope in place of `scopeId`, where the
117
+ * adapter declares `stats.bySenders`. Each row's `scopeRef` is its sender.
118
+ */
119
+ readonly scopeIds?: readonly string[] | undefined;
115
120
  /** Inclusive `YYYY-MM-DD`. */
116
121
  readonly from?: string | undefined;
117
122
  /** Inclusive `YYYY-MM-DD`. */
@@ -237,6 +242,8 @@ export interface Adapter<Native extends NativeCatalog = NoNative> {
237
242
  readonly getCampaignProgress?: (campaignId: string, ctx: AdapterContext) => Promise<CampaignProgress>;
238
243
  readonly listSubsequences?: (query: SubsequenceQuery, ctx: AdapterContext) => Promise<Page<Sequence>>;
239
244
  readonly getSenderHealth?: (senderId: string, ctx: AdapterContext) => Promise<SenderHealth>;
245
+ /** A page of senders' health, the senders listed as `listSenders` lists them. */
246
+ readonly listSenderHealth?: (query: SenderQuery, ctx: AdapterContext) => Promise<Page<SenderHealth>>;
240
247
  readonly listLists?: (query: PageQuery, ctx: AdapterContext) => Promise<Page<LeadList>>;
241
248
  readonly getList?: (id: string, ctx: AdapterContext) => Promise<LeadList>;
242
249
  readonly listBlocklist?: (query: PageQuery, ctx: AdapterContext) => Promise<Page<BlockEntry>>;