outbound-sdk 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +121 -2
- package/dist/alerts/index.d.ts +2 -0
- package/dist/alerts/index.js +136 -0
- package/dist/alerts/plugin.d.ts +58 -0
- package/dist/audit/index.d.ts +33 -0
- package/dist/audit/index.js +60 -0
- package/dist/benchmarks/index.d.ts +29 -0
- package/dist/benchmarks/index.js +70 -0
- package/dist/budget/index.d.ts +21 -0
- package/dist/budget/index.js +50 -0
- package/dist/cache/index.d.ts +31 -0
- package/dist/cache/index.js +11 -0
- package/dist/cards/content.d.ts +43 -0
- package/dist/cards/copy-cards.d.ts +2 -0
- package/dist/cards/format.d.ts +39 -0
- package/dist/cards/index.d.ts +9 -0
- package/dist/cards/index.js +2070 -0
- package/dist/cards/notify-cards.d.ts +14 -0
- package/dist/cards/ops-cards.d.ts +2 -0
- package/dist/cards/parts.d.ts +22 -0
- package/dist/cards/people-cards.d.ts +2 -0
- package/dist/cards/render.d.ts +28 -0
- package/dist/cards/sender-cards.d.ts +2 -0
- package/dist/cards/slack-rich.d.ts +19 -0
- package/dist/cards/slack-text.d.ts +10 -0
- package/dist/cards/slack.d.ts +21 -0
- package/dist/cards/spec.d.ts +86 -0
- package/dist/cards/tool-cards.d.ts +4 -0
- package/dist/chunks/chunk-4O2HRTTI.js +75 -0
- package/dist/chunks/chunk-7BCYLIDG.js +483 -0
- package/dist/chunks/chunk-B7V6EOAC.js +2273 -0
- package/dist/chunks/chunk-CMQ5ZHLZ.js +25 -0
- package/dist/chunks/chunk-F7MKFVIG.js +43 -0
- package/dist/chunks/chunk-FZF6CLPX.js +232 -0
- package/dist/chunks/chunk-GPEJG34O.js +53 -0
- package/dist/chunks/chunk-HEC7XFFH.js +65 -0
- package/dist/chunks/chunk-IBC52BX3.js +24 -0
- package/dist/chunks/chunk-LNCOGBMI.js +144 -0
- package/dist/chunks/chunk-LOXBLQ3I.js +180 -0
- package/dist/chunks/chunk-NAWZ73QS.js +22 -0
- package/dist/chunks/chunk-OCV66TS2.js +705 -0
- package/dist/chunks/chunk-Q465X22Y.js +548 -0
- package/dist/chunks/chunk-QTB747K4.js +100 -0
- package/dist/chunks/chunk-QZNNCXXD.js +92 -0
- package/dist/chunks/chunk-R6AM4GJR.js +105 -0
- package/dist/chunks/chunk-TIJKJJDW.js +6 -0
- package/dist/chunks/chunk-VURTOVGI.js +61 -0
- package/dist/chunks/chunk-WAM6N4OF.js +269 -0
- package/dist/chunks/chunk-WW746NJF.js +94 -0
- package/dist/chunks/chunk-XC6CZP73.js +80 -0
- package/dist/chunks/chunk-ZGHQYZEH.js +45 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +34 -0
- package/dist/cli/commands.d.ts +16 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.js +25 -0
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +107 -0
- package/dist/clients/plugin.d.ts +42 -0
- package/dist/combine/account.d.ts +4 -0
- package/dist/combine/adapter.d.ts +9 -0
- package/dist/combine/index.d.ts +2 -0
- package/dist/combine/index.js +345 -0
- package/dist/combine/route.d.ts +17 -0
- package/dist/exporter/index.d.ts +29 -0
- package/dist/exporter/index.js +77 -0
- package/dist/failover/index.d.ts +11 -0
- package/dist/failover/index.js +45 -0
- package/dist/fixtures/index.d.ts +27 -0
- package/dist/fixtures/index.js +241 -0
- package/dist/fixtures/scrub.d.ts +5 -0
- package/dist/heyreach/account.d.ts +11 -0
- package/dist/heyreach/adapter.d.ts +5 -0
- package/dist/heyreach/capabilities.d.ts +68 -0
- package/dist/heyreach/client.d.ts +20 -0
- package/dist/heyreach/inbox.d.ts +7 -0
- package/dist/heyreach/index.d.ts +18 -0
- package/dist/heyreach/index.js +1708 -0
- package/dist/heyreach/lookup.d.ts +15 -0
- package/dist/heyreach/map-account.d.ts +25 -0
- package/dist/heyreach/map-sequence.d.ts +5 -0
- package/dist/heyreach/map-stats.d.ts +10 -0
- package/dist/heyreach/map.d.ts +35 -0
- package/dist/heyreach/native-organization.d.ts +128 -0
- package/dist/heyreach/native-voice.d.ts +106 -0
- package/dist/heyreach/native.d.ts +496 -0
- package/dist/heyreach/paging.d.ts +7 -0
- package/dist/heyreach/webhooks.d.ts +2 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +148 -0
- package/dist/identity/keys.d.ts +9 -0
- package/dist/identity/plugin.d.ts +34 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +119 -0
- package/dist/insights/copy/copy-audit.d.ts +55 -0
- package/dist/insights/copy/copy-checks.d.ts +44 -0
- package/dist/insights/copy/copy-reuse.d.ts +59 -0
- package/dist/insights/copy/index.d.ts +67 -0
- package/dist/insights/copy/reply-timing.d.ts +63 -0
- package/dist/insights/copy/shared.d.ts +53 -0
- package/dist/insights/copy/step-funnel.d.ts +66 -0
- package/dist/insights/copy/variant-test.d.ts +64 -0
- package/dist/insights/define.d.ts +98 -0
- package/dist/insights/index.d.ts +10 -0
- package/dist/insights/index.js +4873 -0
- package/dist/insights/ops/anomalies.d.ts +80 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +39 -0
- package/dist/insights/ops/campaign-ranking.d.ts +56 -0
- package/dist/insights/ops/channel-mix.d.ts +44 -0
- package/dist/insights/ops/client-report.d.ts +76 -0
- package/dist/insights/ops/diagnosis-checks.d.ts +48 -0
- package/dist/insights/ops/index.d.ts +135 -0
- package/dist/insights/ops/period-comparison.d.ts +86 -0
- package/dist/insights/ops/pipeline-forecast.d.ts +44 -0
- package/dist/insights/ops/shared.d.ts +149 -0
- package/dist/insights/ops/tag-rollup.d.ts +32 -0
- package/dist/insights/people/account-summary.d.ts +68 -0
- package/dist/insights/people/dropped-replies.d.ts +51 -0
- package/dist/insights/people/find.d.ts +18 -0
- package/dist/insights/people/hot-leads.d.ts +67 -0
- package/dist/insights/people/index.d.ts +88 -0
- package/dist/insights/people/lead-collisions.d.ts +43 -0
- package/dist/insights/people/person-summary.d.ts +46 -0
- package/dist/insights/people/personalization-gaps.d.ts +60 -0
- package/dist/insights/people/read.d.ts +40 -0
- package/dist/insights/people/suppression-check.d.ts +53 -0
- package/dist/insights/plugin.d.ts +40 -0
- package/dist/insights/registry.d.ts +335 -0
- package/dist/insights/senders/bounce-watch.d.ts +70 -0
- package/dist/insights/senders/domain-health.d.ts +69 -0
- package/dist/insights/senders/index.d.ts +74 -0
- package/dist/insights/senders/read.d.ts +37 -0
- package/dist/insights/senders/sender-capacity.d.ts +67 -0
- package/dist/insights/senders/sender-load.d.ts +52 -0
- package/dist/insights/senders/settings-audit.d.ts +48 -0
- package/dist/insights/senders/warmup-readiness.d.ts +39 -0
- package/dist/insights/stats.d.ts +45 -0
- package/dist/insights/tools.d.ts +16 -0
- package/dist/insights/types.d.ts +4 -0
- package/dist/instantly/adapter-account.d.ts +5 -0
- package/dist/instantly/adapter-mail.d.ts +3 -0
- package/dist/instantly/adapter.d.ts +7 -0
- package/dist/instantly/capabilities.d.ts +83 -0
- package/dist/instantly/client.d.ts +29 -0
- package/dist/instantly/index.d.ts +20 -0
- package/dist/instantly/index.js +2372 -0
- package/dist/instantly/map-account.d.ts +23 -0
- package/dist/instantly/map-lead.d.ts +18 -0
- package/dist/instantly/map-stats.d.ts +22 -0
- package/dist/instantly/map.d.ts +24 -0
- package/dist/instantly/native-agents-sales.d.ts +161 -0
- package/dist/instantly/native-agents.d.ts +156 -0
- package/dist/instantly/native-campaigns.d.ts +101 -0
- package/dist/instantly/native-leads.d.ts +93 -0
- package/dist/instantly/native-params.d.ts +24 -0
- package/dist/instantly/native-search.d.ts +82 -0
- package/dist/instantly/native-senders.d.ts +182 -0
- package/dist/instantly/native-supersearch.d.ts +149 -0
- package/dist/instantly/native-workspace.d.ts +170 -0
- package/dist/instantly/native.d.ts +1081 -0
- package/dist/instantly/pages.d.ts +29 -0
- package/dist/instantly/stats.d.ts +5 -0
- package/dist/instantly/webhooks.d.ts +2 -0
- package/dist/internal/adapter.d.ts +189 -0
- package/dist/internal/capabilities.d.ts +86 -0
- package/dist/internal/cursor.d.ts +10 -0
- package/dist/internal/engine/budget.d.ts +44 -0
- package/dist/internal/engine/engine.d.ts +45 -0
- package/dist/internal/engine/rate-store.d.ts +25 -0
- package/dist/internal/engine/request.d.ts +27 -0
- package/dist/internal/engine/retry.d.ts +21 -0
- package/dist/internal/engine/runtime.d.ts +13 -0
- package/dist/internal/entities-account.d.ts +135 -0
- package/dist/internal/entities.d.ts +389 -0
- package/dist/internal/env.d.ts +4 -0
- package/dist/internal/errors.d.ts +57 -0
- package/dist/internal/hooks.d.ts +55 -0
- package/dist/internal/json.d.ts +40 -0
- package/dist/internal/limits.d.ts +34 -0
- package/dist/internal/metrics.d.ts +52 -0
- package/dist/internal/native.d.ts +66 -0
- package/dist/internal/outbound/api.d.ts +267 -0
- package/dist/internal/outbound/collections.d.ts +31 -0
- package/dist/internal/outbound/core.d.ts +36 -0
- package/dist/internal/outbound/create.d.ts +16 -0
- package/dist/internal/outbound/handles.d.ts +7 -0
- package/dist/internal/outbound/native.d.ts +4 -0
- package/dist/internal/outbound/operation-shared.d.ts +28 -0
- package/dist/internal/outbound/operations-account.d.ts +29 -0
- package/dist/internal/outbound/operations.d.ts +42 -0
- package/dist/internal/outbound/outbound.d.ts +64 -0
- package/dist/internal/outbound/plugins.d.ts +40 -0
- package/dist/internal/outbound/raw.d.ts +9 -0
- package/dist/internal/outbound/specs-account.d.ts +16 -0
- package/dist/internal/outbound/specs.d.ts +14 -0
- package/dist/internal/outbound/stats.d.ts +7 -0
- package/dist/internal/outbound/validate.d.ts +5 -0
- package/dist/internal/outbound/walker.d.ts +22 -0
- package/dist/internal/record.d.ts +19 -0
- package/dist/internal/redact.d.ts +18 -0
- package/dist/internal/ref.d.ts +16 -0
- package/dist/internal/sha256.d.ts +4 -0
- package/dist/internal/text.d.ts +11 -0
- package/dist/internal/url.d.ts +9 -0
- package/dist/loader/index.d.ts +12 -0
- package/dist/loader/index.js +12 -0
- package/dist/memory/account-reads.d.ts +5 -0
- package/dist/memory/account.d.ts +67 -0
- package/dist/memory/adapter.d.ts +16 -0
- package/dist/memory/data.d.ts +122 -0
- package/dist/memory/demo.d.ts +7 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +792 -0
- package/dist/memory/stats.d.ts +6 -0
- package/dist/memory/store.d.ts +18 -0
- package/dist/providers/index.d.ts +22 -0
- package/dist/providers/index.js +10 -0
- package/dist/reconcile/index.d.ts +2 -0
- package/dist/reconcile/index.js +72 -0
- package/dist/reconcile/plugin.d.ts +55 -0
- package/dist/redact/index.d.ts +2 -0
- package/dist/redact/index.js +192 -0
- package/dist/redact/plugin.d.ts +22 -0
- package/dist/redis/index.d.ts +41 -0
- package/dist/redis/index.js +114 -0
- package/dist/smartlead/account.d.ts +5 -0
- package/dist/smartlead/adapter.d.ts +5 -0
- package/dist/smartlead/capabilities.d.ts +85 -0
- package/dist/smartlead/client.d.ts +23 -0
- package/dist/smartlead/hmac.d.ts +9 -0
- package/dist/smartlead/index.d.ts +17 -0
- package/dist/smartlead/index.js +2170 -0
- package/dist/smartlead/leads.d.ts +6 -0
- package/dist/smartlead/lookup.d.ts +8 -0
- package/dist/smartlead/mail.d.ts +5 -0
- package/dist/smartlead/map-account.d.ts +22 -0
- package/dist/smartlead/map-messages.d.ts +31 -0
- package/dist/smartlead/map-stats.d.ts +37 -0
- package/dist/smartlead/map.d.ts +52 -0
- package/dist/smartlead/native-analytics.d.ts +242 -0
- package/dist/smartlead/native-campaigns.d.ts +211 -0
- package/dist/smartlead/native-inbox.d.ts +141 -0
- package/dist/smartlead/native-params.d.ts +33 -0
- package/dist/smartlead/native-services.d.ts +204 -0
- package/dist/smartlead/native.d.ts +785 -0
- package/dist/smartlead/shared.d.ts +28 -0
- package/dist/smartlead/stats.d.ts +5 -0
- package/dist/smartlead/webhooks.d.ts +2 -0
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +158 -0
- package/dist/sync/plugin.d.ts +58 -0
- package/dist/tools/account-tools.d.ts +21 -0
- package/dist/tools/ai-sdk.d.ts +8 -0
- package/dist/tools/ai-sdk.js +26 -0
- package/dist/tools/campaign-tools.d.ts +59 -0
- package/dist/tools/claude-agent.d.ts +18 -0
- package/dist/tools/claude-agent.js +40 -0
- package/dist/tools/index.d.ts +28 -0
- package/dist/tools/index.js +20 -0
- package/dist/tools/people-tools.d.ts +19 -0
- package/dist/tools/registry.d.ts +34 -0
- package/dist/tools/shared.d.ts +75 -0
- package/dist/tracing/index.d.ts +25 -0
- package/dist/tracing/index.js +69 -0
- package/dist/webhooks/index.d.ts +3 -0
- package/dist/webhooks/index.js +226 -0
- package/dist/webhooks/parse.d.ts +41 -0
- package/dist/webhooks/secret.d.ts +4 -0
- package/package.json +181 -4
|
@@ -0,0 +1,2372 @@
|
|
|
1
|
+
import {
|
|
2
|
+
campaignStatusCode,
|
|
3
|
+
instantlyEvents,
|
|
4
|
+
listEnvelope,
|
|
5
|
+
toCampaign,
|
|
6
|
+
toSender,
|
|
7
|
+
toSequence,
|
|
8
|
+
toSubsequence,
|
|
9
|
+
toWorkspace,
|
|
10
|
+
variantKey
|
|
11
|
+
} from "../chunks/chunk-FZF6CLPX.js";
|
|
12
|
+
import {
|
|
13
|
+
normalizeBody
|
|
14
|
+
} from "../chunks/chunk-GPEJG34O.js";
|
|
15
|
+
import {
|
|
16
|
+
defineNative
|
|
17
|
+
} from "../chunks/chunk-TIJKJJDW.js";
|
|
18
|
+
import {
|
|
19
|
+
emptyCounts,
|
|
20
|
+
sumCounts
|
|
21
|
+
} from "../chunks/chunk-WW746NJF.js";
|
|
22
|
+
import {
|
|
23
|
+
buildUrl
|
|
24
|
+
} from "../chunks/chunk-NAWZ73QS.js";
|
|
25
|
+
import "../chunks/chunk-LNCOGBMI.js";
|
|
26
|
+
import {
|
|
27
|
+
readEnv,
|
|
28
|
+
requireCredential
|
|
29
|
+
} from "../chunks/chunk-CMQ5ZHLZ.js";
|
|
30
|
+
import {
|
|
31
|
+
recordBase,
|
|
32
|
+
refTo,
|
|
33
|
+
refsTo
|
|
34
|
+
} from "../chunks/chunk-IBC52BX3.js";
|
|
35
|
+
import {
|
|
36
|
+
SCHEMA_VERSION
|
|
37
|
+
} from "../chunks/chunk-WAM6N4OF.js";
|
|
38
|
+
import {
|
|
39
|
+
assertWorkspaceId,
|
|
40
|
+
makeRef
|
|
41
|
+
} from "../chunks/chunk-ZGHQYZEH.js";
|
|
42
|
+
import {
|
|
43
|
+
OutboundError,
|
|
44
|
+
makeErrorMapper
|
|
45
|
+
} from "../chunks/chunk-LOXBLQ3I.js";
|
|
46
|
+
import {
|
|
47
|
+
count,
|
|
48
|
+
emailAddress,
|
|
49
|
+
field,
|
|
50
|
+
flag,
|
|
51
|
+
isJsonObject,
|
|
52
|
+
isString,
|
|
53
|
+
list,
|
|
54
|
+
objects,
|
|
55
|
+
stringMap,
|
|
56
|
+
text,
|
|
57
|
+
timestamp
|
|
58
|
+
} from "../chunks/chunk-QZNNCXXD.js";
|
|
59
|
+
|
|
60
|
+
// src/instantly/map-account.ts
|
|
61
|
+
var CLOCK = /^\d{2}:\d{2}$/u;
|
|
62
|
+
var DATE = /^\d{4}-\d{2}-\d{2}$/u;
|
|
63
|
+
var matching = (value, pattern2) => {
|
|
64
|
+
const read = text(value);
|
|
65
|
+
return read !== null && pattern2.test(read) ? read : null;
|
|
66
|
+
};
|
|
67
|
+
var openDays = (value) => Object.entries(isJsonObject(value) ? value : {}).flatMap(
|
|
68
|
+
([day, open]) => open === true && /^[0-6]$/u.test(day) ? [Number(day)] : []
|
|
69
|
+
).toSorted((left, right) => left - right);
|
|
70
|
+
var toWindow = (raw) => ({
|
|
71
|
+
days: openDays(raw.days),
|
|
72
|
+
from: matching(field(raw.timing, "from"), CLOCK),
|
|
73
|
+
name: text(raw.name),
|
|
74
|
+
timezone: text(raw.timezone),
|
|
75
|
+
to: matching(field(raw.timing, "to"), CLOCK)
|
|
76
|
+
});
|
|
77
|
+
var toCampaignSettings = (identity, raw) => {
|
|
78
|
+
const id = text(raw.id) ?? "";
|
|
79
|
+
const schedule = raw.campaign_schedule;
|
|
80
|
+
return {
|
|
81
|
+
...recordBase(identity, id, raw),
|
|
82
|
+
campaignRef: refTo(identity, id) ?? "",
|
|
83
|
+
dailyLimit: count(raw.daily_limit),
|
|
84
|
+
dailyNewLeads: count(raw.daily_max_leads),
|
|
85
|
+
endDate: matching(field(schedule, "end_date"), DATE),
|
|
86
|
+
gapMinutes: count(raw.email_gap),
|
|
87
|
+
plainText: flag(raw.text_only),
|
|
88
|
+
schedule: objects(field(schedule, "schedules")).map(toWindow),
|
|
89
|
+
startDate: matching(field(schedule, "start_date"), DATE),
|
|
90
|
+
stopOnAutoReply: flag(raw.stop_on_auto_reply),
|
|
91
|
+
stopOnReply: flag(raw.stop_on_reply),
|
|
92
|
+
tracking: {
|
|
93
|
+
clicks: flag(raw.link_tracking),
|
|
94
|
+
opens: flag(raw.open_tracking)
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
var ACCOUNT_ISSUE = /* @__PURE__ */ new Map([
|
|
99
|
+
[-3, "Sending Error"],
|
|
100
|
+
[-2, "Soft Bounce Error"],
|
|
101
|
+
[-1, "Connection Error"]
|
|
102
|
+
]);
|
|
103
|
+
var WARMUP_ISSUE = /* @__PURE__ */ new Map([
|
|
104
|
+
[-3, "Warmup: Permanent Suspension"],
|
|
105
|
+
[-2, "Warmup: Spam Folder Unknown"],
|
|
106
|
+
[-1, "Warmup: Banned"]
|
|
107
|
+
]);
|
|
108
|
+
var issues = (account) => {
|
|
109
|
+
const found = [
|
|
110
|
+
ACCOUNT_ISSUE.get(count(account.status) ?? Number.NaN),
|
|
111
|
+
WARMUP_ISSUE.get(count(account.warmup_status) ?? Number.NaN),
|
|
112
|
+
text(field(account.status_message, "response")),
|
|
113
|
+
text(field(account.status_message, "e_message"))
|
|
114
|
+
].flatMap((issue) => issue ?? []);
|
|
115
|
+
return [...new Set(found)];
|
|
116
|
+
};
|
|
117
|
+
var connected = (account) => {
|
|
118
|
+
const status = count(account.status);
|
|
119
|
+
if (status === 1) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
return status === -1 ? false : null;
|
|
123
|
+
};
|
|
124
|
+
var vitalsFor = (vitals, domain) => {
|
|
125
|
+
const entries = [
|
|
126
|
+
...objects(field(vitals, "success_list")),
|
|
127
|
+
...objects(field(vitals, "failure_list"))
|
|
128
|
+
];
|
|
129
|
+
return entries.find((entry) => text(entry.domain)?.toLowerCase() === domain) ?? (entries.length === 1 ? entries[0] : void 0);
|
|
130
|
+
};
|
|
131
|
+
var dnsRecord = (entry, key) => list(entry?.indeterminate).includes(key) ? null : flag(entry?.[key]);
|
|
132
|
+
var warmupFor = (warmup, address) => {
|
|
133
|
+
const totals = field(warmup, "aggregate_data");
|
|
134
|
+
const [, entry] = Object.entries(isJsonObject(totals) ? totals : {}).find(
|
|
135
|
+
([key]) => key.trim().toLowerCase() === address
|
|
136
|
+
) ?? [];
|
|
137
|
+
return isJsonObject(entry) ? {
|
|
138
|
+
inbox: count(entry.landed_inbox),
|
|
139
|
+
received: count(entry.received),
|
|
140
|
+
score: count(entry.health_score),
|
|
141
|
+
sent: count(entry.sent),
|
|
142
|
+
spam: count(entry.landed_spam)
|
|
143
|
+
} : null;
|
|
144
|
+
};
|
|
145
|
+
var toSenderHealth = (identity, id, parts) => {
|
|
146
|
+
const address = emailAddress(parts.account.email);
|
|
147
|
+
const sourceId = address ?? id;
|
|
148
|
+
const domain = address?.split("@").at(-1) ?? null;
|
|
149
|
+
const vitals = vitalsFor(parts.vitals, domain);
|
|
150
|
+
return {
|
|
151
|
+
...recordBase(identity, sourceId, {
|
|
152
|
+
account: parts.account,
|
|
153
|
+
vitals: parts.vitals,
|
|
154
|
+
warmup: parts.warmup
|
|
155
|
+
}),
|
|
156
|
+
// Instantly reports block lists per inbox placement test, not per mailbox.
|
|
157
|
+
blacklisted: null,
|
|
158
|
+
checkedAt: null,
|
|
159
|
+
connected: connected(parts.account),
|
|
160
|
+
dns: {
|
|
161
|
+
dkim: dnsRecord(vitals, "dkim"),
|
|
162
|
+
dmarc: dnsRecord(vitals, "dmarc"),
|
|
163
|
+
mx: dnsRecord(vitals, "mx"),
|
|
164
|
+
spf: dnsRecord(vitals, "spf")
|
|
165
|
+
},
|
|
166
|
+
domain,
|
|
167
|
+
issues: issues(parts.account),
|
|
168
|
+
senderRef: refTo(identity, sourceId) ?? "",
|
|
169
|
+
warmup: warmupFor(parts.warmup, address)
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
var toLeadList = (identity, raw) => {
|
|
173
|
+
const id = text(raw.id) ?? "";
|
|
174
|
+
return {
|
|
175
|
+
...recordBase(identity, id, raw),
|
|
176
|
+
createdAt: timestamp(raw.timestamp_created),
|
|
177
|
+
kind: "leads",
|
|
178
|
+
name: text(raw.name) ?? id,
|
|
179
|
+
size: null
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
var blockKind = (raw) => {
|
|
183
|
+
const isDomain = flag(raw.is_domain);
|
|
184
|
+
if (isDomain === null) {
|
|
185
|
+
return "other";
|
|
186
|
+
}
|
|
187
|
+
return isDomain ? "domain" : "email";
|
|
188
|
+
};
|
|
189
|
+
var toBlockEntry = (identity, raw) => ({
|
|
190
|
+
...recordBase(identity, text(raw.id) ?? "", raw),
|
|
191
|
+
createdAt: timestamp(raw.timestamp_created),
|
|
192
|
+
kind: blockKind(raw),
|
|
193
|
+
value: (text(raw.bl_value) ?? "").toLowerCase()
|
|
194
|
+
});
|
|
195
|
+
var toTag = (identity, raw) => {
|
|
196
|
+
const id = text(raw.id) ?? "";
|
|
197
|
+
return {
|
|
198
|
+
...recordBase(identity, id, raw),
|
|
199
|
+
description: text(raw.description),
|
|
200
|
+
name: text(raw.label) ?? id
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
var webhookActive = (raw) => {
|
|
204
|
+
const status = count(raw.status);
|
|
205
|
+
if (status === 1) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return status === -1 ? false : null;
|
|
209
|
+
};
|
|
210
|
+
var withoutHeaders = (raw) => Object.fromEntries(
|
|
211
|
+
Object.entries(raw).filter(([key]) => key.toLowerCase() !== "headers")
|
|
212
|
+
);
|
|
213
|
+
var toWebhook = (identity, raw) => ({
|
|
214
|
+
...recordBase(identity, text(raw.id) ?? "", withoutHeaders(raw)),
|
|
215
|
+
active: webhookActive(raw),
|
|
216
|
+
campaignRefs: refsTo(identity, [text(raw.campaign)]),
|
|
217
|
+
createdAt: timestamp(raw.timestamp_created),
|
|
218
|
+
// A webhook for a custom lead label has no event type.
|
|
219
|
+
events: [text(raw.event_type)].flatMap((event) => event ?? []),
|
|
220
|
+
name: text(raw.name),
|
|
221
|
+
url: text(raw.target_hook_url) ?? ""
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// src/instantly/capabilities.ts
|
|
225
|
+
var BASE_URL = "https://api.instantly.ai/api/v2";
|
|
226
|
+
var API_KEY_ENV = "INSTANTLY_API_KEY";
|
|
227
|
+
var WORKSPACE_ENV = "INSTANTLY_WORKSPACE_ID";
|
|
228
|
+
var EMAILS_LANE = "emails";
|
|
229
|
+
var PAGE_SIZE = 100;
|
|
230
|
+
var LABEL_PREDICTION_LANE = "labelPrediction";
|
|
231
|
+
var LOCAL_FILTERS_LANE = "localBusinessFilters";
|
|
232
|
+
var LOCAL_SEARCH_LANE = "localBusinessSearch";
|
|
233
|
+
var DAY_MS = 864e5;
|
|
234
|
+
var TAG_PAGES = 10;
|
|
235
|
+
var capabilities = {
|
|
236
|
+
blocklist: true,
|
|
237
|
+
"campaigns.settings": true,
|
|
238
|
+
// Draft and completed are filtered by Instantly. Active and paused each
|
|
239
|
+
// cover several Instantly statuses, so the adapter matches those itself.
|
|
240
|
+
"campaigns.status": "server",
|
|
241
|
+
"events.parse": true,
|
|
242
|
+
// Instantly does not sign webhooks. Use a secret header or URL path.
|
|
243
|
+
"events.verify": "secret",
|
|
244
|
+
"leads.byCampaign": true,
|
|
245
|
+
"leads.engagement": true,
|
|
246
|
+
"leads.get": true,
|
|
247
|
+
"leads.list": true,
|
|
248
|
+
// By email only, with the `contacts` filter of POST /leads/list. A lead has
|
|
249
|
+
// no LinkedIn profile, so a lookup by profile finds nothing.
|
|
250
|
+
"leads.lookup": true,
|
|
251
|
+
// POST /leads/list has no date filter, so the wrapper filters after fetching.
|
|
252
|
+
"leads.since": "client",
|
|
253
|
+
"leads.timeline": true,
|
|
254
|
+
"lists.leads": true,
|
|
255
|
+
"lists.list": true,
|
|
256
|
+
// A list response can cut a large body short (`body_fallback_reason`); the
|
|
257
|
+
// adapter then reads that email on its own, where the body is whole.
|
|
258
|
+
"messages.body": "full",
|
|
259
|
+
"messages.byThread": true,
|
|
260
|
+
"messages.list": true,
|
|
261
|
+
"messages.since": "server",
|
|
262
|
+
// Every read endpoint with no normalized form is in the native catalog.
|
|
263
|
+
native: true,
|
|
264
|
+
"replies.category": "vendor",
|
|
265
|
+
"replies.list": true,
|
|
266
|
+
"replies.since": "server",
|
|
267
|
+
"senders.byCampaign": true,
|
|
268
|
+
"senders.get": true,
|
|
269
|
+
"senders.health": true,
|
|
270
|
+
"senders.list": true,
|
|
271
|
+
"senders.warmup": true,
|
|
272
|
+
sequence: true,
|
|
273
|
+
"sequence.subsequences": true,
|
|
274
|
+
"stats.byDay": "exact",
|
|
275
|
+
// Per-mailbox numbers exist by day only; a total is summed by the adapter.
|
|
276
|
+
"stats.bySender": "derived",
|
|
277
|
+
"stats.byStep": "exact",
|
|
278
|
+
"stats.campaign": "exact",
|
|
279
|
+
"stats.workspace": "exact",
|
|
280
|
+
tags: true,
|
|
281
|
+
"webhooks.list": true,
|
|
282
|
+
workspaces: true
|
|
283
|
+
};
|
|
284
|
+
var limits = {
|
|
285
|
+
lanes: {
|
|
286
|
+
[EMAILS_LANE]: [{ perMs: 6e4, requests: 20 }],
|
|
287
|
+
[LABEL_PREDICTION_LANE]: [{ perMs: 30 * DAY_MS, requests: 500 }],
|
|
288
|
+
[LOCAL_FILTERS_LANE]: [{ perMs: DAY_MS, requests: 100 }],
|
|
289
|
+
[LOCAL_SEARCH_LANE]: [{ perMs: DAY_MS, requests: 200 }]
|
|
290
|
+
},
|
|
291
|
+
source: "https://developer.instantly.ai/getting-started/rate-limit.md (100/s and 6,000/min per workspace, shared across keys and API versions), the list-email reference (20/min) and the references of POST /lead-labels/ai-reply-label (500 per 30 days), /local-business-search/ai-filters (100 a day) and /local-business-search/search (200 pages a day); read 2026-11-14, not confirmed live",
|
|
292
|
+
windows: [
|
|
293
|
+
{ perMs: 1e3, requests: 100 },
|
|
294
|
+
{ perMs: 6e4, requests: 6e3 }
|
|
295
|
+
]
|
|
296
|
+
};
|
|
297
|
+
var costs = {
|
|
298
|
+
"blocklist.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
299
|
+
// The campaign, its tag assignments, then the tags' names.
|
|
300
|
+
"campaigns.get": { perPage: 3 },
|
|
301
|
+
// The campaigns, their tag assignments, then the tags' names.
|
|
302
|
+
"campaigns.list": { pageSize: PAGE_SIZE, perPage: 3 },
|
|
303
|
+
"campaigns.settings": { perPage: 1 },
|
|
304
|
+
"leads.get": { perPage: 1 },
|
|
305
|
+
"leads.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
306
|
+
"lists.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
307
|
+
"messages.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
308
|
+
"replies.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
309
|
+
"senders.get": { perPage: 1 },
|
|
310
|
+
// The account, its DNS test, then its warmup analytics.
|
|
311
|
+
"senders.health": { perPage: 3 },
|
|
312
|
+
"senders.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
313
|
+
"sequence.get": { perPage: 1 },
|
|
314
|
+
"sequence.subsequences": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
315
|
+
stats: { perPage: 1 },
|
|
316
|
+
"tags.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
317
|
+
"webhooks.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
318
|
+
"workspaces.list": { perPage: 1 }
|
|
319
|
+
};
|
|
320
|
+
var caveats = [
|
|
321
|
+
"The reads were run once, read-only, against one live workspace on 2026-11-14. Fixtures are still built from the API V2 documentation, and subsequences, a campaign's own webhooks and a second page of most lists were not exercised because that workspace had none or too few.",
|
|
322
|
+
"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.",
|
|
323
|
+
"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). A received email carries the lead's address but no lead id, so a reply's leadRef is null; a sent message has one. Instantly does not mark an email as automatic, so isAuto is null.",
|
|
324
|
+
"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.",
|
|
325
|
+
"Whether reply_count includes automatic replies is not documented; replied uses the unique reply count and repliedAuto the unique automatic count.",
|
|
326
|
+
"Open counts are returned even when a campaign has open tracking turned off, because the analytics response does not say whether tracking was on.",
|
|
327
|
+
"Daily analytics rows do not state their timezone, so timezone is null.",
|
|
328
|
+
"Campaign tags need two more reads (custom-tag-mappings, then custom-tags) and so a key that can read both; an all:read key can. Turn the tags capability off to skip them: campaign tags are then empty.",
|
|
329
|
+
"A page of campaigns reads at most 10 pages of 100 tag assignments. A page with more assignments than that is refused with a Provider error, not returned with tags missing.",
|
|
330
|
+
"A step's delay is documented as the wait before the next email, so a step's delayDays is the delay of the step before it; the first step of a campaign waits 0 and the first step of a subsequence waits its pre_delay.",
|
|
331
|
+
"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.",
|
|
332
|
+
"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.",
|
|
333
|
+
"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.",
|
|
334
|
+
"connected is true for an Active account and false for a Connection Error; every other account status is null.",
|
|
335
|
+
"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.",
|
|
336
|
+
"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.",
|
|
337
|
+
"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.",
|
|
338
|
+
"A lead list's size is null: the list object has no count, and the count costs one more read per list. The native read leadListVerificationStats returns total_leads for one list. kind is always leads.",
|
|
339
|
+
"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.",
|
|
340
|
+
"The daily limits of leadLabelPrediction, localBusinessFilters and localBusinessSearch are counted in this process only; a restart forgets what was used.",
|
|
341
|
+
"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.",
|
|
342
|
+
"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.",
|
|
343
|
+
"Messages of a thread are found with the documented search value thread:<id>.",
|
|
344
|
+
"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."
|
|
345
|
+
];
|
|
346
|
+
|
|
347
|
+
// src/instantly/map-lead.ts
|
|
348
|
+
var INTEREST = /* @__PURE__ */ new Map([
|
|
349
|
+
[-4, ["No Show", "negative"]],
|
|
350
|
+
[-3, ["Lost", "negative"]],
|
|
351
|
+
[-2, ["Wrong Person", "negative"]],
|
|
352
|
+
[-1, ["Not Interested", "negative"]],
|
|
353
|
+
[0, ["Out of Office", "ooo"]],
|
|
354
|
+
[1, ["Interested", "positive"]],
|
|
355
|
+
[2, ["Meeting Booked", "positive"]],
|
|
356
|
+
[3, ["Meeting Completed", "positive"]],
|
|
357
|
+
[4, ["Won", "positive"]]
|
|
358
|
+
]);
|
|
359
|
+
var NO_LABELS = /* @__PURE__ */ new Map();
|
|
360
|
+
var isCustomInterest = (value) => {
|
|
361
|
+
const code = count(value);
|
|
362
|
+
return code !== null && !INTEREST.has(code);
|
|
363
|
+
};
|
|
364
|
+
var toLabels = (items) => new Map(
|
|
365
|
+
items.flatMap((item) => {
|
|
366
|
+
const code = count(item.interest_status);
|
|
367
|
+
return code === null ? [] : [[code, item]];
|
|
368
|
+
})
|
|
369
|
+
);
|
|
370
|
+
var interest = (value, labels) => {
|
|
371
|
+
const code = count(value);
|
|
372
|
+
if (code === null) {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
return INTEREST.get(code)?.[0] ?? text(labels.get(code)?.label);
|
|
376
|
+
};
|
|
377
|
+
var SENTIMENT = /* @__PURE__ */ new Map([
|
|
378
|
+
["negative", "negative"],
|
|
379
|
+
["neutral", "neutral"],
|
|
380
|
+
["positive", "positive"]
|
|
381
|
+
]);
|
|
382
|
+
var category = (value, labels) => {
|
|
383
|
+
const code = count(value);
|
|
384
|
+
if (code === null) {
|
|
385
|
+
return void 0;
|
|
386
|
+
}
|
|
387
|
+
return INTEREST.get(code)?.[1] ?? SENTIMENT.get(text(labels.get(code)?.interest_status_label) ?? "");
|
|
388
|
+
};
|
|
389
|
+
var LEAD_STATUS = /* @__PURE__ */ new Map([
|
|
390
|
+
[-2, "unsubscribed"],
|
|
391
|
+
[-1, "bounced"],
|
|
392
|
+
[1, "active"],
|
|
393
|
+
[2, "paused"],
|
|
394
|
+
[3, "completed"]
|
|
395
|
+
]);
|
|
396
|
+
var STEP_ID = /^\d+_(?<step>\d+)_(?<variant>\d+)$/u;
|
|
397
|
+
var stepPosition = (value) => {
|
|
398
|
+
const groups = STEP_ID.exec(text(value) ?? "")?.groups;
|
|
399
|
+
return groups === void 0 ? { stepIndex: null, variantKey: null } : {
|
|
400
|
+
stepIndex: Number(groups.step),
|
|
401
|
+
variantKey: String.fromCodePoint(65 + Number(groups.variant))
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
var wholeStep = (value) => {
|
|
405
|
+
const step = count(value);
|
|
406
|
+
return step !== null && Number.isInteger(step) ? step : null;
|
|
407
|
+
};
|
|
408
|
+
var engagement = (raw) => {
|
|
409
|
+
const read = {
|
|
410
|
+
clicks: count(raw.email_click_count),
|
|
411
|
+
lastContactedAt: timestamp(raw.timestamp_last_contact),
|
|
412
|
+
lastOpenedAt: timestamp(raw.timestamp_last_open),
|
|
413
|
+
lastRepliedAt: timestamp(raw.timestamp_last_reply),
|
|
414
|
+
opens: count(raw.email_open_count),
|
|
415
|
+
replies: count(raw.email_reply_count)
|
|
416
|
+
};
|
|
417
|
+
return Object.values(read).every((value) => value === null) ? null : {
|
|
418
|
+
...read,
|
|
419
|
+
// Counted from 0, like every step Instantly reports (seen live).
|
|
420
|
+
repliedStepIndex: wholeStep(raw.email_replied_step),
|
|
421
|
+
// The last step sent, from the lead's status summary.
|
|
422
|
+
stepIndex: stepPosition(
|
|
423
|
+
field(field(raw.status_summary, "lastStep"), "stepID")
|
|
424
|
+
).stepIndex
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
var toLead = (identity, raw, labels = NO_LABELS) => ({
|
|
428
|
+
...recordBase(identity, text(raw.id) ?? "", raw),
|
|
429
|
+
campaignRef: refTo(identity, text(raw.campaign)),
|
|
430
|
+
company: text(raw.company_name),
|
|
431
|
+
createdAt: timestamp(raw.timestamp_created),
|
|
432
|
+
custom: stringMap(raw.payload),
|
|
433
|
+
email: emailAddress(raw.email),
|
|
434
|
+
engagement: engagement(raw),
|
|
435
|
+
firstName: text(raw.first_name),
|
|
436
|
+
interest: interest(raw.lt_interest_status, labels),
|
|
437
|
+
lastName: text(raw.last_name),
|
|
438
|
+
linkedinUrl: null,
|
|
439
|
+
status: LEAD_STATUS.get(count(raw.status) ?? Number.NaN) ?? "unknown",
|
|
440
|
+
// Instantly tags mailboxes and campaigns, never leads.
|
|
441
|
+
tags: [],
|
|
442
|
+
title: text(raw.job_title)
|
|
443
|
+
});
|
|
444
|
+
var SCHEDULED = 4;
|
|
445
|
+
var RECEIVED = 2;
|
|
446
|
+
var messageFields = (identity, raw, includeBody) => {
|
|
447
|
+
const body = field(raw.body, "html") ?? field(raw.body, "text");
|
|
448
|
+
return {
|
|
449
|
+
...recordBase(identity, text(raw.id) ?? "", raw),
|
|
450
|
+
...normalizeBody(text(body), includeBody),
|
|
451
|
+
campaignRef: refTo(identity, text(raw.campaign_id)),
|
|
452
|
+
channel: "email",
|
|
453
|
+
leadRef: refTo(identity, text(raw.lead_id)),
|
|
454
|
+
senderRef: refTo(identity, emailAddress(raw.eaccount)),
|
|
455
|
+
sentAt: timestamp(raw.timestamp_email) ?? timestamp(raw.timestamp_created),
|
|
456
|
+
subject: text(raw.subject),
|
|
457
|
+
threadId: text(raw.thread_id),
|
|
458
|
+
...stepPosition(raw.step)
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
var isScheduled = (raw) => count(raw.ue_type) === SCHEDULED;
|
|
462
|
+
var isTruncated = (raw) => text(raw.body_fallback_reason) !== null;
|
|
463
|
+
var toMessage = (identity, raw, includeBody) => ({
|
|
464
|
+
...messageFields(identity, raw, includeBody),
|
|
465
|
+
direction: count(raw.ue_type) === RECEIVED ? "in" : "out"
|
|
466
|
+
});
|
|
467
|
+
var isAuto = (raw) => {
|
|
468
|
+
const value = raw.is_auto_reply;
|
|
469
|
+
return flag(value) ?? (count(value) === null ? null : count(value) === 1);
|
|
470
|
+
};
|
|
471
|
+
var toReply = (identity, raw, includeBody, labels = NO_LABELS) => {
|
|
472
|
+
const mapped = category(raw.i_status, labels);
|
|
473
|
+
return {
|
|
474
|
+
...messageFields(identity, raw, includeBody),
|
|
475
|
+
category: mapped ?? "unknown",
|
|
476
|
+
categorySource: mapped === void 0 ? null : "vendor",
|
|
477
|
+
direction: "in",
|
|
478
|
+
isAuto: isAuto(raw)
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// src/instantly/pages.ts
|
|
483
|
+
var pageSize = (limit) => Math.min(limit ?? PAGE_SIZE, PAGE_SIZE);
|
|
484
|
+
var after = (next) => isString(next) ? next : void 0;
|
|
485
|
+
var listPage = async (client, ctx, path, query, filters = {}) => listEnvelope(
|
|
486
|
+
await client.get(ctx, path, {
|
|
487
|
+
query: {
|
|
488
|
+
...filters,
|
|
489
|
+
limit: pageSize(query.limit),
|
|
490
|
+
starting_after: after(query.next)
|
|
491
|
+
}
|
|
492
|
+
})
|
|
493
|
+
);
|
|
494
|
+
var readLookup = async (client, ctx, lookup, next) => {
|
|
495
|
+
const envelope = await listPage(
|
|
496
|
+
client,
|
|
497
|
+
ctx,
|
|
498
|
+
lookup.path,
|
|
499
|
+
{ limit: PAGE_SIZE, next },
|
|
500
|
+
lookup.filters
|
|
501
|
+
);
|
|
502
|
+
if (envelope.next === void 0 || envelope.items.length < PAGE_SIZE) {
|
|
503
|
+
return envelope.items;
|
|
504
|
+
}
|
|
505
|
+
if (lookup.pages <= 1) {
|
|
506
|
+
throw new OutboundError(
|
|
507
|
+
"Provider",
|
|
508
|
+
`Instantly has more ${lookup.path} records for this page than the adapter reads`,
|
|
509
|
+
{ provider: client.identity.provider }
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
const rest = await readLookup(
|
|
513
|
+
client,
|
|
514
|
+
ctx,
|
|
515
|
+
{ ...lookup, pages: lookup.pages - 1 },
|
|
516
|
+
envelope.next
|
|
517
|
+
);
|
|
518
|
+
return [...envelope.items, ...rest];
|
|
519
|
+
};
|
|
520
|
+
var readLabels = async (client, ctx, statuses) => {
|
|
521
|
+
if (!statuses.some((status) => isCustomInterest(status))) {
|
|
522
|
+
return NO_LABELS;
|
|
523
|
+
}
|
|
524
|
+
const envelope = await listPage(client, ctx, "/lead-labels", {});
|
|
525
|
+
return toLabels(envelope.items);
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// src/instantly/adapter-account.ts
|
|
529
|
+
var accountReaders = (client) => {
|
|
530
|
+
const { identity } = client;
|
|
531
|
+
return {
|
|
532
|
+
getCampaignSettings: async (id, ctx) => toCampaignSettings(
|
|
533
|
+
identity,
|
|
534
|
+
await client.getObject(ctx, `/campaigns/${encodeURIComponent(id)}`)
|
|
535
|
+
),
|
|
536
|
+
getSenderHealth: async (id, ctx) => {
|
|
537
|
+
const account = await client.getObject(
|
|
538
|
+
ctx,
|
|
539
|
+
`/accounts/${encodeURIComponent(id)}`
|
|
540
|
+
);
|
|
541
|
+
const address = emailAddress(account.email) ?? id;
|
|
542
|
+
const vitals = await client.post(ctx, "/accounts/test/vitals", {
|
|
543
|
+
accounts: [address]
|
|
544
|
+
});
|
|
545
|
+
const warmup = await client.post(ctx, "/accounts/warmup-analytics", {
|
|
546
|
+
emails: [address]
|
|
547
|
+
});
|
|
548
|
+
return toSenderHealth(identity, id, { account, vitals, warmup });
|
|
549
|
+
},
|
|
550
|
+
listBlocklist: async (query, ctx) => {
|
|
551
|
+
const page = await listPage(client, ctx, "/block-lists-entries", query);
|
|
552
|
+
return {
|
|
553
|
+
items: page.items.map((item) => toBlockEntry(identity, item)),
|
|
554
|
+
next: page.next
|
|
555
|
+
};
|
|
556
|
+
},
|
|
557
|
+
listLists: async (query, ctx) => {
|
|
558
|
+
const page = await listPage(client, ctx, "/lead-lists", query);
|
|
559
|
+
return {
|
|
560
|
+
items: page.items.map((item) => toLeadList(identity, item)),
|
|
561
|
+
next: page.next
|
|
562
|
+
};
|
|
563
|
+
},
|
|
564
|
+
listSubsequences: async (query, ctx) => {
|
|
565
|
+
const page = await listPage(client, ctx, "/subsequences", query, {
|
|
566
|
+
parent_campaign: query.campaignId
|
|
567
|
+
});
|
|
568
|
+
return {
|
|
569
|
+
items: page.items.map(
|
|
570
|
+
(item) => toSubsequence(identity, item, query.campaignId)
|
|
571
|
+
),
|
|
572
|
+
next: page.next
|
|
573
|
+
};
|
|
574
|
+
},
|
|
575
|
+
listTags: async (query, ctx) => {
|
|
576
|
+
const page = await listPage(client, ctx, "/custom-tags", query);
|
|
577
|
+
return {
|
|
578
|
+
items: page.items.map((item) => toTag(identity, item)),
|
|
579
|
+
next: page.next
|
|
580
|
+
};
|
|
581
|
+
},
|
|
582
|
+
listWebhooks: async (query, ctx) => {
|
|
583
|
+
const page = await listPage(client, ctx, "/webhooks", query, {
|
|
584
|
+
campaign: query.campaignId
|
|
585
|
+
});
|
|
586
|
+
return {
|
|
587
|
+
items: page.items.map((item) => toWebhook(identity, item)),
|
|
588
|
+
next: page.next
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
// src/instantly/adapter-mail.ts
|
|
595
|
+
var emailCursor = (next) => ({
|
|
596
|
+
after: text(field(next, "after")) ?? void 0,
|
|
597
|
+
lead: text(field(next, "lead")) ?? void 0
|
|
598
|
+
});
|
|
599
|
+
var leadAddress = async (client, ctx, leadId, cursor) => {
|
|
600
|
+
if (leadId === void 0 || cursor.lead !== void 0) {
|
|
601
|
+
return cursor.lead;
|
|
602
|
+
}
|
|
603
|
+
const lead = await client.getObject(
|
|
604
|
+
ctx,
|
|
605
|
+
`/leads/${encodeURIComponent(leadId)}`
|
|
606
|
+
);
|
|
607
|
+
const address = text(lead.email);
|
|
608
|
+
if (address === null) {
|
|
609
|
+
throw new OutboundError("NotFound", `Lead ${leadId} has no email address`, {
|
|
610
|
+
provider: client.identity.provider
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
return address;
|
|
614
|
+
};
|
|
615
|
+
var withFullBody = async (client, ctx, item) => {
|
|
616
|
+
const id = text(item.id);
|
|
617
|
+
return id === null || !isTruncated(item) ? item : await client.getObject(ctx, `/emails/${encodeURIComponent(id)}`, {
|
|
618
|
+
lane: EMAILS_LANE
|
|
619
|
+
});
|
|
620
|
+
};
|
|
621
|
+
var listEmails = async (client, ctx, query, received) => {
|
|
622
|
+
const cursor = emailCursor(query.next);
|
|
623
|
+
const leadId = "leadId" in query ? query.leadId : void 0;
|
|
624
|
+
const threadId = "threadId" in query ? query.threadId : void 0;
|
|
625
|
+
const lead = await leadAddress(client, ctx, leadId, cursor);
|
|
626
|
+
const envelope = listEnvelope(
|
|
627
|
+
await client.get(ctx, "/emails", {
|
|
628
|
+
lane: EMAILS_LANE,
|
|
629
|
+
query: {
|
|
630
|
+
campaign_id: query.campaignId,
|
|
631
|
+
email_type: received ? "received" : void 0,
|
|
632
|
+
lead,
|
|
633
|
+
limit: pageSize(query.limit),
|
|
634
|
+
max_timestamp_created: query.until,
|
|
635
|
+
min_timestamp_created: query.since,
|
|
636
|
+
search: threadId === void 0 ? void 0 : `thread:${threadId}`,
|
|
637
|
+
starting_after: cursor.after
|
|
638
|
+
}
|
|
639
|
+
})
|
|
640
|
+
);
|
|
641
|
+
const sent = envelope.items.filter((item) => !isScheduled(item));
|
|
642
|
+
return {
|
|
643
|
+
items: query.includeBody ? await Promise.all(
|
|
644
|
+
sent.map(async (item) => await withFullBody(client, ctx, item))
|
|
645
|
+
) : sent,
|
|
646
|
+
next: envelope.next === void 0 ? void 0 : { after: envelope.next, lead: lead ?? null }
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
var mailReaders = (client) => ({
|
|
650
|
+
listMessages: async (query, ctx) => {
|
|
651
|
+
const page = await listEmails(client, ctx, query, false);
|
|
652
|
+
return {
|
|
653
|
+
items: page.items.map(
|
|
654
|
+
(item) => toMessage(client.identity, item, query.includeBody)
|
|
655
|
+
),
|
|
656
|
+
next: page.next
|
|
657
|
+
};
|
|
658
|
+
},
|
|
659
|
+
listReplies: async (query, ctx) => {
|
|
660
|
+
const page = await listEmails(client, ctx, query, true);
|
|
661
|
+
const labels = await readLabels(
|
|
662
|
+
client,
|
|
663
|
+
ctx,
|
|
664
|
+
page.items.map((item) => item.i_status)
|
|
665
|
+
);
|
|
666
|
+
const replies = page.items.map(
|
|
667
|
+
(item) => toReply(client.identity, item, query.includeBody, labels)
|
|
668
|
+
);
|
|
669
|
+
return {
|
|
670
|
+
// One i_status value fits in the query but a category maps to several, so
|
|
671
|
+
// the category is matched here on the mapped value.
|
|
672
|
+
items: query.category === void 0 ? replies : replies.filter((reply) => reply.category === query.category),
|
|
673
|
+
next: page.next
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
// src/instantly/map-stats.ts
|
|
679
|
+
var row = (scope, counts, extra = {}) => ({
|
|
680
|
+
...counts,
|
|
681
|
+
contentHash: null,
|
|
682
|
+
date: extra.date ?? null,
|
|
683
|
+
evidence: extra.evidence ?? "exact",
|
|
684
|
+
provider: scope.provider,
|
|
685
|
+
schemaVersion: SCHEMA_VERSION,
|
|
686
|
+
scope: scope.scope,
|
|
687
|
+
scopeRef: makeRef(scope.provider, scope.workspaceId, scope.scopeId),
|
|
688
|
+
stepIndex: extra.stepIndex ?? null,
|
|
689
|
+
// The analytics responses do not state the timezone of a "day".
|
|
690
|
+
timezone: null,
|
|
691
|
+
variantKey: extra.variantKey ?? null,
|
|
692
|
+
workspaceId: scope.workspaceId
|
|
693
|
+
});
|
|
694
|
+
var overviewRow = (scope, raw) => row(scope, {
|
|
695
|
+
...emptyCounts(),
|
|
696
|
+
bounced: count(raw.bounced_count),
|
|
697
|
+
clicked: count(raw.link_click_count_unique),
|
|
698
|
+
contacted: count(raw.contacted_count),
|
|
699
|
+
opened: count(raw.open_count_unique),
|
|
700
|
+
openedTotal: count(raw.open_count),
|
|
701
|
+
positive: count(raw.total_interested),
|
|
702
|
+
replied: count(raw.reply_count_unique),
|
|
703
|
+
repliedAuto: count(raw.reply_count_automatic_unique),
|
|
704
|
+
sent: count(raw.emails_sent_count),
|
|
705
|
+
unsubscribed: count(raw.unsubscribed_count)
|
|
706
|
+
});
|
|
707
|
+
var dailyCounts = (raw) => ({
|
|
708
|
+
...emptyCounts(),
|
|
709
|
+
bounced: count(raw.bounced),
|
|
710
|
+
clicked: count(raw.unique_clicks),
|
|
711
|
+
contacted: count(raw.contacted),
|
|
712
|
+
opened: count(raw.unique_opened),
|
|
713
|
+
openedTotal: count(raw.opened),
|
|
714
|
+
replied: count(raw.unique_replies),
|
|
715
|
+
repliedAuto: count(raw.unique_replies_automatic),
|
|
716
|
+
sent: count(raw.sent)
|
|
717
|
+
});
|
|
718
|
+
var dailyRow = (scope, raw) => row(scope, dailyCounts(raw), { date: text(raw.date) });
|
|
719
|
+
var summedRow = (scope, days) => row(scope, sumCounts(days.map(dailyCounts)), { evidence: "derived" });
|
|
720
|
+
var stepRow = (scope, raw) => {
|
|
721
|
+
const step = count(raw.step);
|
|
722
|
+
const variant = count(raw.variant);
|
|
723
|
+
return row(scope, dailyCounts(raw), {
|
|
724
|
+
stepIndex: step !== null && Number.isInteger(step) ? step : null,
|
|
725
|
+
variantKey: variant === null ? null : variantKey(variant)
|
|
726
|
+
});
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
// src/instantly/stats.ts
|
|
730
|
+
var range = (query) => ({
|
|
731
|
+
end_date: query.to,
|
|
732
|
+
start_date: query.from
|
|
733
|
+
});
|
|
734
|
+
var senderStats = async (client, ctx, scope, query) => {
|
|
735
|
+
const days = objects(
|
|
736
|
+
await client.get(ctx, "/accounts/analytics/daily", {
|
|
737
|
+
query: { ...range(query), emails: scope.scopeId }
|
|
738
|
+
})
|
|
739
|
+
);
|
|
740
|
+
return query.by === "day" ? days.map((day) => dailyRow(scope, day)) : [summedRow(scope, days)];
|
|
741
|
+
};
|
|
742
|
+
var readStats = async (client, ctx, query) => {
|
|
743
|
+
const { identity } = client;
|
|
744
|
+
const scope = {
|
|
745
|
+
...identity,
|
|
746
|
+
scope: query.scope,
|
|
747
|
+
scopeId: query.scopeId ?? identity.workspaceId
|
|
748
|
+
};
|
|
749
|
+
if (query.scope === "sender") {
|
|
750
|
+
return await senderStats(client, ctx, scope, query);
|
|
751
|
+
}
|
|
752
|
+
if (query.scope === "step") {
|
|
753
|
+
if (query.by === "day") {
|
|
754
|
+
throw new OutboundError(
|
|
755
|
+
"Unsupported",
|
|
756
|
+
"Instantly reports step analytics as totals only",
|
|
757
|
+
{
|
|
758
|
+
provider: identity.provider
|
|
759
|
+
}
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
const steps = await client.get(ctx, "/campaigns/analytics/steps", {
|
|
763
|
+
query: { ...range(query), campaign_id: query.scopeId }
|
|
764
|
+
});
|
|
765
|
+
return objects(steps).map((step) => stepRow(scope, step));
|
|
766
|
+
}
|
|
767
|
+
if (query.by === "day") {
|
|
768
|
+
const days = await client.get(ctx, "/campaigns/analytics/daily", {
|
|
769
|
+
query: { ...range(query), campaign_id: query.scopeId }
|
|
770
|
+
});
|
|
771
|
+
return objects(days).map((day) => dailyRow(scope, day));
|
|
772
|
+
}
|
|
773
|
+
const overview = await client.getObject(
|
|
774
|
+
ctx,
|
|
775
|
+
"/campaigns/analytics/overview",
|
|
776
|
+
{
|
|
777
|
+
query: { ...range(query), id: query.scopeId }
|
|
778
|
+
}
|
|
779
|
+
);
|
|
780
|
+
return [overviewRow(scope, overview)];
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// src/instantly/adapter.ts
|
|
784
|
+
var texts = (items, key) => items.flatMap((item) => text(item[key]) ?? []);
|
|
785
|
+
var campaignTags = async (client, ctx, ids) => {
|
|
786
|
+
const tags = /* @__PURE__ */ new Map();
|
|
787
|
+
if (!client.readTags || ids.length === 0) {
|
|
788
|
+
return tags;
|
|
789
|
+
}
|
|
790
|
+
const mappings = await readLookup(client, ctx, {
|
|
791
|
+
filters: { resource_ids: ids.join(",") },
|
|
792
|
+
pages: TAG_PAGES,
|
|
793
|
+
path: "/custom-tag-mappings"
|
|
794
|
+
});
|
|
795
|
+
if (mappings.length === 0) {
|
|
796
|
+
return tags;
|
|
797
|
+
}
|
|
798
|
+
const found = await readLookup(client, ctx, {
|
|
799
|
+
filters: { tag_ids: [...new Set(texts(mappings, "tag_id"))].join(",") },
|
|
800
|
+
pages: TAG_PAGES,
|
|
801
|
+
path: "/custom-tags"
|
|
802
|
+
});
|
|
803
|
+
const names = new Map(found.map((tag) => [text(tag.id), text(tag.label)]));
|
|
804
|
+
for (const mapping of mappings) {
|
|
805
|
+
const campaign = text(mapping.resource_id) ?? "";
|
|
806
|
+
const name = names.get(text(mapping.tag_id));
|
|
807
|
+
if (name !== null && name !== void 0) {
|
|
808
|
+
tags.set(campaign, [...tags.get(campaign) ?? [], name]);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return tags;
|
|
812
|
+
};
|
|
813
|
+
var listCampaigns = async (client, ctx, query) => {
|
|
814
|
+
if (query.status === "archived" || query.status === "unknown") {
|
|
815
|
+
return { items: [] };
|
|
816
|
+
}
|
|
817
|
+
const page = await listPage(client, ctx, "/campaigns", query, {
|
|
818
|
+
status: query.status === void 0 ? void 0 : campaignStatusCode(query.status)
|
|
819
|
+
});
|
|
820
|
+
const tags = await campaignTags(client, ctx, texts(page.items, "id"));
|
|
821
|
+
const campaigns = page.items.map(
|
|
822
|
+
(item) => toCampaign(client.identity, item, tags.get(text(item.id) ?? ""))
|
|
823
|
+
);
|
|
824
|
+
return {
|
|
825
|
+
// Active and paused each cover several Instantly statuses, so they are
|
|
826
|
+
// matched here on the mapped value.
|
|
827
|
+
items: query.status === void 0 ? campaigns : campaigns.filter((campaign) => campaign.status === query.status),
|
|
828
|
+
next: page.next
|
|
829
|
+
};
|
|
830
|
+
};
|
|
831
|
+
var campaignSenders = async (client, ctx, query) => {
|
|
832
|
+
const campaign = await client.getObject(
|
|
833
|
+
ctx,
|
|
834
|
+
`/campaigns/${encodeURIComponent(query.campaignId)}`
|
|
835
|
+
);
|
|
836
|
+
const addresses = new Set(
|
|
837
|
+
list(campaign.email_list).flatMap((value) => emailAddress(value) ?? [])
|
|
838
|
+
);
|
|
839
|
+
const tagIds = new Set(
|
|
840
|
+
list(campaign.email_tag_list).flatMap((value) => text(value) ?? [])
|
|
841
|
+
);
|
|
842
|
+
if (addresses.size === 0 && tagIds.size === 0) {
|
|
843
|
+
return { items: [] };
|
|
844
|
+
}
|
|
845
|
+
const byTagOnly = addresses.size === 0;
|
|
846
|
+
const page = await listPage(client, ctx, "/accounts", query, {
|
|
847
|
+
include_tags: byTagOnly || tagIds.size === 0 ? void 0 : true,
|
|
848
|
+
tag_ids: byTagOnly ? [...tagIds].join(",") : void 0
|
|
849
|
+
});
|
|
850
|
+
const attached = (account) => byTagOnly || addresses.has(emailAddress(account.email) ?? "") || texts(objects(account.tags), "id").some((id) => tagIds.has(id));
|
|
851
|
+
return {
|
|
852
|
+
items: page.items.filter((account) => attached(account)).map((account) => toSender(client.identity, account)),
|
|
853
|
+
next: page.next
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
var leadListBody = (query) => {
|
|
857
|
+
const body = { limit: pageSize(query.limit) };
|
|
858
|
+
if (query.campaignId !== void 0) {
|
|
859
|
+
body.campaign = query.campaignId;
|
|
860
|
+
}
|
|
861
|
+
if (query.listId !== void 0) {
|
|
862
|
+
body.list_id = query.listId;
|
|
863
|
+
}
|
|
864
|
+
if (query.email !== void 0) {
|
|
865
|
+
body.contacts = [query.email];
|
|
866
|
+
}
|
|
867
|
+
if (isString(query.next)) {
|
|
868
|
+
body.starting_after = query.next;
|
|
869
|
+
}
|
|
870
|
+
return body;
|
|
871
|
+
};
|
|
872
|
+
var leadReaders = (client) => ({
|
|
873
|
+
getLead: async (id, ctx) => {
|
|
874
|
+
const lead = await client.getObject(
|
|
875
|
+
ctx,
|
|
876
|
+
`/leads/${encodeURIComponent(id)}`
|
|
877
|
+
);
|
|
878
|
+
return toLead(
|
|
879
|
+
client.identity,
|
|
880
|
+
lead,
|
|
881
|
+
await readLabels(client, ctx, [lead.lt_interest_status])
|
|
882
|
+
);
|
|
883
|
+
},
|
|
884
|
+
listLeads: async (query, ctx) => {
|
|
885
|
+
if (query.linkedinUrl !== void 0) {
|
|
886
|
+
return { items: [] };
|
|
887
|
+
}
|
|
888
|
+
const envelope = listEnvelope(
|
|
889
|
+
await client.post(ctx, "/leads/list", leadListBody(query))
|
|
890
|
+
);
|
|
891
|
+
const labels = await readLabels(
|
|
892
|
+
client,
|
|
893
|
+
ctx,
|
|
894
|
+
envelope.items.map((item) => item.lt_interest_status)
|
|
895
|
+
);
|
|
896
|
+
const leads = envelope.items.map(
|
|
897
|
+
(item) => toLead(client.identity, item, labels)
|
|
898
|
+
);
|
|
899
|
+
return {
|
|
900
|
+
// `contacts` is documented as the emails a lead needs to have, but not
|
|
901
|
+
// how it compares them, so the match is made exact here.
|
|
902
|
+
items: query.email === void 0 ? leads : leads.filter((lead) => lead.email === query.email),
|
|
903
|
+
next: envelope.next
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
var readers = (client) => {
|
|
908
|
+
const { identity } = client;
|
|
909
|
+
return {
|
|
910
|
+
...accountReaders(client),
|
|
911
|
+
...leadReaders(client),
|
|
912
|
+
...mailReaders(client),
|
|
913
|
+
getCampaign: async (id, ctx) => {
|
|
914
|
+
const campaign = await client.getObject(
|
|
915
|
+
ctx,
|
|
916
|
+
`/campaigns/${encodeURIComponent(id)}`
|
|
917
|
+
);
|
|
918
|
+
const tags = await campaignTags(client, ctx, texts([campaign], "id"));
|
|
919
|
+
return toCampaign(identity, campaign, tags.get(text(campaign.id) ?? ""));
|
|
920
|
+
},
|
|
921
|
+
getSender: async (id, ctx) => toSender(
|
|
922
|
+
identity,
|
|
923
|
+
await client.getObject(ctx, `/accounts/${encodeURIComponent(id)}`)
|
|
924
|
+
),
|
|
925
|
+
getSequence: async (id, ctx) => toSequence(
|
|
926
|
+
identity,
|
|
927
|
+
await client.getObject(ctx, `/campaigns/${encodeURIComponent(id)}`)
|
|
928
|
+
),
|
|
929
|
+
listCampaigns: async (query, ctx) => await listCampaigns(client, ctx, query),
|
|
930
|
+
listSenders: async (query, ctx) => {
|
|
931
|
+
if (query.campaignId !== void 0) {
|
|
932
|
+
return await campaignSenders(client, ctx, {
|
|
933
|
+
...query,
|
|
934
|
+
campaignId: query.campaignId
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
const page = await listPage(client, ctx, "/accounts", query);
|
|
938
|
+
return {
|
|
939
|
+
items: page.items.map((item) => toSender(identity, item)),
|
|
940
|
+
next: page.next
|
|
941
|
+
};
|
|
942
|
+
},
|
|
943
|
+
listWorkspaces: async (_query, ctx) => {
|
|
944
|
+
const workspace = await client.get(ctx, "/workspaces/current");
|
|
945
|
+
return {
|
|
946
|
+
items: isJsonObject(workspace) ? [toWorkspace(identity, workspace)] : []
|
|
947
|
+
};
|
|
948
|
+
},
|
|
949
|
+
stats: (query, ctx) => readStats(client, ctx, query)
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
// src/instantly/native-params.ts
|
|
954
|
+
var inQuery = (type, description) => ({ description, in: "query", type });
|
|
955
|
+
var inQueryRequired = (type, description) => ({
|
|
956
|
+
description,
|
|
957
|
+
in: "query",
|
|
958
|
+
required: true,
|
|
959
|
+
type
|
|
960
|
+
});
|
|
961
|
+
var inBody = (type, description) => ({ description, in: "body", type });
|
|
962
|
+
var inBodyRequired = (type, description) => ({ description, in: "body", required: true, type });
|
|
963
|
+
var inPath = (description) => ({
|
|
964
|
+
description,
|
|
965
|
+
in: "path",
|
|
966
|
+
type: "string"
|
|
967
|
+
});
|
|
968
|
+
var PAGE = {
|
|
969
|
+
limit: inQuery("number", "Page size, 1 to 100."),
|
|
970
|
+
starting_after: inQuery(
|
|
971
|
+
"string",
|
|
972
|
+
"The next_starting_after of the previous page."
|
|
973
|
+
)
|
|
974
|
+
};
|
|
975
|
+
var docs = (page) => `https://developer.instantly.ai/api-reference/${page}`;
|
|
976
|
+
|
|
977
|
+
// src/instantly/native-agents-sales.ts
|
|
978
|
+
var SALES_AGENT_READS = defineNative({
|
|
979
|
+
leadFinderActivities: {
|
|
980
|
+
description: "What a Lead Finder Agent did, newest first.",
|
|
981
|
+
docs: docs("aileadfinderagent/list-ai-lead-finder-agent-activities"),
|
|
982
|
+
method: "GET",
|
|
983
|
+
params: {
|
|
984
|
+
...PAGE,
|
|
985
|
+
id: inPath("The agent.")
|
|
986
|
+
},
|
|
987
|
+
path: "/ai-agents/lead-finder/{id}/activities"
|
|
988
|
+
},
|
|
989
|
+
leadFinderAgent: {
|
|
990
|
+
description: "One Lead Finder Agent with its configuration.",
|
|
991
|
+
docs: docs("aileadfinderagent/get-an-ai-lead-finder-agent"),
|
|
992
|
+
method: "GET",
|
|
993
|
+
params: {
|
|
994
|
+
id: inPath("The agent.")
|
|
995
|
+
},
|
|
996
|
+
path: "/ai-agents/lead-finder/{id}"
|
|
997
|
+
},
|
|
998
|
+
leadFinderAgents: {
|
|
999
|
+
description: "The AI Lead Finder Agents that keep campaigns stocked with leads.",
|
|
1000
|
+
docs: docs("aileadfinderagent/list-ai-lead-finder-agents"),
|
|
1001
|
+
method: "GET",
|
|
1002
|
+
params: {
|
|
1003
|
+
...PAGE,
|
|
1004
|
+
campaign_id: inQuery("string", "Only the agent stocking this campaign.")
|
|
1005
|
+
},
|
|
1006
|
+
path: "/ai-agents/lead-finder"
|
|
1007
|
+
},
|
|
1008
|
+
leadFinderAudienceSuggestions: {
|
|
1009
|
+
description: "SuperSearch audiences that match the leads already in a campaign. Nothing is saved.",
|
|
1010
|
+
docs: docs("aileadfinderagent/suggest-audiences-from-a-campaign"),
|
|
1011
|
+
method: "POST",
|
|
1012
|
+
params: {
|
|
1013
|
+
campaign_id: inBodyRequired(
|
|
1014
|
+
"string",
|
|
1015
|
+
"The campaign whose leads are analyzed."
|
|
1016
|
+
),
|
|
1017
|
+
count: inBody("number", "How many suggestions, 1 to 5.")
|
|
1018
|
+
},
|
|
1019
|
+
path: "/ai-agents/lead-finder/suggest-audience"
|
|
1020
|
+
},
|
|
1021
|
+
leadFinderStats: {
|
|
1022
|
+
description: "A Lead Finder Agent's lifetime totals.",
|
|
1023
|
+
docs: docs("aileadfinderagent/get-ai-lead-finder-agent-lifetime-stats"),
|
|
1024
|
+
method: "GET",
|
|
1025
|
+
params: {
|
|
1026
|
+
id: inPath("The agent.")
|
|
1027
|
+
},
|
|
1028
|
+
path: "/ai-agents/lead-finder/{id}/stats"
|
|
1029
|
+
},
|
|
1030
|
+
leadFinderWorkflows: {
|
|
1031
|
+
description: "The enrichment workflows saved for Lead Finder Agents.",
|
|
1032
|
+
docs: docs("aileadfinderagent/list-saved-enrichment-workflows"),
|
|
1033
|
+
method: "GET",
|
|
1034
|
+
path: "/ai-agents/lead-finder/enrichment-workflows"
|
|
1035
|
+
},
|
|
1036
|
+
salesAgent: {
|
|
1037
|
+
description: "One AI Sales Agent with its configuration.",
|
|
1038
|
+
docs: docs("aisalesagent/get-an-ai-sales-agent"),
|
|
1039
|
+
method: "GET",
|
|
1040
|
+
params: {
|
|
1041
|
+
id: inPath("The agent.")
|
|
1042
|
+
},
|
|
1043
|
+
path: "/ai-agents/sales/{id}"
|
|
1044
|
+
},
|
|
1045
|
+
salesAgentActivities: {
|
|
1046
|
+
description: "What an AI Sales Agent did or proposes to do.",
|
|
1047
|
+
docs: docs("aisalesagent/list-ai-sales-agent-activities"),
|
|
1048
|
+
method: "GET",
|
|
1049
|
+
params: {
|
|
1050
|
+
...PAGE,
|
|
1051
|
+
action_status: inQuery(
|
|
1052
|
+
"list",
|
|
1053
|
+
"Only these statuses, for example pending."
|
|
1054
|
+
),
|
|
1055
|
+
action_type: inQuery(
|
|
1056
|
+
"list",
|
|
1057
|
+
"Only these action types, for example create_campaign."
|
|
1058
|
+
),
|
|
1059
|
+
exclude_live_feed_hidden: inQuery(
|
|
1060
|
+
"boolean",
|
|
1061
|
+
"Leave out what the live feed hides."
|
|
1062
|
+
),
|
|
1063
|
+
id: inPath("The agent."),
|
|
1064
|
+
lead_email: inQuery("string", "Only activities for this lead.")
|
|
1065
|
+
},
|
|
1066
|
+
path: "/ai-agents/sales/{id}/activities"
|
|
1067
|
+
},
|
|
1068
|
+
salesAgentAnalytics: {
|
|
1069
|
+
description: "Leads found, emails sent, replies and opportunities per day across an AI Sales Agent's campaigns.",
|
|
1070
|
+
docs: docs("aisalesagent/get-ai-sales-agent-analytics"),
|
|
1071
|
+
method: "GET",
|
|
1072
|
+
params: {
|
|
1073
|
+
end_date: inQuery("string", "Last day, YYYY-MM-DD or an ISO 8601 time."),
|
|
1074
|
+
id: inPath("The agent."),
|
|
1075
|
+
start_date: inQuery(
|
|
1076
|
+
"string",
|
|
1077
|
+
"First day, YYYY-MM-DD or an ISO 8601 time."
|
|
1078
|
+
)
|
|
1079
|
+
},
|
|
1080
|
+
path: "/ai-agents/sales/{id}/analytics"
|
|
1081
|
+
},
|
|
1082
|
+
salesAgentGuidanceRules: {
|
|
1083
|
+
description: "The rules an AI Sales Agent follows when it writes.",
|
|
1084
|
+
docs: docs("aisalesagent/list-ai-sales-agent-guidance-rules"),
|
|
1085
|
+
method: "GET",
|
|
1086
|
+
params: {
|
|
1087
|
+
id: inPath("The agent.")
|
|
1088
|
+
},
|
|
1089
|
+
path: "/ai-agents/sales/{id}/guidance-rules"
|
|
1090
|
+
},
|
|
1091
|
+
salesAgentLeadActivity: {
|
|
1092
|
+
description: "Each lead's history across an AI Sales Agent's campaigns: sends, opens, replies, clicks, bounces and opportunity status.",
|
|
1093
|
+
docs: docs("aisalesagent/list-ai-sales-agent-lead-activity"),
|
|
1094
|
+
method: "GET",
|
|
1095
|
+
params: {
|
|
1096
|
+
...PAGE,
|
|
1097
|
+
end_date: inQuery("string", "Last day, YYYY-MM-DD or an ISO 8601 time."),
|
|
1098
|
+
filter: inQuery("string", "replied or has_opportunity."),
|
|
1099
|
+
id: inPath("The agent."),
|
|
1100
|
+
start_date: inQuery(
|
|
1101
|
+
"string",
|
|
1102
|
+
"First day, YYYY-MM-DD or an ISO 8601 time."
|
|
1103
|
+
)
|
|
1104
|
+
},
|
|
1105
|
+
path: "/ai-agents/sales/{id}/leads/activity"
|
|
1106
|
+
},
|
|
1107
|
+
salesAgentLeadActivitySummary: {
|
|
1108
|
+
description: "Lead activity counts and rates across an AI Sales Agent's campaigns.",
|
|
1109
|
+
docs: docs("aisalesagent/get-ai-sales-agent-lead-activity-summary"),
|
|
1110
|
+
method: "GET",
|
|
1111
|
+
params: {
|
|
1112
|
+
end_date: inQuery("string", "Last day, YYYY-MM-DD or an ISO 8601 time."),
|
|
1113
|
+
id: inPath("The agent."),
|
|
1114
|
+
start_date: inQuery(
|
|
1115
|
+
"string",
|
|
1116
|
+
"First day, YYYY-MM-DD or an ISO 8601 time."
|
|
1117
|
+
)
|
|
1118
|
+
},
|
|
1119
|
+
path: "/ai-agents/sales/{id}/leads/activity/summary"
|
|
1120
|
+
},
|
|
1121
|
+
salesAgentLeadResearch: {
|
|
1122
|
+
description: "The sources an AI Sales Agent used to research one lead.",
|
|
1123
|
+
docs: docs("aisalesagent/get-research-sources-for-an-ai-sales-agent-lead"),
|
|
1124
|
+
method: "GET",
|
|
1125
|
+
params: {
|
|
1126
|
+
id: inPath("The agent."),
|
|
1127
|
+
lead_id: inPath("The lead.")
|
|
1128
|
+
},
|
|
1129
|
+
path: "/ai-agents/sales/{id}/leads/{lead_id}/research"
|
|
1130
|
+
},
|
|
1131
|
+
salesAgentOpportunities: {
|
|
1132
|
+
description: "Opportunities by status and by campaign for an AI Sales Agent.",
|
|
1133
|
+
docs: docs("aisalesagent/get-ai-sales-agent-opportunity-summary"),
|
|
1134
|
+
method: "GET",
|
|
1135
|
+
params: {
|
|
1136
|
+
end_date: inQuery("string", "Last day, YYYY-MM-DD or an ISO 8601 time."),
|
|
1137
|
+
id: inPath("The agent."),
|
|
1138
|
+
start_date: inQuery(
|
|
1139
|
+
"string",
|
|
1140
|
+
"First day, YYYY-MM-DD or an ISO 8601 time."
|
|
1141
|
+
)
|
|
1142
|
+
},
|
|
1143
|
+
path: "/ai-agents/sales/{id}/opportunities/summary"
|
|
1144
|
+
},
|
|
1145
|
+
salesAgents: {
|
|
1146
|
+
description: "The workspace's AI Sales Agents, newest first.",
|
|
1147
|
+
docs: docs("aisalesagent/list-ai-sales-agents"),
|
|
1148
|
+
method: "GET",
|
|
1149
|
+
params: {
|
|
1150
|
+
...PAGE,
|
|
1151
|
+
agent_type: inQuery(
|
|
1152
|
+
"number",
|
|
1153
|
+
"2 sales, 7 recruiting, 8 investment, 9 user research or 10 partnership."
|
|
1154
|
+
),
|
|
1155
|
+
search: inQuery("string", "Text to find in the name."),
|
|
1156
|
+
status: inQuery("number", "-1 trial expired, 0 inactive or 1 active.")
|
|
1157
|
+
},
|
|
1158
|
+
path: "/ai-agents/sales"
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
|
|
1162
|
+
// src/instantly/native-agents.ts
|
|
1163
|
+
var AGENT_READS = defineNative({
|
|
1164
|
+
deliverabilityAgent: {
|
|
1165
|
+
description: "The workspace's default AI Deliverability Agent, or null when none is deployed.",
|
|
1166
|
+
docs: docs("aideliverabilityagent/get-the-default-ai-deliverability-agent"),
|
|
1167
|
+
method: "GET",
|
|
1168
|
+
path: "/ai-agents/deliverability"
|
|
1169
|
+
},
|
|
1170
|
+
deliverabilityAgentById: {
|
|
1171
|
+
description: "One AI Deliverability Agent.",
|
|
1172
|
+
docs: docs("aideliverabilityagent/get-an-ai-deliverability-agent"),
|
|
1173
|
+
method: "GET",
|
|
1174
|
+
params: {
|
|
1175
|
+
id: inPath("The agent.")
|
|
1176
|
+
},
|
|
1177
|
+
path: "/ai-agents/deliverability/{id}"
|
|
1178
|
+
},
|
|
1179
|
+
deliverabilityAgentFeed: {
|
|
1180
|
+
description: "A Deliverability Agent's findings and recommendations, newest first.",
|
|
1181
|
+
docs: docs("aideliverabilityagent/list-ai-deliverability-agent-feed-items"),
|
|
1182
|
+
method: "GET",
|
|
1183
|
+
params: {
|
|
1184
|
+
...PAGE,
|
|
1185
|
+
feed_filter: inQuery("string", "all, todo or done."),
|
|
1186
|
+
id: inPath("The agent.")
|
|
1187
|
+
},
|
|
1188
|
+
path: "/ai-agents/deliverability/{id}/feed-items"
|
|
1189
|
+
},
|
|
1190
|
+
deliverabilityAgentState: {
|
|
1191
|
+
description: "What the default Deliverability Agent is doing: activity, schedule, last run and feed.",
|
|
1192
|
+
docs: docs(
|
|
1193
|
+
"aideliverabilityagent/get-the-default-ai-deliverability-agent-state"
|
|
1194
|
+
),
|
|
1195
|
+
method: "GET",
|
|
1196
|
+
params: {
|
|
1197
|
+
...PAGE,
|
|
1198
|
+
feed_filter: inQuery("string", "all, todo or done.")
|
|
1199
|
+
},
|
|
1200
|
+
path: "/ai-agents/deliverability/state"
|
|
1201
|
+
},
|
|
1202
|
+
deliverabilityAgentStateById: {
|
|
1203
|
+
description: "What one Deliverability Agent is doing: activity, schedule, last run and feed.",
|
|
1204
|
+
docs: docs("aideliverabilityagent/get-ai-deliverability-agent-state"),
|
|
1205
|
+
method: "GET",
|
|
1206
|
+
params: {
|
|
1207
|
+
...PAGE,
|
|
1208
|
+
feed_filter: inQuery("string", "all, todo or done."),
|
|
1209
|
+
id: inPath("The agent.")
|
|
1210
|
+
},
|
|
1211
|
+
path: "/ai-agents/deliverability/{id}/state"
|
|
1212
|
+
},
|
|
1213
|
+
inboxManager: {
|
|
1214
|
+
description: "One AI Inbox Manager with its configuration.",
|
|
1215
|
+
docs: docs("aiinboxmanager/get-an-ai-inbox-manager"),
|
|
1216
|
+
method: "GET",
|
|
1217
|
+
params: {
|
|
1218
|
+
id: inPath("The inbox manager."),
|
|
1219
|
+
with_metadata: inQuery("boolean", "Add details about the agent.")
|
|
1220
|
+
},
|
|
1221
|
+
path: "/ai-agents/inbox-manager/{id}"
|
|
1222
|
+
},
|
|
1223
|
+
inboxManagerActivity: {
|
|
1224
|
+
description: "An Inbox Manager's replies, follow-ups and no-show recoveries, newest first.",
|
|
1225
|
+
docs: docs("aiinboxmanager/list-ai-inbox-manager-activity"),
|
|
1226
|
+
method: "GET",
|
|
1227
|
+
params: {
|
|
1228
|
+
...PAGE,
|
|
1229
|
+
action_pending: inQuery(
|
|
1230
|
+
"boolean",
|
|
1231
|
+
"true for to-do items, false for done ones."
|
|
1232
|
+
),
|
|
1233
|
+
activity_type: inQuery("string", "reply, followup or recovery."),
|
|
1234
|
+
id: inPath("The inbox manager."),
|
|
1235
|
+
job_type: inQuery(
|
|
1236
|
+
"number",
|
|
1237
|
+
"1 reply, 2 follow-up or 3 no-show follow-up."
|
|
1238
|
+
)
|
|
1239
|
+
},
|
|
1240
|
+
path: "/ai-agents/inbox-manager/{id}/analytics/activity"
|
|
1241
|
+
},
|
|
1242
|
+
inboxManagerGuidance: {
|
|
1243
|
+
description: "One guidance of an Inbox Manager.",
|
|
1244
|
+
docs: docs("aiinboxmanager/get-an-ai-inbox-manager-guidance"),
|
|
1245
|
+
method: "GET",
|
|
1246
|
+
params: {
|
|
1247
|
+
guidance_id: inPath("The guidance."),
|
|
1248
|
+
id: inPath("The inbox manager.")
|
|
1249
|
+
},
|
|
1250
|
+
path: "/ai-agents/inbox-manager/{id}/guidances/{guidance_id}"
|
|
1251
|
+
},
|
|
1252
|
+
inboxManagerGuidances: {
|
|
1253
|
+
description: "The guidance an Inbox Manager follows.",
|
|
1254
|
+
docs: docs("aiinboxmanager/list-ai-inbox-manager-guidances"),
|
|
1255
|
+
method: "GET",
|
|
1256
|
+
params: {
|
|
1257
|
+
...PAGE,
|
|
1258
|
+
id: inPath("The inbox manager."),
|
|
1259
|
+
status: inQuery("number", "1 active or 0 inactive.")
|
|
1260
|
+
},
|
|
1261
|
+
path: "/ai-agents/inbox-manager/{id}/guidances"
|
|
1262
|
+
},
|
|
1263
|
+
inboxManagerReplies: {
|
|
1264
|
+
description: "The replies and follow-ups an Inbox Manager wrote, newest first.",
|
|
1265
|
+
docs: docs("aiinboxmanager/list-ai-inbox-manager-replies"),
|
|
1266
|
+
method: "GET",
|
|
1267
|
+
params: {
|
|
1268
|
+
...PAGE,
|
|
1269
|
+
action_pending: inQuery(
|
|
1270
|
+
"boolean",
|
|
1271
|
+
"Only replies that still need, or no longer need, an action."
|
|
1272
|
+
),
|
|
1273
|
+
id: inPath("The inbox manager."),
|
|
1274
|
+
information_requested: inQuery(
|
|
1275
|
+
"boolean",
|
|
1276
|
+
"Only replies where the agent asked for more information, or did not."
|
|
1277
|
+
),
|
|
1278
|
+
requires_hitl: inQuery(
|
|
1279
|
+
"boolean",
|
|
1280
|
+
"Only replies that need, or do not need, a person's review."
|
|
1281
|
+
)
|
|
1282
|
+
},
|
|
1283
|
+
path: "/ai-agents/inbox-manager/{id}/replies"
|
|
1284
|
+
},
|
|
1285
|
+
inboxManagerReply: {
|
|
1286
|
+
description: "One reply an Inbox Manager wrote, with its HTML body.",
|
|
1287
|
+
docs: docs("aiinboxmanager/get-an-ai-inbox-manager-reply"),
|
|
1288
|
+
method: "GET",
|
|
1289
|
+
params: {
|
|
1290
|
+
id: inPath("The inbox manager."),
|
|
1291
|
+
reply_id: inPath("The reply.")
|
|
1292
|
+
},
|
|
1293
|
+
path: "/ai-agents/inbox-manager/{id}/replies/{reply_id}"
|
|
1294
|
+
},
|
|
1295
|
+
inboxManagerSummary: {
|
|
1296
|
+
description: "An Inbox Manager's totals over a window.",
|
|
1297
|
+
docs: docs("aiinboxmanager/get-ai-inbox-manager-analytics-summary"),
|
|
1298
|
+
method: "GET",
|
|
1299
|
+
params: {
|
|
1300
|
+
from: inQuery("string", "First day of the window, YYYY-MM-DD."),
|
|
1301
|
+
id: inPath("The inbox manager."),
|
|
1302
|
+
to: inQuery("string", "Last day of the window, YYYY-MM-DD.")
|
|
1303
|
+
},
|
|
1304
|
+
path: "/ai-agents/inbox-manager/{id}/analytics/summary"
|
|
1305
|
+
},
|
|
1306
|
+
inboxManagerSummaryByDate: {
|
|
1307
|
+
description: "An Inbox Manager's totals for each day.",
|
|
1308
|
+
docs: docs("aiinboxmanager/get-ai-inbox-manager-analytics-by-date"),
|
|
1309
|
+
method: "GET",
|
|
1310
|
+
params: {
|
|
1311
|
+
from: inQuery("string", "First day of the window, YYYY-MM-DD."),
|
|
1312
|
+
id: inPath("The inbox manager."),
|
|
1313
|
+
to: inQuery("string", "Last day of the window, YYYY-MM-DD.")
|
|
1314
|
+
},
|
|
1315
|
+
path: "/ai-agents/inbox-manager/{id}/analytics/summary-by-date"
|
|
1316
|
+
},
|
|
1317
|
+
inboxManagers: {
|
|
1318
|
+
description: "The workspace's AI Inbox Managers, newest first.",
|
|
1319
|
+
docs: docs("aiinboxmanager/list-ai-inbox-managers"),
|
|
1320
|
+
method: "GET",
|
|
1321
|
+
params: {
|
|
1322
|
+
...PAGE,
|
|
1323
|
+
search: inQuery("string", "Text to find in the name."),
|
|
1324
|
+
status: inQuery("number", "0 inactive or 1 active.")
|
|
1325
|
+
},
|
|
1326
|
+
path: "/ai-agents/inbox-manager"
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1330
|
+
// src/instantly/native-campaigns.ts
|
|
1331
|
+
var CAMPAIGN_READS = defineNative({
|
|
1332
|
+
campaignAnalytics: {
|
|
1333
|
+
description: "Totals for one campaign or for every campaign, one row per campaign.",
|
|
1334
|
+
docs: docs("campaign/get-campaigns-analytics"),
|
|
1335
|
+
method: "GET",
|
|
1336
|
+
params: {
|
|
1337
|
+
end_date: inQuery("string", "Last day, YYYY-MM-DD or an ISO 8601 time."),
|
|
1338
|
+
exclude_total_leads_count: inQuery(
|
|
1339
|
+
"boolean",
|
|
1340
|
+
"Leave out the lead count, which makes the answer much faster."
|
|
1341
|
+
),
|
|
1342
|
+
id: inQuery("string", "One campaign. Leave out for every campaign."),
|
|
1343
|
+
ids: inQuery("list", "Only these campaigns, by id."),
|
|
1344
|
+
start_date: inQuery(
|
|
1345
|
+
"string",
|
|
1346
|
+
"First day, YYYY-MM-DD or an ISO 8601 time."
|
|
1347
|
+
)
|
|
1348
|
+
},
|
|
1349
|
+
path: "/campaigns/analytics"
|
|
1350
|
+
},
|
|
1351
|
+
campaignExport: {
|
|
1352
|
+
description: "One campaign as the JSON Instantly exports: schedule, sequences and settings.",
|
|
1353
|
+
docs: docs("campaign/export-campaign-to-json-format"),
|
|
1354
|
+
method: "POST",
|
|
1355
|
+
params: {
|
|
1356
|
+
id: inPath("The campaign.")
|
|
1357
|
+
},
|
|
1358
|
+
path: "/campaigns/{id}/export"
|
|
1359
|
+
},
|
|
1360
|
+
campaignSendingStatus: {
|
|
1361
|
+
description: "Why a campaign is not sending, or is sending slower than expected.",
|
|
1362
|
+
docs: docs("campaign/get-campaign-sending-status"),
|
|
1363
|
+
method: "GET",
|
|
1364
|
+
params: {
|
|
1365
|
+
id: inPath("The campaign."),
|
|
1366
|
+
with_ai_summary: inQuery("boolean", "Add an AI-written summary.")
|
|
1367
|
+
},
|
|
1368
|
+
path: "/campaigns/{id}/sending-status"
|
|
1369
|
+
},
|
|
1370
|
+
campaignsByLeadEmail: {
|
|
1371
|
+
description: "The campaigns a lead's email address is in.",
|
|
1372
|
+
docs: docs("campaign/search-campaigns-by-lead-email"),
|
|
1373
|
+
method: "GET",
|
|
1374
|
+
params: {
|
|
1375
|
+
search: inQuery("string", "The lead's email address."),
|
|
1376
|
+
sort_column: inQuery("string", "The column to sort by."),
|
|
1377
|
+
sort_order: inQuery("string", "asc or desc.")
|
|
1378
|
+
},
|
|
1379
|
+
path: "/campaigns/search-by-contact"
|
|
1380
|
+
},
|
|
1381
|
+
launchedCampaignCount: {
|
|
1382
|
+
description: "How many campaigns the workspace has launched.",
|
|
1383
|
+
docs: docs("campaign/get-launched-campaigns-count"),
|
|
1384
|
+
method: "GET",
|
|
1385
|
+
path: "/campaigns/count-launched"
|
|
1386
|
+
},
|
|
1387
|
+
senderCampaigns: {
|
|
1388
|
+
description: "The campaigns one mailbox sends for.",
|
|
1389
|
+
docs: docs("accountcampaignmapping/get-campaigns-associated-with-an-email"),
|
|
1390
|
+
method: "GET",
|
|
1391
|
+
params: {
|
|
1392
|
+
...PAGE,
|
|
1393
|
+
email: inPath("The mailbox address.")
|
|
1394
|
+
},
|
|
1395
|
+
path: "/account-campaign-mappings/{email}"
|
|
1396
|
+
},
|
|
1397
|
+
subsequence: {
|
|
1398
|
+
description: "One subsequence: its trigger conditions, status, schedule and steps.",
|
|
1399
|
+
docs: docs("campaignsubsequence/get-campaign-subsequence"),
|
|
1400
|
+
method: "GET",
|
|
1401
|
+
params: {
|
|
1402
|
+
id: inPath("The subsequence.")
|
|
1403
|
+
},
|
|
1404
|
+
path: "/subsequences/{id}"
|
|
1405
|
+
},
|
|
1406
|
+
subsequenceAnalytics: {
|
|
1407
|
+
description: "Sent, unique opens and unique replies for each subsequence of a campaign.",
|
|
1408
|
+
docs: docs("campaignsubsequence/get-subsequence-analytics-summary"),
|
|
1409
|
+
method: "GET",
|
|
1410
|
+
params: {
|
|
1411
|
+
campaign_id: inQueryRequired("string", "The parent campaign.")
|
|
1412
|
+
},
|
|
1413
|
+
path: "/subsequences/analytics"
|
|
1414
|
+
},
|
|
1415
|
+
subsequenceSendingStatus: {
|
|
1416
|
+
description: "Why a subsequence is not sending, or is sending slower than expected.",
|
|
1417
|
+
docs: docs("campaignsubsequence/get-subsequence-sending-status"),
|
|
1418
|
+
method: "GET",
|
|
1419
|
+
params: {
|
|
1420
|
+
id: inPath("The subsequence."),
|
|
1421
|
+
with_ai_summary: inQuery("boolean", "Add an AI-written summary.")
|
|
1422
|
+
},
|
|
1423
|
+
path: "/subsequences/{id}/sending-status"
|
|
1424
|
+
},
|
|
1425
|
+
subsequenceStepAnalytics: {
|
|
1426
|
+
description: "One subsequence's numbers by step and variant, without its parent campaign.",
|
|
1427
|
+
docs: docs(
|
|
1428
|
+
"campaignsubsequence/get-subsequence-step-and-variant-analytics"
|
|
1429
|
+
),
|
|
1430
|
+
method: "GET",
|
|
1431
|
+
params: {
|
|
1432
|
+
end_date: inQuery("string", "Last day, YYYY-MM-DD or an ISO 8601 time."),
|
|
1433
|
+
id: inPath("The subsequence."),
|
|
1434
|
+
start_date: inQuery(
|
|
1435
|
+
"string",
|
|
1436
|
+
"First day, YYYY-MM-DD or an ISO 8601 time."
|
|
1437
|
+
)
|
|
1438
|
+
},
|
|
1439
|
+
path: "/subsequences/{id}/analytics/steps"
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
|
|
1443
|
+
// src/instantly/native-leads.ts
|
|
1444
|
+
var LEAD_READS = defineNative({
|
|
1445
|
+
blocklistCsv: {
|
|
1446
|
+
description: "The whole block list as CSV text.",
|
|
1447
|
+
docs: docs("blocklistentry/download-all-block-list-entries-as-csv"),
|
|
1448
|
+
method: "GET",
|
|
1449
|
+
params: {
|
|
1450
|
+
domains_only: inQuery("boolean", "Only domain entries."),
|
|
1451
|
+
search: inQuery("string", "Only values that contain this text.")
|
|
1452
|
+
},
|
|
1453
|
+
path: "/block-lists-entries/download"
|
|
1454
|
+
},
|
|
1455
|
+
blocklistEntry: {
|
|
1456
|
+
description: "One block list entry.",
|
|
1457
|
+
docs: docs("blocklistentry/get-block-list-entry"),
|
|
1458
|
+
method: "GET",
|
|
1459
|
+
params: {
|
|
1460
|
+
id: inPath("The entry.")
|
|
1461
|
+
},
|
|
1462
|
+
path: "/block-lists-entries/{id}"
|
|
1463
|
+
},
|
|
1464
|
+
emailVerification: {
|
|
1465
|
+
description: "The result of an email verification that was started earlier.",
|
|
1466
|
+
docs: docs("emailverification/check-an-email-verification-status"),
|
|
1467
|
+
method: "GET",
|
|
1468
|
+
params: {
|
|
1469
|
+
email: inPath("The address that was verified.")
|
|
1470
|
+
},
|
|
1471
|
+
path: "/email-verification/{email}"
|
|
1472
|
+
},
|
|
1473
|
+
inboxUnreadCount: {
|
|
1474
|
+
description: "How many emails in the Unibox are unread.",
|
|
1475
|
+
docs: docs("email/count-unread-emails"),
|
|
1476
|
+
method: "GET",
|
|
1477
|
+
path: "/emails/unread/count"
|
|
1478
|
+
},
|
|
1479
|
+
leadLabel: {
|
|
1480
|
+
description: "One custom lead label and the interest status it stands for.",
|
|
1481
|
+
docs: docs("leadlabel/get-lead-label"),
|
|
1482
|
+
method: "GET",
|
|
1483
|
+
params: {
|
|
1484
|
+
id: inPath("The label.")
|
|
1485
|
+
},
|
|
1486
|
+
path: "/lead-labels/{id}"
|
|
1487
|
+
},
|
|
1488
|
+
leadLabelPrediction: {
|
|
1489
|
+
description: "The label Instantly's AI would give a reply text. Nothing is saved.",
|
|
1490
|
+
docs: docs("leadlabel/test-ai-reply-label-prediction"),
|
|
1491
|
+
lane: LABEL_PREDICTION_LANE,
|
|
1492
|
+
method: "POST",
|
|
1493
|
+
params: {
|
|
1494
|
+
reply_text: inBodyRequired("string", "The reply to classify.")
|
|
1495
|
+
},
|
|
1496
|
+
path: "/lead-labels/ai-reply-label"
|
|
1497
|
+
},
|
|
1498
|
+
leadList: {
|
|
1499
|
+
description: "One lead list.",
|
|
1500
|
+
docs: docs("leadlist/get-lead-list"),
|
|
1501
|
+
method: "GET",
|
|
1502
|
+
params: {
|
|
1503
|
+
id: inPath("The list.")
|
|
1504
|
+
},
|
|
1505
|
+
path: "/lead-lists/{id}"
|
|
1506
|
+
},
|
|
1507
|
+
leadListVerificationStats: {
|
|
1508
|
+
description: "How many leads a list holds and how their email verification came out.",
|
|
1509
|
+
docs: docs("leadlist/get-verification-statistics-for-a-lead-list"),
|
|
1510
|
+
method: "GET",
|
|
1511
|
+
params: {
|
|
1512
|
+
id: inPath("The list.")
|
|
1513
|
+
},
|
|
1514
|
+
path: "/lead-lists/{id}/verification-stats"
|
|
1515
|
+
},
|
|
1516
|
+
tag: {
|
|
1517
|
+
description: "One custom tag.",
|
|
1518
|
+
docs: docs("customtag/get-custom-tag"),
|
|
1519
|
+
method: "GET",
|
|
1520
|
+
params: {
|
|
1521
|
+
id: inPath("The tag.")
|
|
1522
|
+
},
|
|
1523
|
+
path: "/custom-tags/{id}"
|
|
1524
|
+
},
|
|
1525
|
+
tagsOfResources: {
|
|
1526
|
+
description: "The custom tags assigned to any of the given campaigns or mailboxes.",
|
|
1527
|
+
docs: docs("customtag/list-custom-tags-assigned-to-resources"),
|
|
1528
|
+
method: "POST",
|
|
1529
|
+
params: {
|
|
1530
|
+
limit: inBody("number", "Page size, 1 to 100."),
|
|
1531
|
+
resource_ids: inBodyRequired(
|
|
1532
|
+
"json",
|
|
1533
|
+
"Campaign ids or mailbox addresses."
|
|
1534
|
+
),
|
|
1535
|
+
starting_after: inBody(
|
|
1536
|
+
"string",
|
|
1537
|
+
"The next_starting_after of the previous page."
|
|
1538
|
+
)
|
|
1539
|
+
},
|
|
1540
|
+
path: "/custom-tags/search"
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
|
|
1544
|
+
// src/instantly/native-search.ts
|
|
1545
|
+
var SEARCH_READS = defineNative({
|
|
1546
|
+
creatorOutreachBatch: {
|
|
1547
|
+
description: "A creator list and the progress of its last conversion into leads.",
|
|
1548
|
+
docs: docs("creator/get-a-creator-outreach-batch"),
|
|
1549
|
+
method: "GET",
|
|
1550
|
+
params: {
|
|
1551
|
+
id: inPath("The batch.")
|
|
1552
|
+
},
|
|
1553
|
+
path: "/creator-search/outreach-batches/{id}"
|
|
1554
|
+
},
|
|
1555
|
+
creatorSearchAllowance: {
|
|
1556
|
+
description: "The free creator search pages left today and the price after them.",
|
|
1557
|
+
docs: docs(
|
|
1558
|
+
"creator/get-the-free-creator-search-pages-left-today-and-the-price-after-them"
|
|
1559
|
+
),
|
|
1560
|
+
method: "GET",
|
|
1561
|
+
path: "/creator-search/search-allowance"
|
|
1562
|
+
},
|
|
1563
|
+
creatorSearchCapabilities: {
|
|
1564
|
+
description: "What creator search supports and what enrichment costs.",
|
|
1565
|
+
docs: docs(
|
|
1566
|
+
"creator/get-what-creator-search-currently-supports-and-what-enrichment-costs"
|
|
1567
|
+
),
|
|
1568
|
+
method: "GET",
|
|
1569
|
+
path: "/creator-search/capabilities"
|
|
1570
|
+
},
|
|
1571
|
+
creatorSearchDictionaries: {
|
|
1572
|
+
description: "The ids of the languages, interests, brands and audiences a creator search can filter on.",
|
|
1573
|
+
docs: docs("creator/get-creator-search-dictionaries"),
|
|
1574
|
+
method: "GET",
|
|
1575
|
+
params: {
|
|
1576
|
+
platform: inQueryRequired("string", "instagram, tiktok or youtube."),
|
|
1577
|
+
query: inQuery("string", "Text to find.")
|
|
1578
|
+
},
|
|
1579
|
+
path: "/creator-search/dictionaries"
|
|
1580
|
+
},
|
|
1581
|
+
creatorSearchLocations: {
|
|
1582
|
+
description: "The places a creator search can filter on.",
|
|
1583
|
+
docs: docs("creator/get-creator-search-locations"),
|
|
1584
|
+
method: "GET",
|
|
1585
|
+
params: {
|
|
1586
|
+
platform: inQueryRequired("string", "instagram, tiktok or youtube."),
|
|
1587
|
+
query: inQueryRequired("string", "Text to find in a place name.")
|
|
1588
|
+
},
|
|
1589
|
+
path: "/creator-search/locations"
|
|
1590
|
+
},
|
|
1591
|
+
localBusinessConversion: {
|
|
1592
|
+
description: "The progress of a job that turns local businesses into leads.",
|
|
1593
|
+
docs: docs("localbusiness/read-a-local-business-convert-job"),
|
|
1594
|
+
method: "GET",
|
|
1595
|
+
params: {
|
|
1596
|
+
id: inPath("The job.")
|
|
1597
|
+
},
|
|
1598
|
+
path: "/local-business-search/convert/{id}"
|
|
1599
|
+
},
|
|
1600
|
+
localBusinessFilters: {
|
|
1601
|
+
description: "The search filters a sentence such as dentists in Austin stands for.",
|
|
1602
|
+
docs: docs(
|
|
1603
|
+
"localbusiness/turn-a-sentence-into-local-business-search-filters"
|
|
1604
|
+
),
|
|
1605
|
+
lane: LOCAL_FILTERS_LANE,
|
|
1606
|
+
method: "POST",
|
|
1607
|
+
params: {
|
|
1608
|
+
input: inBodyRequired("string", "The sentence.")
|
|
1609
|
+
},
|
|
1610
|
+
path: "/local-business-search/ai-filters"
|
|
1611
|
+
},
|
|
1612
|
+
localBusinessPlaces: {
|
|
1613
|
+
description: "The cities a local business search can use as its location.",
|
|
1614
|
+
docs: docs("localbusiness/suggest-cities-for-a-local-business-search"),
|
|
1615
|
+
method: "GET",
|
|
1616
|
+
params: {
|
|
1617
|
+
q: inQueryRequired("string", "Text to find in a city name.")
|
|
1618
|
+
},
|
|
1619
|
+
path: "/local-business-search/places"
|
|
1620
|
+
},
|
|
1621
|
+
localBusinessSearch: {
|
|
1622
|
+
description: "Local businesses by category and place. Searching is free; emails are not shown.",
|
|
1623
|
+
docs: docs("localbusiness/search-local-businesses"),
|
|
1624
|
+
lane: LOCAL_SEARCH_LANE,
|
|
1625
|
+
method: "POST",
|
|
1626
|
+
params: {
|
|
1627
|
+
filters: inBodyRequired(
|
|
1628
|
+
"json",
|
|
1629
|
+
"A category, query or name, and a location."
|
|
1630
|
+
),
|
|
1631
|
+
page_size: inBody("number", "Businesses per page, 1 to 25.")
|
|
1632
|
+
},
|
|
1633
|
+
path: "/local-business-search/search"
|
|
1634
|
+
}
|
|
1635
|
+
});
|
|
1636
|
+
|
|
1637
|
+
// src/instantly/native-senders.ts
|
|
1638
|
+
var SENDER_READS = defineNative({
|
|
1639
|
+
crmPhoneNumbers: {
|
|
1640
|
+
description: "The phone numbers the workspace rents for calls and texts.",
|
|
1641
|
+
docs: docs("crmactions/list-phone-numbers"),
|
|
1642
|
+
method: "GET",
|
|
1643
|
+
path: "/crm-actions/phone-numbers"
|
|
1644
|
+
},
|
|
1645
|
+
dfyAccounts: {
|
|
1646
|
+
description: "The done-for-you mailboxes the workspace ordered. Passwords are never asked for.",
|
|
1647
|
+
docs: docs("dfyemailaccountorder/list-dfy-ordered-email-accounts"),
|
|
1648
|
+
method: "GET",
|
|
1649
|
+
params: {
|
|
1650
|
+
...PAGE
|
|
1651
|
+
},
|
|
1652
|
+
path: "/dfy-email-account-orders/accounts"
|
|
1653
|
+
},
|
|
1654
|
+
dfyOrders: {
|
|
1655
|
+
description: "The done-for-you mailbox orders the workspace placed.",
|
|
1656
|
+
docs: docs("dfyemailaccountorder/list-dfy-email-account-order"),
|
|
1657
|
+
method: "GET",
|
|
1658
|
+
params: {
|
|
1659
|
+
...PAGE
|
|
1660
|
+
},
|
|
1661
|
+
path: "/dfy-email-account-orders"
|
|
1662
|
+
},
|
|
1663
|
+
dfyPreWarmedDomains: {
|
|
1664
|
+
description: "The pre-warmed domains Instantly has for sale.",
|
|
1665
|
+
docs: docs("dfyemailaccountorder/get-pre-warmed-up-domains"),
|
|
1666
|
+
method: "POST",
|
|
1667
|
+
params: {
|
|
1668
|
+
extensions: inBody("json", "Only these extensions: com, org or co."),
|
|
1669
|
+
search: inBody("string", "Part or all of a domain name.")
|
|
1670
|
+
},
|
|
1671
|
+
path: "/dfy-email-account-orders/domains/pre-warmed-up-list"
|
|
1672
|
+
},
|
|
1673
|
+
domainForwarding: {
|
|
1674
|
+
description: "Where a domain bought through Instantly forwards web visitors.",
|
|
1675
|
+
docs: docs("domainforwarding/get-domain-forwarding"),
|
|
1676
|
+
method: "GET",
|
|
1677
|
+
params: {
|
|
1678
|
+
domain: inPath("The domain.")
|
|
1679
|
+
},
|
|
1680
|
+
path: "/domains/{domain}/forwarding"
|
|
1681
|
+
},
|
|
1682
|
+
inboxPlacementEspOptions: {
|
|
1683
|
+
description: "The mail providers an inbox placement test can send to.",
|
|
1684
|
+
docs: docs("inboxplacementtest/get-esp-options"),
|
|
1685
|
+
method: "GET",
|
|
1686
|
+
path: "/inbox-placement-tests/email-service-provider-options"
|
|
1687
|
+
},
|
|
1688
|
+
inboxPlacementInsights: {
|
|
1689
|
+
description: "A test's inbox, spam and category shares, with the earlier period beside them when asked.",
|
|
1690
|
+
docs: docs(
|
|
1691
|
+
"inboxplacementanalytics/retrieve-inbox-placement-analytics-deliverability-insights"
|
|
1692
|
+
),
|
|
1693
|
+
method: "POST",
|
|
1694
|
+
params: {
|
|
1695
|
+
date_from: inBody("string", "First day of the window."),
|
|
1696
|
+
date_to: inBody("string", "Last day of the window."),
|
|
1697
|
+
previous_date_from: inBody("string", "First day of the earlier window."),
|
|
1698
|
+
previous_date_to: inBody("string", "Last day of the earlier window."),
|
|
1699
|
+
recipient_esp: inBody(
|
|
1700
|
+
"json",
|
|
1701
|
+
"Provider codes, for example 1 Google and 2 Microsoft."
|
|
1702
|
+
),
|
|
1703
|
+
recipient_geo: inBody(
|
|
1704
|
+
"json",
|
|
1705
|
+
"Region codes: 1 United States, 2 Italy, 3 Germany, 4 France."
|
|
1706
|
+
),
|
|
1707
|
+
recipient_type: inBody(
|
|
1708
|
+
"json",
|
|
1709
|
+
"Recipient types: 1 professional, 2 personal."
|
|
1710
|
+
),
|
|
1711
|
+
show_previous: inBody("boolean", "Add the earlier window's numbers."),
|
|
1712
|
+
test_id: inBodyRequired("string", "The test.")
|
|
1713
|
+
},
|
|
1714
|
+
path: "/inbox-placement-analytics/deliverability-insights"
|
|
1715
|
+
},
|
|
1716
|
+
inboxPlacementReport: {
|
|
1717
|
+
description: "One blacklist and SpamAssassin report.",
|
|
1718
|
+
docs: docs(
|
|
1719
|
+
"inboxplacementblacklistandspamassassinreport/get-inbox-placement-blacklist-and-spamassassin-report"
|
|
1720
|
+
),
|
|
1721
|
+
method: "GET",
|
|
1722
|
+
params: {
|
|
1723
|
+
id: inPath("The report.")
|
|
1724
|
+
},
|
|
1725
|
+
path: "/inbox-placement-reports/{id}"
|
|
1726
|
+
},
|
|
1727
|
+
inboxPlacementReports: {
|
|
1728
|
+
description: "A test's blacklist and SpamAssassin reports.",
|
|
1729
|
+
docs: docs(
|
|
1730
|
+
"inboxplacementblacklistandspamassassinreport/list-inbox-placement-blacklist-and-spamassassin-report"
|
|
1731
|
+
),
|
|
1732
|
+
method: "GET",
|
|
1733
|
+
params: {
|
|
1734
|
+
...PAGE,
|
|
1735
|
+
date_from: inQuery("string", "First day of the window."),
|
|
1736
|
+
date_to: inQuery("string", "Last day of the window."),
|
|
1737
|
+
skip_blacklist_report: inQuery(
|
|
1738
|
+
"boolean",
|
|
1739
|
+
"Leave out the blacklist report."
|
|
1740
|
+
),
|
|
1741
|
+
skip_spam_assassin_report: inQuery(
|
|
1742
|
+
"boolean",
|
|
1743
|
+
"Leave out the SpamAssassin report."
|
|
1744
|
+
),
|
|
1745
|
+
test_id: inQueryRequired("string", "The test.")
|
|
1746
|
+
},
|
|
1747
|
+
path: "/inbox-placement-reports"
|
|
1748
|
+
},
|
|
1749
|
+
inboxPlacementResult: {
|
|
1750
|
+
description: "One test email's placement result.",
|
|
1751
|
+
docs: docs("inboxplacementanalytics/get-inbox-placement-analytics"),
|
|
1752
|
+
method: "GET",
|
|
1753
|
+
params: {
|
|
1754
|
+
id: inPath("The result.")
|
|
1755
|
+
},
|
|
1756
|
+
path: "/inbox-placement-analytics/{id}"
|
|
1757
|
+
},
|
|
1758
|
+
inboxPlacementResults: {
|
|
1759
|
+
description: "Where each test email landed: inbox, spam or a category folder, with its SPF, DKIM and DMARC results.",
|
|
1760
|
+
docs: docs("inboxplacementanalytics/list-inbox-placement-analytics"),
|
|
1761
|
+
method: "GET",
|
|
1762
|
+
params: {
|
|
1763
|
+
...PAGE,
|
|
1764
|
+
date_from: inQuery("string", "First day of the window."),
|
|
1765
|
+
date_to: inQuery("string", "Last day of the window."),
|
|
1766
|
+
recipient_esp: inQuery("string", "Provider codes, separated by commas."),
|
|
1767
|
+
recipient_geo: inQuery("string", "Region codes, separated by commas."),
|
|
1768
|
+
recipient_type: inQuery(
|
|
1769
|
+
"string",
|
|
1770
|
+
"Recipient type codes, separated by commas."
|
|
1771
|
+
),
|
|
1772
|
+
sender_email: inQuery("string", "Only this sending mailbox."),
|
|
1773
|
+
test_id: inQueryRequired("string", "The test.")
|
|
1774
|
+
},
|
|
1775
|
+
path: "/inbox-placement-analytics"
|
|
1776
|
+
},
|
|
1777
|
+
inboxPlacementStatsByDate: {
|
|
1778
|
+
description: "A test's inbox, spam and category counts for each day.",
|
|
1779
|
+
docs: docs(
|
|
1780
|
+
"inboxplacementanalytics/get-inbox-placement-analytics-stats-by-date"
|
|
1781
|
+
),
|
|
1782
|
+
method: "POST",
|
|
1783
|
+
params: {
|
|
1784
|
+
date_from: inBody("string", "First day of the window."),
|
|
1785
|
+
date_to: inBody("string", "Last day of the window."),
|
|
1786
|
+
recipient_esp: inBody(
|
|
1787
|
+
"json",
|
|
1788
|
+
"Provider codes, for example 1 Google and 2 Microsoft."
|
|
1789
|
+
),
|
|
1790
|
+
recipient_geo: inBody(
|
|
1791
|
+
"json",
|
|
1792
|
+
"Region codes: 1 United States, 2 Italy, 3 Germany, 4 France."
|
|
1793
|
+
),
|
|
1794
|
+
recipient_type: inBody(
|
|
1795
|
+
"json",
|
|
1796
|
+
"Recipient types: 1 professional, 2 personal."
|
|
1797
|
+
),
|
|
1798
|
+
sender_email: inBody("string", "Only this sending mailbox."),
|
|
1799
|
+
test_id: inBodyRequired("string", "The test.")
|
|
1800
|
+
},
|
|
1801
|
+
path: "/inbox-placement-analytics/stats-by-date"
|
|
1802
|
+
},
|
|
1803
|
+
inboxPlacementStatsByTest: {
|
|
1804
|
+
description: "Inbox, spam and category counts for each of several tests.",
|
|
1805
|
+
docs: docs(
|
|
1806
|
+
"inboxplacementanalytics/retrieve-inbox-placement-analytics-stats-by-test-id"
|
|
1807
|
+
),
|
|
1808
|
+
method: "POST",
|
|
1809
|
+
params: {
|
|
1810
|
+
date_from: inBody("string", "First day of the window."),
|
|
1811
|
+
date_to: inBody("string", "Last day of the window."),
|
|
1812
|
+
recipient_esp: inBody(
|
|
1813
|
+
"json",
|
|
1814
|
+
"Provider codes, for example 1 Google and 2 Microsoft."
|
|
1815
|
+
),
|
|
1816
|
+
recipient_geo: inBody(
|
|
1817
|
+
"json",
|
|
1818
|
+
"Region codes: 1 United States, 2 Italy, 3 Germany, 4 France."
|
|
1819
|
+
),
|
|
1820
|
+
recipient_type: inBody(
|
|
1821
|
+
"json",
|
|
1822
|
+
"Recipient types: 1 professional, 2 personal."
|
|
1823
|
+
),
|
|
1824
|
+
sender_email: inBody("string", "Only this sending mailbox."),
|
|
1825
|
+
test_ids: inBodyRequired("json", "The tests.")
|
|
1826
|
+
},
|
|
1827
|
+
path: "/inbox-placement-analytics/stats-by-test-id"
|
|
1828
|
+
},
|
|
1829
|
+
inboxPlacementTest: {
|
|
1830
|
+
description: "One inbox placement test.",
|
|
1831
|
+
docs: docs("inboxplacementtest/get-inbox-placement-test"),
|
|
1832
|
+
method: "GET",
|
|
1833
|
+
params: {
|
|
1834
|
+
id: inPath("The test."),
|
|
1835
|
+
with_metadata: inQuery("boolean", "Add metadata about the test.")
|
|
1836
|
+
},
|
|
1837
|
+
path: "/inbox-placement-tests/{id}"
|
|
1838
|
+
},
|
|
1839
|
+
inboxPlacementTests: {
|
|
1840
|
+
description: "The workspace's inbox placement tests.",
|
|
1841
|
+
docs: docs("inboxplacementtest/list-inbox-placement-test"),
|
|
1842
|
+
method: "GET",
|
|
1843
|
+
params: {
|
|
1844
|
+
...PAGE,
|
|
1845
|
+
search: inQuery("string", "Text to find in a test's name."),
|
|
1846
|
+
sort_order: inQuery("string", "asc or desc."),
|
|
1847
|
+
status: inQuery("number", "1, 2 or 3, the test's status code.")
|
|
1848
|
+
},
|
|
1849
|
+
path: "/inbox-placement-tests"
|
|
1850
|
+
},
|
|
1851
|
+
trackingDomainStatus: {
|
|
1852
|
+
description: "Whether a custom tracking domain's CNAME and SSL are in place.",
|
|
1853
|
+
docs: docs("account/get-custom-tracking-domain-status"),
|
|
1854
|
+
method: "GET",
|
|
1855
|
+
params: {
|
|
1856
|
+
host: inQueryRequired("string", "The tracking domain's host.")
|
|
1857
|
+
},
|
|
1858
|
+
path: "/accounts/ctd/status"
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
|
|
1862
|
+
// src/instantly/native-supersearch.ts
|
|
1863
|
+
var SUPERSEARCH_READS = defineNative({
|
|
1864
|
+
aiEnrichmentsInProgress: {
|
|
1865
|
+
description: "The AI enrichment jobs still running for a list or campaign.",
|
|
1866
|
+
docs: docs("supersearchenrichment/get-ai-enrichment-for-resource"),
|
|
1867
|
+
method: "GET",
|
|
1868
|
+
params: {
|
|
1869
|
+
limit: inQuery("number", "How many jobs to return."),
|
|
1870
|
+
offset: inQuery("number", "How many jobs to skip."),
|
|
1871
|
+
resource_id: inPath("The list or campaign.")
|
|
1872
|
+
},
|
|
1873
|
+
path: "/supersearch-enrichment/ai/{resource_id}/in-progress"
|
|
1874
|
+
},
|
|
1875
|
+
companyList: {
|
|
1876
|
+
description: "One company list and how far its build is.",
|
|
1877
|
+
docs: docs("companylist/get-company-list-status"),
|
|
1878
|
+
method: "GET",
|
|
1879
|
+
params: {
|
|
1880
|
+
company_list_id: inPath("The company list.")
|
|
1881
|
+
},
|
|
1882
|
+
path: "/supersearch-enrichment/company-lists/{company_list_id}"
|
|
1883
|
+
},
|
|
1884
|
+
companyListCompanies: {
|
|
1885
|
+
description: "The companies in a company list.",
|
|
1886
|
+
docs: docs("companylist/list-company-list-members"),
|
|
1887
|
+
method: "GET",
|
|
1888
|
+
params: {
|
|
1889
|
+
...PAGE,
|
|
1890
|
+
company_list_id: inPath("The company list."),
|
|
1891
|
+
cursor: inQuery("string", "The old name of starting_after.")
|
|
1892
|
+
},
|
|
1893
|
+
path: "/supersearch-enrichment/company-lists/{company_list_id}/companies"
|
|
1894
|
+
},
|
|
1895
|
+
companyListFilterOptions: {
|
|
1896
|
+
description: "The values a company-list filter accepts.",
|
|
1897
|
+
docs: docs(
|
|
1898
|
+
"companylist/get-remote-filter-options-for-a-catalog-backed-company-list-filter"
|
|
1899
|
+
),
|
|
1900
|
+
method: "GET",
|
|
1901
|
+
params: {
|
|
1902
|
+
catalog_id: inQueryRequired("string", "The filter's catalog."),
|
|
1903
|
+
limit: inQuery("number", "How many values, 1 to 500."),
|
|
1904
|
+
q: inQuery("string", "Text to find in a value.")
|
|
1905
|
+
},
|
|
1906
|
+
path: "/supersearch-enrichment/company-lists/filter-options"
|
|
1907
|
+
},
|
|
1908
|
+
companyListRecipes: {
|
|
1909
|
+
description: "The ready-made recipes for building a company list.",
|
|
1910
|
+
docs: docs("companylist/list-company-list-recipes"),
|
|
1911
|
+
method: "GET",
|
|
1912
|
+
path: "/supersearch-enrichment/company-lists/recipes"
|
|
1913
|
+
},
|
|
1914
|
+
companyListSources: {
|
|
1915
|
+
description: "The sources a company list can be built from.",
|
|
1916
|
+
docs: docs("companylist/list-company-list-sources"),
|
|
1917
|
+
method: "GET",
|
|
1918
|
+
path: "/supersearch-enrichment/company-lists/sources"
|
|
1919
|
+
},
|
|
1920
|
+
companyLists: {
|
|
1921
|
+
description: "The company lists the workspace built.",
|
|
1922
|
+
docs: docs("companylist/list-company-lists"),
|
|
1923
|
+
method: "GET",
|
|
1924
|
+
params: {
|
|
1925
|
+
...PAGE,
|
|
1926
|
+
cursor: inQuery("string", "The old name of starting_after."),
|
|
1927
|
+
search: inQuery("string", "Text to find in the name.")
|
|
1928
|
+
},
|
|
1929
|
+
path: "/supersearch-enrichment/company-lists"
|
|
1930
|
+
},
|
|
1931
|
+
enrichment: {
|
|
1932
|
+
description: "The enrichment settings and progress of a list or campaign.",
|
|
1933
|
+
docs: docs("supersearchenrichment/get-enrichment-for-resource"),
|
|
1934
|
+
method: "GET",
|
|
1935
|
+
params: {
|
|
1936
|
+
resource_id: inPath("The list or campaign.")
|
|
1937
|
+
},
|
|
1938
|
+
path: "/supersearch-enrichment/{resource_id}"
|
|
1939
|
+
},
|
|
1940
|
+
enrichmentHistory: {
|
|
1941
|
+
description: "The enrichment runs of a list or campaign, newest first.",
|
|
1942
|
+
docs: docs("supersearchenrichment/get-enrichment-history"),
|
|
1943
|
+
method: "GET",
|
|
1944
|
+
params: {
|
|
1945
|
+
limit: inQuery("number", "How many entries to return."),
|
|
1946
|
+
offset: inQuery("number", "How many entries to skip."),
|
|
1947
|
+
resource_id: inPath("The list or campaign.")
|
|
1948
|
+
},
|
|
1949
|
+
path: "/supersearch-enrichment/history/{resource_id}"
|
|
1950
|
+
},
|
|
1951
|
+
enrichmentProviders: {
|
|
1952
|
+
description: "Every data provider an enrichment can call, with its actions and credit cost.",
|
|
1953
|
+
docs: docs(
|
|
1954
|
+
"supersearchenrichment/returns-the-full-integration-provider-registry"
|
|
1955
|
+
),
|
|
1956
|
+
method: "GET",
|
|
1957
|
+
path: "/supersearch-enrichment/integrations/providers"
|
|
1958
|
+
},
|
|
1959
|
+
savedSearch: {
|
|
1960
|
+
description: "One saved SuperSearch query.",
|
|
1961
|
+
docs: docs("supersearchenrichment/get-a-saved-search"),
|
|
1962
|
+
method: "GET",
|
|
1963
|
+
params: {
|
|
1964
|
+
id: inPath("The saved search.")
|
|
1965
|
+
},
|
|
1966
|
+
path: "/supersearch-enrichment/saved-searches/{id}"
|
|
1967
|
+
},
|
|
1968
|
+
savedSearches: {
|
|
1969
|
+
description: "The workspace's saved SuperSearch queries, newest first.",
|
|
1970
|
+
docs: docs("supersearchenrichment/list-saved-searches"),
|
|
1971
|
+
method: "GET",
|
|
1972
|
+
params: {
|
|
1973
|
+
...PAGE,
|
|
1974
|
+
search: inQuery("string", "Text to find in the name.")
|
|
1975
|
+
},
|
|
1976
|
+
path: "/supersearch-enrichment/saved-searches"
|
|
1977
|
+
},
|
|
1978
|
+
superSearchLeadCount: {
|
|
1979
|
+
description: "How many leads match a SuperSearch query. Nothing is enriched.",
|
|
1980
|
+
docs: docs("supersearchenrichment/count-leads-from-supersearch"),
|
|
1981
|
+
method: "POST",
|
|
1982
|
+
params: {
|
|
1983
|
+
search_filters: inBodyRequired("json", "The SuperSearch filters."),
|
|
1984
|
+
show_one_lead_per_company: inBody(
|
|
1985
|
+
"boolean",
|
|
1986
|
+
"Count one lead per company."
|
|
1987
|
+
),
|
|
1988
|
+
skip_owned_leads: inBody(
|
|
1989
|
+
"boolean",
|
|
1990
|
+
"Leave out leads the workspace already has."
|
|
1991
|
+
)
|
|
1992
|
+
},
|
|
1993
|
+
path: "/supersearch-enrichment/count-leads-from-supersearch"
|
|
1994
|
+
},
|
|
1995
|
+
superSearchLeadPreview: {
|
|
1996
|
+
description: "A sample of the leads that match a SuperSearch query. Nothing is enriched.",
|
|
1997
|
+
docs: docs("supersearchenrichment/preview-leads-from-supersearch"),
|
|
1998
|
+
method: "POST",
|
|
1999
|
+
params: {
|
|
2000
|
+
search_filters: inBodyRequired("json", "The SuperSearch filters."),
|
|
2001
|
+
show_one_lead_per_company: inBody(
|
|
2002
|
+
"boolean",
|
|
2003
|
+
"Return one lead per company."
|
|
2004
|
+
),
|
|
2005
|
+
skip_owned_leads: inBody(
|
|
2006
|
+
"boolean",
|
|
2007
|
+
"Leave out leads the workspace already has."
|
|
2008
|
+
)
|
|
2009
|
+
},
|
|
2010
|
+
path: "/supersearch-enrichment/preview-leads-from-supersearch"
|
|
2011
|
+
},
|
|
2012
|
+
superSearchSignalKeywords: {
|
|
2013
|
+
description: "The most common keywords of a signal category over the last 90 days.",
|
|
2014
|
+
docs: docs("supersearchenrichment/facet-keywords-for-a-signal-category"),
|
|
2015
|
+
method: "POST",
|
|
2016
|
+
params: {
|
|
2017
|
+
category: inBodyRequired(
|
|
2018
|
+
"string",
|
|
2019
|
+
"The signal category, for example linkedin_post_contact."
|
|
2020
|
+
),
|
|
2021
|
+
field: inBodyRequired("string", "The keyword field to count."),
|
|
2022
|
+
limit: inBody("number", "How many keywords, 1 to 100."),
|
|
2023
|
+
prefix: inBody("string", "Only keywords that start with this.")
|
|
2024
|
+
},
|
|
2025
|
+
path: "/supersearch-enrichment/signal-keywords-facet"
|
|
2026
|
+
}
|
|
2027
|
+
});
|
|
2028
|
+
|
|
2029
|
+
// src/instantly/native-workspace.ts
|
|
2030
|
+
var WORKSPACE_READS = defineNative({
|
|
2031
|
+
agentItems: {
|
|
2032
|
+
description: "Every AI agent and automation in the workspace, in one list.",
|
|
2033
|
+
docs: docs("engageitem/list-ai-agent-items"),
|
|
2034
|
+
method: "GET",
|
|
2035
|
+
params: {
|
|
2036
|
+
...PAGE,
|
|
2037
|
+
ai_agent_type: inQuery(
|
|
2038
|
+
"number",
|
|
2039
|
+
"Only this kind of AI agent, by its number."
|
|
2040
|
+
),
|
|
2041
|
+
search: inQuery("string", "Text to find in the name."),
|
|
2042
|
+
status: inQuery(
|
|
2043
|
+
"string",
|
|
2044
|
+
"Active, Paused, Draft or Error, separated by commas."
|
|
2045
|
+
),
|
|
2046
|
+
type: inQuery(
|
|
2047
|
+
"string",
|
|
2048
|
+
"ai_agent, automation or both, separated by commas."
|
|
2049
|
+
)
|
|
2050
|
+
},
|
|
2051
|
+
path: "/agent-items"
|
|
2052
|
+
},
|
|
2053
|
+
auditLogs: {
|
|
2054
|
+
description: "Who did what in the workspace.",
|
|
2055
|
+
docs: docs("auditlog/list-audit-log"),
|
|
2056
|
+
method: "GET",
|
|
2057
|
+
params: {
|
|
2058
|
+
...PAGE,
|
|
2059
|
+
activity_type: inQuery(
|
|
2060
|
+
"number",
|
|
2061
|
+
"Only this activity type, by its number."
|
|
2062
|
+
),
|
|
2063
|
+
end_date: inQuery("string", "Only logs up to this day."),
|
|
2064
|
+
search: inQuery("string", "Text to find in a log."),
|
|
2065
|
+
start_date: inQuery("string", "Only logs from this day on.")
|
|
2066
|
+
},
|
|
2067
|
+
path: "/audit-logs"
|
|
2068
|
+
},
|
|
2069
|
+
backgroundJob: {
|
|
2070
|
+
description: "One background job and its progress.",
|
|
2071
|
+
docs: docs("backgroundjob/get-background-job"),
|
|
2072
|
+
method: "GET",
|
|
2073
|
+
params: {
|
|
2074
|
+
data_fields: inQuery(
|
|
2075
|
+
"string",
|
|
2076
|
+
"Fields of the job's data to return, separated by commas."
|
|
2077
|
+
),
|
|
2078
|
+
id: inPath("The job.")
|
|
2079
|
+
},
|
|
2080
|
+
path: "/background-jobs/{id}"
|
|
2081
|
+
},
|
|
2082
|
+
backgroundJobs: {
|
|
2083
|
+
description: "Background jobs such as lead moves, imports and exports, with their progress.",
|
|
2084
|
+
docs: docs("backgroundjob/list-background-job"),
|
|
2085
|
+
method: "GET",
|
|
2086
|
+
params: {
|
|
2087
|
+
...PAGE,
|
|
2088
|
+
entity_id: inQuery(
|
|
2089
|
+
"string",
|
|
2090
|
+
"Lists or campaigns the job works on, separated by commas."
|
|
2091
|
+
),
|
|
2092
|
+
entity_type: inQuery(
|
|
2093
|
+
"string",
|
|
2094
|
+
"What the job works on, for example list or campaign."
|
|
2095
|
+
),
|
|
2096
|
+
excluded_ids: inQuery(
|
|
2097
|
+
"string",
|
|
2098
|
+
"Jobs to leave out, separated by commas."
|
|
2099
|
+
),
|
|
2100
|
+
ids: inQuery("string", "Only these jobs, separated by commas."),
|
|
2101
|
+
included_ids: inQuery(
|
|
2102
|
+
"string",
|
|
2103
|
+
"Jobs to add to the answer, separated by commas."
|
|
2104
|
+
),
|
|
2105
|
+
sort_column: inQuery("string", "created_at or updated_at."),
|
|
2106
|
+
sort_order: inQuery("string", "asc or desc."),
|
|
2107
|
+
status: inQuery(
|
|
2108
|
+
"string",
|
|
2109
|
+
"pending, in-progress, success or failed, separated by commas."
|
|
2110
|
+
),
|
|
2111
|
+
type: inQuery("string", "The kind of job, for example move-leads.")
|
|
2112
|
+
},
|
|
2113
|
+
path: "/background-jobs"
|
|
2114
|
+
},
|
|
2115
|
+
webhook: {
|
|
2116
|
+
description: "One webhook. Its headers can carry a secret.",
|
|
2117
|
+
docs: docs("webhook/get-webhook"),
|
|
2118
|
+
method: "GET",
|
|
2119
|
+
params: {
|
|
2120
|
+
id: inPath("The webhook.")
|
|
2121
|
+
},
|
|
2122
|
+
path: "/webhooks/{id}",
|
|
2123
|
+
sensitive: true
|
|
2124
|
+
},
|
|
2125
|
+
webhookEvent: {
|
|
2126
|
+
description: "One webhook delivery with its payload and response.",
|
|
2127
|
+
docs: docs("webhookevent/get-webhook-event"),
|
|
2128
|
+
method: "GET",
|
|
2129
|
+
params: {
|
|
2130
|
+
id: inPath("The delivery.")
|
|
2131
|
+
},
|
|
2132
|
+
path: "/webhook-events/{id}"
|
|
2133
|
+
},
|
|
2134
|
+
webhookEventSummary: {
|
|
2135
|
+
description: "How many webhook deliveries worked and failed.",
|
|
2136
|
+
docs: docs("webhookevent/get-overview-aggregates-for-webhook-events"),
|
|
2137
|
+
method: "GET",
|
|
2138
|
+
params: {
|
|
2139
|
+
from: inQuery("string", "First day of the window, YYYY-MM-DD."),
|
|
2140
|
+
to: inQuery("string", "Last day of the window, YYYY-MM-DD.")
|
|
2141
|
+
},
|
|
2142
|
+
path: "/webhook-events/summary"
|
|
2143
|
+
},
|
|
2144
|
+
webhookEventSummaryByDate: {
|
|
2145
|
+
description: "Webhook deliveries that worked and failed, for each day.",
|
|
2146
|
+
docs: docs(
|
|
2147
|
+
"webhookevent/get-overview-aggregates-for-webhook-events-by-date"
|
|
2148
|
+
),
|
|
2149
|
+
method: "GET",
|
|
2150
|
+
params: {
|
|
2151
|
+
from: inQuery("string", "First day of the window, YYYY-MM-DD."),
|
|
2152
|
+
to: inQuery("string", "Last day of the window, YYYY-MM-DD.")
|
|
2153
|
+
},
|
|
2154
|
+
path: "/webhook-events/summary-by-date"
|
|
2155
|
+
},
|
|
2156
|
+
webhookEventTypes: {
|
|
2157
|
+
description: "Every event a webhook can listen for, custom lead labels included.",
|
|
2158
|
+
docs: docs("webhook/list-available-event-types"),
|
|
2159
|
+
method: "GET",
|
|
2160
|
+
path: "/webhooks/event-types"
|
|
2161
|
+
},
|
|
2162
|
+
webhookEvents: {
|
|
2163
|
+
description: "The delivery log: each webhook call Instantly made and how the receiver answered.",
|
|
2164
|
+
docs: docs("webhookevent/list-webhook-event"),
|
|
2165
|
+
method: "GET",
|
|
2166
|
+
params: {
|
|
2167
|
+
...PAGE,
|
|
2168
|
+
from: inQuery("string", "First day of the window, YYYY-MM-DD."),
|
|
2169
|
+
search: inQuery("string", "An exact webhook URL or lead email."),
|
|
2170
|
+
success: inQuery(
|
|
2171
|
+
"boolean",
|
|
2172
|
+
"Only deliveries that worked, or only those that failed."
|
|
2173
|
+
),
|
|
2174
|
+
to: inQuery("string", "Last day of the window, YYYY-MM-DD.")
|
|
2175
|
+
},
|
|
2176
|
+
path: "/webhook-events"
|
|
2177
|
+
},
|
|
2178
|
+
whitelabelDomain: {
|
|
2179
|
+
description: "The agency domain verified for the workspace.",
|
|
2180
|
+
docs: docs("workspace/get-organization-verified-agency-domain-information"),
|
|
2181
|
+
method: "GET",
|
|
2182
|
+
path: "/workspaces/current/whitelabel-domain"
|
|
2183
|
+
},
|
|
2184
|
+
workspaceGroupAdmin: {
|
|
2185
|
+
description: "The admin workspace this workspace belongs to.",
|
|
2186
|
+
docs: docs(
|
|
2187
|
+
"workspacegroupmember/get-the-current-workspace-admin-workspace"
|
|
2188
|
+
),
|
|
2189
|
+
method: "GET",
|
|
2190
|
+
path: "/workspace-group-members/admin"
|
|
2191
|
+
},
|
|
2192
|
+
workspaceGroupMember: {
|
|
2193
|
+
description: "One sub workspace of an admin workspace.",
|
|
2194
|
+
docs: docs("workspacegroupmember/get-workspace-group-member"),
|
|
2195
|
+
method: "GET",
|
|
2196
|
+
params: {
|
|
2197
|
+
id: inPath("The group member.")
|
|
2198
|
+
},
|
|
2199
|
+
path: "/workspace-group-members/{id}"
|
|
2200
|
+
},
|
|
2201
|
+
workspaceGroupMembers: {
|
|
2202
|
+
description: "The sub workspaces of an agency's admin workspace.",
|
|
2203
|
+
docs: docs("workspacegroupmember/list-workspace-group-member"),
|
|
2204
|
+
method: "GET",
|
|
2205
|
+
params: {
|
|
2206
|
+
...PAGE
|
|
2207
|
+
},
|
|
2208
|
+
path: "/workspace-group-members"
|
|
2209
|
+
},
|
|
2210
|
+
workspaceMember: {
|
|
2211
|
+
description: "One workspace member.",
|
|
2212
|
+
docs: docs("workspacemember/get-workspace-member"),
|
|
2213
|
+
method: "GET",
|
|
2214
|
+
params: {
|
|
2215
|
+
id: inPath("The member.")
|
|
2216
|
+
},
|
|
2217
|
+
path: "/workspace-members/{id}"
|
|
2218
|
+
},
|
|
2219
|
+
workspaceMembers: {
|
|
2220
|
+
description: "The people in the workspace and their roles. Leads and emails name them in assigned_to.",
|
|
2221
|
+
docs: docs("workspacemember/list-workspace-member"),
|
|
2222
|
+
method: "GET",
|
|
2223
|
+
params: {
|
|
2224
|
+
...PAGE,
|
|
2225
|
+
accepted: inQuery(
|
|
2226
|
+
"boolean",
|
|
2227
|
+
"Only members who accepted, or only those still invited."
|
|
2228
|
+
),
|
|
2229
|
+
search: inQuery("string", "A name or an email.")
|
|
2230
|
+
},
|
|
2231
|
+
path: "/workspace-members"
|
|
2232
|
+
}
|
|
2233
|
+
});
|
|
2234
|
+
|
|
2235
|
+
// src/instantly/native.ts
|
|
2236
|
+
var NATIVE = defineNative({
|
|
2237
|
+
...AGENT_READS,
|
|
2238
|
+
...CAMPAIGN_READS,
|
|
2239
|
+
...LEAD_READS,
|
|
2240
|
+
...SALES_AGENT_READS,
|
|
2241
|
+
...SEARCH_READS,
|
|
2242
|
+
...SENDER_READS,
|
|
2243
|
+
...SUPERSEARCH_READS,
|
|
2244
|
+
...WORKSPACE_READS
|
|
2245
|
+
});
|
|
2246
|
+
|
|
2247
|
+
// src/instantly/client.ts
|
|
2248
|
+
var READ_POSTS = [
|
|
2249
|
+
"/accounts/test/vitals",
|
|
2250
|
+
"/accounts/warmup-analytics",
|
|
2251
|
+
"/leads/list"
|
|
2252
|
+
];
|
|
2253
|
+
var normalizePath = (path) => `/${path.replace(/^\/+/u, "").replace(/\/+$/u, "")}`.replace(
|
|
2254
|
+
/^\/api\/v2/u,
|
|
2255
|
+
""
|
|
2256
|
+
);
|
|
2257
|
+
var pattern = (path) => new RegExp(
|
|
2258
|
+
`^${path.split("/").map(
|
|
2259
|
+
(part) => part.startsWith("{") ? "[^/]+" : part.replaceAll(".", String.raw`\.`)
|
|
2260
|
+
).join("/")}$`,
|
|
2261
|
+
"u"
|
|
2262
|
+
);
|
|
2263
|
+
var READ_POST_PATTERNS = [
|
|
2264
|
+
...READ_POSTS,
|
|
2265
|
+
...Object.values(NATIVE).flatMap(
|
|
2266
|
+
(read) => read.method === "POST" ? [read.path] : []
|
|
2267
|
+
)
|
|
2268
|
+
].map((path) => pattern(path));
|
|
2269
|
+
var SECRET_PATH = /^\/api-keys(?:\/|$)/iu;
|
|
2270
|
+
var DFY_ACCOUNTS = /^\/dfy-email-account-orders\/accounts$/iu;
|
|
2271
|
+
var isSecret = (path, query) => {
|
|
2272
|
+
const normalized = normalizePath(path);
|
|
2273
|
+
const passwords = query.get("with_passwords");
|
|
2274
|
+
return SECRET_PATH.test(normalized) || DFY_ACCOUNTS.test(normalized) && passwords !== null && passwords.toLowerCase() !== "false";
|
|
2275
|
+
};
|
|
2276
|
+
var isRead = (method, path) => {
|
|
2277
|
+
if (method !== "POST") {
|
|
2278
|
+
return method === "GET";
|
|
2279
|
+
}
|
|
2280
|
+
const normalized = normalizePath(path);
|
|
2281
|
+
return READ_POST_PATTERNS.some((expression) => expression.test(normalized));
|
|
2282
|
+
};
|
|
2283
|
+
var createClient = (options) => {
|
|
2284
|
+
const baseUrl = options.baseUrl ?? BASE_URL;
|
|
2285
|
+
const authorize = (spec) => ({
|
|
2286
|
+
...spec,
|
|
2287
|
+
headers: {
|
|
2288
|
+
...spec.headers,
|
|
2289
|
+
authorization: `Bearer ${options.apiKey}`,
|
|
2290
|
+
...options.asWorkspace === void 0 ? void 0 : { "x-as-workspace": options.asWorkspace }
|
|
2291
|
+
}
|
|
2292
|
+
});
|
|
2293
|
+
const get = async (ctx, path, request = {}) => {
|
|
2294
|
+
const response = await ctx.request(
|
|
2295
|
+
authorize({
|
|
2296
|
+
lane: request.lane,
|
|
2297
|
+
method: "GET",
|
|
2298
|
+
url: buildUrl(baseUrl, path, request.query)
|
|
2299
|
+
})
|
|
2300
|
+
);
|
|
2301
|
+
return response.body;
|
|
2302
|
+
};
|
|
2303
|
+
return {
|
|
2304
|
+
get,
|
|
2305
|
+
getObject: async (ctx, path, request) => {
|
|
2306
|
+
const body = await get(ctx, path, request);
|
|
2307
|
+
if (!isJsonObject(body)) {
|
|
2308
|
+
throw new OutboundError(
|
|
2309
|
+
"Provider",
|
|
2310
|
+
`Instantly returned no object for ${path}`,
|
|
2311
|
+
{
|
|
2312
|
+
provider: options.identity.provider
|
|
2313
|
+
}
|
|
2314
|
+
);
|
|
2315
|
+
}
|
|
2316
|
+
return body;
|
|
2317
|
+
},
|
|
2318
|
+
identity: options.identity,
|
|
2319
|
+
post: async (ctx, path, body) => {
|
|
2320
|
+
const response = await ctx.request(
|
|
2321
|
+
authorize({ body, method: "POST", url: buildUrl(baseUrl, path) })
|
|
2322
|
+
);
|
|
2323
|
+
return response.body;
|
|
2324
|
+
},
|
|
2325
|
+
raw: { authorize, baseUrl, isRead, isSecret },
|
|
2326
|
+
readTags: options.readTags
|
|
2327
|
+
};
|
|
2328
|
+
};
|
|
2329
|
+
|
|
2330
|
+
// src/instantly/index.ts
|
|
2331
|
+
var PROVIDER = "instantly";
|
|
2332
|
+
var envVars = [API_KEY_ENV, WORKSPACE_ENV];
|
|
2333
|
+
var instantly = (options = {}) => {
|
|
2334
|
+
const apiKey = requireCredential(options.apiKey, API_KEY_ENV, PROVIDER);
|
|
2335
|
+
const workspaceId = assertWorkspaceId(
|
|
2336
|
+
options.workspaceId ?? readEnv(WORKSPACE_ENV) ?? "default",
|
|
2337
|
+
PROVIDER
|
|
2338
|
+
);
|
|
2339
|
+
const declared = { ...capabilities, ...options.capabilities };
|
|
2340
|
+
const client = createClient({
|
|
2341
|
+
apiKey,
|
|
2342
|
+
asWorkspace: options.asWorkspace,
|
|
2343
|
+
baseUrl: options.baseUrl,
|
|
2344
|
+
identity: { provider: PROVIDER, workspaceId },
|
|
2345
|
+
readTags: declared.tags === true
|
|
2346
|
+
});
|
|
2347
|
+
return {
|
|
2348
|
+
...readers(client),
|
|
2349
|
+
capabilities: declared,
|
|
2350
|
+
caveats,
|
|
2351
|
+
costs,
|
|
2352
|
+
events: instantlyEvents(PROVIDER),
|
|
2353
|
+
limits,
|
|
2354
|
+
// Instantly answers 402 when the plan does not include the endpoint.
|
|
2355
|
+
mapError: makeErrorMapper(PROVIDER, {
|
|
2356
|
+
secrets: [apiKey],
|
|
2357
|
+
statusCodes: { 402: "Unsupported" }
|
|
2358
|
+
}),
|
|
2359
|
+
maturity: "beta",
|
|
2360
|
+
name: PROVIDER,
|
|
2361
|
+
native: NATIVE,
|
|
2362
|
+
raw: client.raw,
|
|
2363
|
+
secrets: [apiKey],
|
|
2364
|
+
workspaceId
|
|
2365
|
+
};
|
|
2366
|
+
};
|
|
2367
|
+
export {
|
|
2368
|
+
NATIVE,
|
|
2369
|
+
PROVIDER,
|
|
2370
|
+
envVars,
|
|
2371
|
+
instantly
|
|
2372
|
+
};
|