yirlo 0.0.0-stage → 1.2.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/README.md +44 -2
- package/dash.js +153 -0
- package/mcp.js +24 -0
- package/package.json +31 -3
- package/yirlo.js +210 -0
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Yirlo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run Yirlo, the AI outbound agent for B2B companies, from code or an AI agent: projects, campaigns, budgets, the inbox and replies, hot leads, webhooks and your team.
|
|
4
|
+
|
|
5
|
+
Get an API key at https://yirlo.com/app/api-keys. Full API docs: https://yirlo.com/api-docs
|
|
6
|
+
|
|
7
|
+
## SDK
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { Yirlo } from "yirlo";
|
|
11
|
+
const y = new Yirlo(process.env.YIRLO_API_KEY);
|
|
12
|
+
const me = await y.getAccount();
|
|
13
|
+
const { campaigns } = await y.listCampaigns({ project_id: me.projects[0].id });
|
|
14
|
+
const hot = await y.listHotLeads();
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Errors throw `YirloError` with `status` and `body`.
|
|
18
|
+
|
|
19
|
+
## Dashboard in your terminal
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
YIRLO_API_KEY=yk_live_... npx yirlo dash
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
One screen per project: replies that need you, hot leads, emails sent in the last 7 days, the running campaigns and the latest replies. `--watch` redraws it every minute, `--project acme.com` shows one project, `--plain` drops the colors.
|
|
26
|
+
|
|
27
|
+
Several accounts, or only some projects: put them in `~/.yirlo/dash.json`
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{ "accounts": [ { "name": "Main", "key": "yk_live_...", "projects": ["acme.com"] } ] }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## MCP server
|
|
34
|
+
|
|
35
|
+
Remote (recommended): add `https://yirlo.com/mcp` with the header `Authorization: Bearer <YIRLO_API_KEY>`.
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
claude mcp add --transport http yirlo https://yirlo.com/mcp --header "Authorization: Bearer $YIRLO_API_KEY"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Local (stdio), for apps that only run local servers:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{ "mcpServers": { "yirlo": { "command": "npx", "args": ["-y", "yirlo-mcp"], "env": { "YIRLO_API_KEY": "yk_live_..." } } } }
|
|
45
|
+
```
|
package/dash.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// yirlo dash: your outreach at a glance, in the terminal. Read-only: it only reads your account through the Yirlo API.
|
|
3
|
+
// npx yirlo dash (YIRLO_API_KEY=yk_live_... in the environment, or a config file, below)
|
|
4
|
+
// npx yirlo dash --watch (redraws every 60 s; --watch 30 for 30 s)
|
|
5
|
+
// npx yirlo dash --project scrapercity.com --plain
|
|
6
|
+
// Config, for several accounts or only some projects: ~/.yirlo/dash.json (or YIRLO_DASH_CONFIG=<file>)
|
|
7
|
+
// { "accounts": [ { "name": "Main", "key": "yk_live_...", "projects": ["scrapercity.com", "yirlo.com"] } ] }
|
|
8
|
+
// "projects" is optional (all of them when left out). Times are your computer's time zone (TZ=America/Chicago for another).
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { Yirlo } from "./yirlo.js";
|
|
13
|
+
|
|
14
|
+
const argv = process.argv.slice(2).filter(a => a !== "dash");
|
|
15
|
+
const flag = n => argv.includes(`--${n}`);
|
|
16
|
+
const opt = n => { const i = argv.indexOf(`--${n}`); return i >= 0 && argv[i + 1] && !argv[i + 1].startsWith("--") ? argv[i + 1] : null; };
|
|
17
|
+
if (flag("help") || flag("h")) {
|
|
18
|
+
console.log(`yirlo dash: your Yirlo outreach at a glance.
|
|
19
|
+
|
|
20
|
+
npx yirlo dash one screen, then exit
|
|
21
|
+
npx yirlo dash --watch [sec] redraw every 60 s (or every sec)
|
|
22
|
+
npx yirlo dash --project <domain> only that project
|
|
23
|
+
npx yirlo dash --plain no colors
|
|
24
|
+
|
|
25
|
+
Key: YIRLO_API_KEY=yk_live_... (https://yirlo.com/app/api-keys), or ~/.yirlo/dash.json:
|
|
26
|
+
{ "accounts": [ { "name": "Main", "key": "yk_live_...", "projects": ["acme.com"] } ] }`);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
const PLAIN = flag("plain") || !!process.env.NO_COLOR || !process.stdout.isTTY && !flag("color");
|
|
30
|
+
const BASE = process.env.YIRLO_BASE_URL || "https://yirlo.com";
|
|
31
|
+
const HOME = path.join(os.homedir(), ".yirlo");
|
|
32
|
+
const CONF = process.env.YIRLO_DASH_CONFIG || path.join(HOME, "dash.json");
|
|
33
|
+
const SEEN = path.join(HOME, "dash-seen.json");
|
|
34
|
+
|
|
35
|
+
function accounts() {
|
|
36
|
+
let c = null;
|
|
37
|
+
try { c = JSON.parse(fs.readFileSync(CONF, "utf8")); } catch (e) { if (fs.existsSync(CONF)) { console.error(`Could not read ${CONF}: ${e.message}`); process.exit(1); } }
|
|
38
|
+
let list = (c && c.accounts) || [];
|
|
39
|
+
if (!list.length && process.env.YIRLO_API_KEY) list = [{ name: "", key: process.env.YIRLO_API_KEY }];
|
|
40
|
+
if (!list.length) { console.error("No API key. Get one at https://yirlo.com/app/api-keys, then: YIRLO_API_KEY=yk_live_... npx yirlo dash"); process.exit(1); }
|
|
41
|
+
const only = opt("project");
|
|
42
|
+
return list.map(a => ({ ...a, projects: only ? [only] : a.projects }));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ---------- drawing (color for state only; one narrow column that fits a phone)
|
|
46
|
+
const C = (code, x) => PLAIN ? String(x) : `\x1b[${code}m${x}\x1b[0m`;
|
|
47
|
+
const green = x => C("32", x), red = x => C("31", x), yellow = x => C("33", x), blue = x => C("34", x), purple = x => C("35", x), dim = x => C("2", x), orange = x => C("38;5;208", x), bold = x => C("1", x);
|
|
48
|
+
const vis = x => String(x).replace(/\x1b\[[0-9;]*m/g, "");
|
|
49
|
+
const fit = (x, n) => { const v = vis(x); if (v.length <= n) return x + " ".repeat(n - v.length); return v.slice(0, n - 1) + "."; };
|
|
50
|
+
const now = () => Date.now();
|
|
51
|
+
const DAY = 864e5;
|
|
52
|
+
const time = t => new Date(t).toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
53
|
+
const date = t => new Date(t).toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" }).replace(",", "");
|
|
54
|
+
const short = t => Math.abs((t - now()) / DAY) < 6 ? new Date(t).toLocaleDateString("en-US", { weekday: "short" }) : new Date(t).toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
55
|
+
const stamp = t => `${fit(short(t), 6)}${time(t).padStart(8)}`;
|
|
56
|
+
const nm = n => { n = String(n || "?").trim(); if (n.length <= 14) return n; const w = n.split(/\s+/); return w.length > 1 ? `${w[0]} ${w[w.length - 1][0]}.` : n; };
|
|
57
|
+
const money = v => `$${Number(v || 0).toFixed(2)}`;
|
|
58
|
+
const INTENT = (c) => {
|
|
59
|
+
const i = c.latest_user_intent || c.latest_intent || "";
|
|
60
|
+
if (i === "hot_lead" || c.lead_temperature === "hot") return orange("hot lead");
|
|
61
|
+
if (c.needs_reply) return red("needs reply");
|
|
62
|
+
if (i === "out_of_office") return purple("out of office");
|
|
63
|
+
if (i === "not_interested") return dim("not interested");
|
|
64
|
+
if (i === "unsubscribe") return dim("unsubscribed");
|
|
65
|
+
if (/auto/i.test(i)) return dim("auto-reply");
|
|
66
|
+
return blue("reply");
|
|
67
|
+
};
|
|
68
|
+
const STATUS = c => {
|
|
69
|
+
const d = c.status_display || {};
|
|
70
|
+
if (c.status === "running" && d.sending_paused_by_budget) return yellow("●");
|
|
71
|
+
if (c.status === "running") return green("●");
|
|
72
|
+
if (d.tone === "danger" || d.tone === "error") return red("●");
|
|
73
|
+
return dim("○");
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
async function load(acct) {
|
|
77
|
+
const y = new Yirlo(acct.key, { baseUrl: BASE });
|
|
78
|
+
const [me, list] = await Promise.all([y.getAccount(), y.listProjects()]);
|
|
79
|
+
const want = acct.projects && acct.projects.length ? new Set(acct.projects.map(d => String(d).toLowerCase())) : null;
|
|
80
|
+
const projects = (list.projects || []).filter(p => !p.archived && (!want || want.has(String(p.domain).toLowerCase()) || want.has(String(p.id))));
|
|
81
|
+
const rows = await Promise.all(projects.map(async p => {
|
|
82
|
+
const [an, inbox, hot] = await Promise.all([
|
|
83
|
+
y.projectAnalytics({ project_id: p.id }).catch(() => null),
|
|
84
|
+
y.listInbox({ project_id: p.id, tab: "all" }).catch(() => ({ contacts: [] })),
|
|
85
|
+
y.listInbox({ project_id: p.id, tab: "need_reply" }).catch(() => ({ contacts: [], total_count: 0 })),
|
|
86
|
+
]);
|
|
87
|
+
return { p, an, inbox: inbox.contacts || [], needReply: hot.total_count ?? (hot.contacts || []).length };
|
|
88
|
+
}));
|
|
89
|
+
return { acct, me, rows };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function draw(all, seen) {
|
|
93
|
+
const L = [];
|
|
94
|
+
const last = seen && seen.at ? Date.parse(seen.at) : null;
|
|
95
|
+
let fresh = 0;
|
|
96
|
+
L.push("");
|
|
97
|
+
L.push(` ${bold("Yirlo")} ${dim(`${date(now())} ${time(now())}`)}`);
|
|
98
|
+
for (const a of all) {
|
|
99
|
+
if (a.error) { L.push(""); L.push(red(` ${a.acct.name || "Account"}: ${a.error}`)); continue; }
|
|
100
|
+
const bal = a.me.balance_usd ?? 0;
|
|
101
|
+
L.push("");
|
|
102
|
+
L.push(` ${a.acct.name ? bold(a.acct.name) + " " : ""}${dim(a.me.email || "")}`);
|
|
103
|
+
L.push(` credit ${bal < 2 ? yellow(money(bal)) : green(money(bal))}`);
|
|
104
|
+
const replies = [];
|
|
105
|
+
for (const r of a.rows) {
|
|
106
|
+
const an = r.an || {};
|
|
107
|
+
const cs = an.campaign_rollup || [];
|
|
108
|
+
const daily = c => parseInt(String((c.status_display || {}).detail || "").match(/(\d+) emails a day/)?.[1] || "0", 10);
|
|
109
|
+
// sending = running with emails going out; the rest of the running ones wait their turn for sending room
|
|
110
|
+
const running = cs.filter(c => c.status === "running" && (daily(c) > 0 || (c.emails_sent_7d || 0) > 0));
|
|
111
|
+
const waiting = cs.filter(c => c.status === "running").length - running.length;
|
|
112
|
+
const perDay = running.reduce((s, c) => s + daily(c), 0);
|
|
113
|
+
const health = !running.length ? dim("● paused") : running.some(c => (c.status_display || {}).sending_paused_by_budget) ? yellow("● budget reached") : green("● sending");
|
|
114
|
+
L.push("");
|
|
115
|
+
L.push(` ${bold(r.p.company_name || r.p.domain)} ${health}`);
|
|
116
|
+
const big = (n, label, extra, color) => ` ${color(String(n).padStart(4))} ${fit(label, 13)}${extra}`;
|
|
117
|
+
L.push(big(r.needReply, "need a reply", r.needReply ? red("see below") : "", r.needReply ? red : green));
|
|
118
|
+
L.push(big(an.total_hot_leads ?? 0, "hot leads", an.total_hot_leads_today ? orange(`${an.total_hot_leads_today} today`) : "", (an.total_hot_leads ?? 0) ? orange : dim));
|
|
119
|
+
L.push(big(an.total_emails_sent ?? 0, "sent 7 days", dim(perDay ? `${perDay} a day now` : ""), blue));
|
|
120
|
+
L.push(big(an.total_replies ?? 0, "replies", dim(`${an.overall_reply_rate_pct ?? 0}%${an.total_bounced ? `, ${an.total_bounced} bounced` : ""}`), blue));
|
|
121
|
+
L.push(big(running.length, "sending", dim(`${waiting ? `${waiting} waiting, ` : ""}${cs.length} campaigns`), running.length ? green : dim));
|
|
122
|
+
for (const c of [...running].sort((x, z) => (z.emails_sent || 0) - (x.emails_sent || 0)).slice(0, 4))
|
|
123
|
+
L.push(` ${STATUS(c)} ${fit(c.campaign_name, 24)} ${dim(String(c.emails_sent || 0).padStart(4) + " sent")}${c.hot_leads ? orange(` ${c.hot_leads} hot`) : c.total_replies ? blue(` ${c.total_replies} rep`) : ""}`);
|
|
124
|
+
if (running.length > 4) L.push(dim(` +${running.length - 4} more sending`));
|
|
125
|
+
for (const c of r.inbox) if (c.latest_reply_at) replies.push({ ...c, t: Date.parse(c.latest_reply_at), project: r.p.company_name || r.p.domain });
|
|
126
|
+
}
|
|
127
|
+
replies.sort((x, z) => z.t - x.t);
|
|
128
|
+
const many = a.rows.length > 1;
|
|
129
|
+
L.push("");
|
|
130
|
+
L.push(" Latest replies");
|
|
131
|
+
if (!replies.length) L.push(dim(" none yet"));
|
|
132
|
+
for (const c of replies.slice(0, 8)) {
|
|
133
|
+
const isNew = last && c.t > last;
|
|
134
|
+
if (isNew) fresh++;
|
|
135
|
+
L.push(`${isNew ? orange("●") : " "} ${dim(stamp(c.t))} ${fit(nm(c.lead_name || c.reply_from_name || c.to_email), 14)} ${INTENT(c)}${many ? dim(" " + String(c.project).slice(0, 12)) : ""}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (last) L.splice(2, 0, ` ${fresh ? orange(`● ${fresh} new since ${time(last)}`) : dim("nothing new")}`);
|
|
139
|
+
L.push("");
|
|
140
|
+
return L.join("\n") + "\n";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let seen = null; try { seen = JSON.parse(fs.readFileSync(SEEN, "utf8")); } catch {}
|
|
144
|
+
let marked = false; // "new" = since the last time you opened it (a --watch redraw keeps that mark)
|
|
145
|
+
async function once() {
|
|
146
|
+
const all = await Promise.all(accounts().map(a => load(a).catch(e => ({ acct: a, error: e.status === 401 ? "that API key is not valid" : e.message }))));
|
|
147
|
+
process.stdout.write((PLAIN ? "" : "\x1b[H\x1b[2J") + draw(all, seen));
|
|
148
|
+
if (!marked) { marked = true; try { fs.mkdirSync(HOME, { recursive: true }); fs.writeFileSync(SEEN, JSON.stringify({ at: new Date().toISOString() })); } catch {} }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const w = flag("watch") ? Math.max(15, parseInt(opt("watch") || "60", 10) || 60) : 0;
|
|
152
|
+
await once();
|
|
153
|
+
if (w) setInterval(() => once().catch(e => console.error(e.message)), w * 1000);
|
package/mcp.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// yirlo-mcp: Yirlo's MCP server for clients that run local (stdio) servers. Every message goes to https://yirlo.com/mcp
|
|
3
|
+
// with your key. Set YIRLO_API_KEY (https://yirlo.com/app/api-keys).
|
|
4
|
+
import { createInterface } from "node:readline";
|
|
5
|
+
const key = process.env.YIRLO_API_KEY;
|
|
6
|
+
const url = process.env.YIRLO_MCP_URL || "https://yirlo.com/mcp";
|
|
7
|
+
if (!key) { process.stderr.write("Set YIRLO_API_KEY (get one at https://yirlo.com/app/api-keys)\n"); process.exit(1); }
|
|
8
|
+
const rl = createInterface({ input: process.stdin });
|
|
9
|
+
let pending = 0, closed = false;
|
|
10
|
+
const done = () => { if (closed && !pending) process.exit(0); };
|
|
11
|
+
rl.on("line", async (line) => {
|
|
12
|
+
if (!line.trim()) return;
|
|
13
|
+
let msg; try { msg = JSON.parse(line); } catch { return; }
|
|
14
|
+
pending++;
|
|
15
|
+
try {
|
|
16
|
+
const r = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json, text/event-stream", Authorization: `Bearer ${key}`, "User-Agent": "yirlo-mcp/1.0" }, body: JSON.stringify(msg) });
|
|
17
|
+
const t = await r.text();
|
|
18
|
+
if (t.trim()) process.stdout.write(t.trim() + "\n");
|
|
19
|
+
else if (r.status >= 400 && msg.id != null) process.stdout.write(JSON.stringify({ jsonrpc: "2.0", id: msg.id, error: { code: -32000, message: `HTTP ${r.status}` } }) + "\n");
|
|
20
|
+
} catch (e) {
|
|
21
|
+
if (msg.id != null) process.stdout.write(JSON.stringify({ jsonrpc: "2.0", id: msg.id, error: { code: -32000, message: String(e.message || e) } }) + "\n");
|
|
22
|
+
} finally { pending--; done(); }
|
|
23
|
+
});
|
|
24
|
+
rl.on("close", () => { closed = true; done(); });
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yirlo",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Yirlo SDK, MCP server and terminal dashboard: run your AI cold email outreach (projects, campaigns, inbox, hot leads, budgets) from code, an AI agent or your terminal.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "yirlo.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./yirlo.js"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"yirlo": "dash.js",
|
|
12
|
+
"yirlo-mcp": "mcp.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"yirlo.js",
|
|
16
|
+
"mcp.js",
|
|
17
|
+
"dash.js",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://yirlo.com/api-docs",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"yirlo",
|
|
26
|
+
"cold email",
|
|
27
|
+
"outbound",
|
|
28
|
+
"lead generation",
|
|
29
|
+
"mcp",
|
|
30
|
+
"ai agent",
|
|
31
|
+
"sdk"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT"
|
|
6
34
|
}
|
package/yirlo.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// Yirlo SDK for JavaScript (Node 18+ and browsers with fetch). https://yirlo.com/sdk/yirlo.js
|
|
2
|
+
// Every method is one call to https://yirlo.com/public/api/v1 (docs: https://yirlo.com/api-docs).
|
|
3
|
+
// Usage: import { Yirlo } from "./yirlo.js"; const y = new Yirlo(process.env.YIRLO_API_KEY); console.log(await y.getAccount());
|
|
4
|
+
export class YirloError extends Error { constructor(status, body) { super((body && body.detail) || `HTTP ${status}`); this.status = status; this.body = body; } }
|
|
5
|
+
export class Yirlo {
|
|
6
|
+
constructor(apiKey, { baseUrl = "https://yirlo.com" } = {}) { if (!apiKey) throw new Error("Pass your Yirlo API key (https://yirlo.com/app/api-keys)"); this.apiKey = apiKey; this.baseUrl = baseUrl.replace(/\/$/, ""); }
|
|
7
|
+
async request(method, path, { query, body } = {}) {
|
|
8
|
+
const qs = query && Object.keys(query).length ? "?" + new URLSearchParams(Object.entries(query).filter(([, v]) => v != null)) : "";
|
|
9
|
+
const r = await fetch(this.baseUrl + "/public/api/v1" + path + qs, { method, headers: { "X-API-Key": this.apiKey, "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : (method === "GET" ? undefined : "{}") });
|
|
10
|
+
const t = await r.text(); const j = t ? JSON.parse(t) : {}; if (!r.ok) throw new YirloError(r.status, j); return j;
|
|
11
|
+
}
|
|
12
|
+
/** Who this API key is: email, credit balance and projects. A good first call. Arguments: none. */
|
|
13
|
+
getAccount(args = {}) {
|
|
14
|
+
const a = { ...args }; for (const k of []) if (a[k] == null) throw new Error(`get_account: ${k} is required`);
|
|
15
|
+
const path = "/me";
|
|
16
|
+
return this.request("GET", path);
|
|
17
|
+
}
|
|
18
|
+
/** Credit balance (1 credit = $0.01). Arguments: none. */
|
|
19
|
+
getBalance(args = {}) {
|
|
20
|
+
const a = { ...args }; for (const k of []) if (a[k] == null) throw new Error(`get_balance: ${k} is required`);
|
|
21
|
+
const path = "/billing/balance";
|
|
22
|
+
return this.request("GET", path);
|
|
23
|
+
}
|
|
24
|
+
/** Every outreach project on the account. Arguments: none. */
|
|
25
|
+
listProjects(args = {}) {
|
|
26
|
+
const a = { ...args }; for (const k of []) if (a[k] == null) throw new Error(`list_projects: ${k} is required`);
|
|
27
|
+
const path = "/agentapp/projects";
|
|
28
|
+
return this.request("GET", path);
|
|
29
|
+
}
|
|
30
|
+
/** Create a project from a company website (or, with no website, from what it sells, to whom and where). Answers at once with the project id and status creating; Yirlo analyses the company in about 1-2 minutes, then get_project shows status ready and its campaigns are paused until you start one. Arguments: domain?, no_website?, sender_name?. */
|
|
31
|
+
createProject(args = {}) {
|
|
32
|
+
const a = { ...args }; for (const k of []) if (a[k] == null) throw new Error(`create_project: ${k} is required`);
|
|
33
|
+
const path = "/agentapp/projects";
|
|
34
|
+
return this.request("POST", path, { body: a });
|
|
35
|
+
}
|
|
36
|
+
/** One project: company, settings, campaigns. For a project from create_project: status creating, ready or failed (with failure_reason and next_step). Arguments: project_id. */
|
|
37
|
+
getProject(args = {}) {
|
|
38
|
+
const a = { ...args }; for (const k of ["project_id"]) if (a[k] == null) throw new Error(`get_project: ${k} is required`);
|
|
39
|
+
const path = "/agentapp/projects/{project_id}".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
40
|
+
return this.request("GET", path);
|
|
41
|
+
}
|
|
42
|
+
/** Emails sent, replies and hot leads for a project. Arguments: project_id. */
|
|
43
|
+
projectAnalytics(args = {}) {
|
|
44
|
+
const a = { ...args }; for (const k of ["project_id"]) if (a[k] == null) throw new Error(`project_analytics: ${k} is required`);
|
|
45
|
+
const path = "/agentapp/projects/{project_id}/analytics".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
46
|
+
return this.request("GET", path);
|
|
47
|
+
}
|
|
48
|
+
/** Daily budget and monthly cap. Arguments: project_id. */
|
|
49
|
+
getProjectBudget(args = {}) {
|
|
50
|
+
const a = { ...args }; for (const k of ["project_id"]) if (a[k] == null) throw new Error(`get_project_budget: ${k} is required`);
|
|
51
|
+
const path = "/agentapp/projects/{project_id}/budget".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
52
|
+
return this.request("GET", path);
|
|
53
|
+
}
|
|
54
|
+
/** Set the project daily budget in USD. Arguments: project_id, daily_budget_usd. */
|
|
55
|
+
setProjectBudget(args = {}) {
|
|
56
|
+
const a = { ...args }; for (const k of ["project_id", "daily_budget_usd"]) if (a[k] == null) throw new Error(`set_project_budget: ${k} is required`);
|
|
57
|
+
const path = "/agentapp/projects/{project_id}/budget".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
58
|
+
return this.request("PATCH", path, { body: a });
|
|
59
|
+
}
|
|
60
|
+
/** Campaigns (audiences), optionally for one project. Arguments: project_id?. */
|
|
61
|
+
listCampaigns(args = {}) {
|
|
62
|
+
const a = { ...args }; for (const k of []) if (a[k] == null) throw new Error(`list_campaigns: ${k} is required`);
|
|
63
|
+
const path = "/agentapp/campaigns";
|
|
64
|
+
return this.request("GET", path, { query: a });
|
|
65
|
+
}
|
|
66
|
+
/** One campaign: audience, targeting and email instructions. Arguments: campaign_id. */
|
|
67
|
+
getCampaign(args = {}) {
|
|
68
|
+
const a = { ...args }; for (const k of ["campaign_id"]) if (a[k] == null) throw new Error(`get_campaign: ${k} is required`);
|
|
69
|
+
const path = "/agentapp/campaigns/{campaign_id}".replace("{campaign_id}", encodeURIComponent(a.campaign_id)); delete a.campaign_id;
|
|
70
|
+
return this.request("GET", path);
|
|
71
|
+
}
|
|
72
|
+
/** Create a campaign from a name that describes the people to reach, e.g. "Heads of support at Shopify fashion brands". Takes about 30 seconds. Arguments: project_id, name, target_geo?. */
|
|
73
|
+
createCampaign(args = {}) {
|
|
74
|
+
const a = { ...args }; for (const k of ["project_id", "name"]) if (a[k] == null) throw new Error(`create_campaign: ${k} is required`);
|
|
75
|
+
const path = "/agentapp/campaigns";
|
|
76
|
+
return this.request("POST", path, { body: a });
|
|
77
|
+
}
|
|
78
|
+
/** Start (resume) a campaign. Arguments: campaign_id. */
|
|
79
|
+
startCampaign(args = {}) {
|
|
80
|
+
const a = { ...args }; for (const k of ["campaign_id"]) if (a[k] == null) throw new Error(`start_campaign: ${k} is required`);
|
|
81
|
+
const path = "/agentapp/campaigns/{campaign_id}/start".replace("{campaign_id}", encodeURIComponent(a.campaign_id)); delete a.campaign_id;
|
|
82
|
+
return this.request("POST", path);
|
|
83
|
+
}
|
|
84
|
+
/** Pause a campaign. Arguments: campaign_id. */
|
|
85
|
+
stopCampaign(args = {}) {
|
|
86
|
+
const a = { ...args }; for (const k of ["campaign_id"]) if (a[k] == null) throw new Error(`stop_campaign: ${k} is required`);
|
|
87
|
+
const path = "/agentapp/campaigns/{campaign_id}/stop".replace("{campaign_id}", encodeURIComponent(a.campaign_id)); delete a.campaign_id;
|
|
88
|
+
return this.request("POST", path);
|
|
89
|
+
}
|
|
90
|
+
/** Archive a campaign. Arguments: campaign_id. */
|
|
91
|
+
archiveCampaign(args = {}) {
|
|
92
|
+
const a = { ...args }; for (const k of ["campaign_id"]) if (a[k] == null) throw new Error(`archive_campaign: ${k} is required`);
|
|
93
|
+
const path = "/agentapp/campaigns/{campaign_id}/archive".replace("{campaign_id}", encodeURIComponent(a.campaign_id)); delete a.campaign_id;
|
|
94
|
+
return this.request("POST", path);
|
|
95
|
+
}
|
|
96
|
+
/** Set a campaign daily limit in USD. Arguments: campaign_id, daily_limit_usd. */
|
|
97
|
+
setCampaignBudget(args = {}) {
|
|
98
|
+
const a = { ...args }; for (const k of ["campaign_id", "daily_limit_usd"]) if (a[k] == null) throw new Error(`set_campaign_budget: ${k} is required`);
|
|
99
|
+
const path = "/agentapp/campaigns/{campaign_id}/budget".replace("{campaign_id}", encodeURIComponent(a.campaign_id)); delete a.campaign_id;
|
|
100
|
+
return this.request("PATCH", path, { body: a });
|
|
101
|
+
}
|
|
102
|
+
/** Leads found, contacted, replied, hot, bounced for a campaign. Arguments: campaign_id. */
|
|
103
|
+
campaignAnalytics(args = {}) {
|
|
104
|
+
const a = { ...args }; for (const k of ["campaign_id"]) if (a[k] == null) throw new Error(`campaign_analytics: ${k} is required`);
|
|
105
|
+
const path = "/agentapp/campaigns/{campaign_id}/analytics".replace("{campaign_id}", encodeURIComponent(a.campaign_id)); delete a.campaign_id;
|
|
106
|
+
return this.request("GET", path);
|
|
107
|
+
}
|
|
108
|
+
/** Interested replies (hot leads), optionally for one project. Arguments: project_id?. */
|
|
109
|
+
listHotLeads(args = {}) {
|
|
110
|
+
const a = { ...args }; for (const k of []) if (a[k] == null) throw new Error(`list_hot_leads: ${k} is required`);
|
|
111
|
+
const path = "/agentapp/hot-leads";
|
|
112
|
+
return this.request("GET", path, { query: a });
|
|
113
|
+
}
|
|
114
|
+
/** Conversations in a project inbox. tab: need_reply, hot, all or replied. Arguments: project_id, tab?. */
|
|
115
|
+
listInbox(args = {}) {
|
|
116
|
+
const a = { ...args }; for (const k of ["project_id"]) if (a[k] == null) throw new Error(`list_inbox: ${k} is required`);
|
|
117
|
+
const path = "/agentapp/projects/{project_id}/inbox".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
118
|
+
return this.request("GET", path, { query: a });
|
|
119
|
+
}
|
|
120
|
+
/** The full thread with one lead. Arguments: campaign_id, person_id. */
|
|
121
|
+
readConversation(args = {}) {
|
|
122
|
+
const a = { ...args }; for (const k of ["campaign_id", "person_id"]) if (a[k] == null) throw new Error(`read_conversation: ${k} is required`);
|
|
123
|
+
const path = "/agentapp/campaigns/{campaign_id}/inbox/{person_id}".replace("{campaign_id}", encodeURIComponent(a.campaign_id)).replace("{person_id}", encodeURIComponent(a.person_id)); delete a.campaign_id; delete a.person_id;
|
|
124
|
+
return this.request("GET", path);
|
|
125
|
+
}
|
|
126
|
+
/** Send a reply to a lead in a thread. This sends a real email. Arguments: campaign_id, person_id, body_text. */
|
|
127
|
+
reply(args = {}) {
|
|
128
|
+
const a = { ...args }; for (const k of ["campaign_id", "person_id", "body_text"]) if (a[k] == null) throw new Error(`reply: ${k} is required`);
|
|
129
|
+
const path = "/agentapp/campaigns/{campaign_id}/inbox/{person_id}/reply".replace("{campaign_id}", encodeURIComponent(a.campaign_id)).replace("{person_id}", encodeURIComponent(a.person_id)); delete a.campaign_id; delete a.person_id;
|
|
130
|
+
return this.request("POST", path, { body: a });
|
|
131
|
+
}
|
|
132
|
+
/** Set the note on a lead. Arguments: campaign_id, person_id, note. */
|
|
133
|
+
setLeadNote(args = {}) {
|
|
134
|
+
const a = { ...args }; for (const k of ["campaign_id", "person_id", "note"]) if (a[k] == null) throw new Error(`set_lead_note: ${k} is required`);
|
|
135
|
+
const path = "/agentapp/campaigns/{campaign_id}/inbox/{person_id}/note".replace("{campaign_id}", encodeURIComponent(a.campaign_id)).replace("{person_id}", encodeURIComponent(a.person_id)); delete a.campaign_id; delete a.person_id;
|
|
136
|
+
return this.request("POST", path, { body: a });
|
|
137
|
+
}
|
|
138
|
+
/** Set a lead's deal status. Arguments: campaign_id, person_id, status. */
|
|
139
|
+
setLeadStatus(args = {}) {
|
|
140
|
+
const a = { ...args }; for (const k of ["campaign_id", "person_id", "status"]) if (a[k] == null) throw new Error(`set_lead_status: ${k} is required`);
|
|
141
|
+
const path = "/agentapp/campaigns/{campaign_id}/inbox/{person_id}/status".replace("{campaign_id}", encodeURIComponent(a.campaign_id)).replace("{person_id}", encodeURIComponent(a.person_id)); delete a.campaign_id; delete a.person_id;
|
|
142
|
+
return this.request("POST", path, { body: a });
|
|
143
|
+
}
|
|
144
|
+
/** Never email these addresses (every project). Arguments: emails, list_name?. */
|
|
145
|
+
suppressEmails(args = {}) {
|
|
146
|
+
const a = { ...args }; for (const k of ["emails"]) if (a[k] == null) throw new Error(`suppress_emails: ${k} is required`);
|
|
147
|
+
const path = "/agentapp/suppress-list/people";
|
|
148
|
+
return this.request("POST", path, { body: a });
|
|
149
|
+
}
|
|
150
|
+
/** Never email anyone at these company domains (every project). Arguments: domains, list_name?. */
|
|
151
|
+
suppressDomains(args = {}) {
|
|
152
|
+
const a = { ...args }; for (const k of ["domains"]) if (a[k] == null) throw new Error(`suppress_domains: ${k} is required`);
|
|
153
|
+
const path = "/agentapp/suppress-list/companies";
|
|
154
|
+
return this.request("POST", path, { body: a });
|
|
155
|
+
}
|
|
156
|
+
/** Webhooks for a project (events: reply.received, hot_lead.received). Arguments: project_id?. */
|
|
157
|
+
listWebhooks(args = {}) {
|
|
158
|
+
const a = { ...args }; for (const k of []) if (a[k] == null) throw new Error(`list_webhooks: ${k} is required`);
|
|
159
|
+
const path = "/agentapp/webhooks";
|
|
160
|
+
return this.request("GET", path, { query: a });
|
|
161
|
+
}
|
|
162
|
+
/** Add an https webhook to a project. Arguments: project_id, url, events?. */
|
|
163
|
+
addWebhook(args = {}) {
|
|
164
|
+
const a = { ...args }; for (const k of ["project_id", "url"]) if (a[k] == null) throw new Error(`add_webhook: ${k} is required`);
|
|
165
|
+
const path = "/agentapp/webhooks";
|
|
166
|
+
const q = { project_id: a.project_id }; delete a.project_id; return this.request("POST", path, { query: q, body: a });
|
|
167
|
+
}
|
|
168
|
+
/** Send one signed sample event to a webhook. Arguments: project_id, webhook_id. */
|
|
169
|
+
testWebhook(args = {}) {
|
|
170
|
+
const a = { ...args }; for (const k of ["project_id", "webhook_id"]) if (a[k] == null) throw new Error(`test_webhook: ${k} is required`);
|
|
171
|
+
const path = "/agentapp/webhooks/{webhook_id}/test".replace("{webhook_id}", encodeURIComponent(a.webhook_id)); delete a.webhook_id;
|
|
172
|
+
return this.request("POST", path, { query: a });
|
|
173
|
+
}
|
|
174
|
+
/** Create a campaign from your own leads (up to 30,000). Each lead needs email, first_name, last_name, company_domain and job_title (linkedin_url optional). Answers with a task_id; check it with get_import. Every lead is emailed only after its address passes the email check. Arguments: project_id, name, leads, instructions?. */
|
|
175
|
+
importLeads(args = {}) {
|
|
176
|
+
const a = { ...args }; for (const k of ["project_id", "name", "leads"]) if (a[k] == null) throw new Error(`import_leads: ${k} is required`);
|
|
177
|
+
const path = "/agentapp/campaigns/import";
|
|
178
|
+
return this.request("POST", path, { body: a });
|
|
179
|
+
}
|
|
180
|
+
/** Status and result of import_leads: pending, completed (with campaign_id and counts) or failed. Arguments: task_id. */
|
|
181
|
+
getImport(args = {}) {
|
|
182
|
+
const a = { ...args }; for (const k of ["task_id"]) if (a[k] == null) throw new Error(`get_import: ${k} is required`);
|
|
183
|
+
const path = "/agentapp/campaigns/import/{task_id}".replace("{task_id}", encodeURIComponent(a.task_id)); delete a.task_id;
|
|
184
|
+
return this.request("GET", path);
|
|
185
|
+
}
|
|
186
|
+
/** Import the people who commented on or replied to one of your LinkedIn or X posts: Yirlo finds their work emails and starts a campaign for them (each email is checked before it is sent). Check progress with list_posts. Arguments: project_id, url, sell?. */
|
|
187
|
+
leadsFromPost(args = {}) {
|
|
188
|
+
const a = { ...args }; for (const k of ["project_id", "url"]) if (a[k] == null) throw new Error(`leads_from_post: ${k} is required`);
|
|
189
|
+
const path = "/agentapp/projects/{project_id}/posts".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
190
|
+
return this.request("POST", path, { body: a });
|
|
191
|
+
}
|
|
192
|
+
/** Your posts and their progress: reading the post, finding emails, campaign running. Arguments: project_id. */
|
|
193
|
+
listPosts(args = {}) {
|
|
194
|
+
const a = { ...args }; for (const k of ["project_id"]) if (a[k] == null) throw new Error(`list_posts: ${k} is required`);
|
|
195
|
+
const path = "/agentapp/projects/{project_id}/posts".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
196
|
+
return this.request("GET", path);
|
|
197
|
+
}
|
|
198
|
+
/** People on a project. Arguments: project_id. */
|
|
199
|
+
listTeam(args = {}) {
|
|
200
|
+
const a = { ...args }; for (const k of ["project_id"]) if (a[k] == null) throw new Error(`list_team: ${k} is required`);
|
|
201
|
+
const path = "/agentapp/projects/{project_id}/team".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
202
|
+
return this.request("GET", path);
|
|
203
|
+
}
|
|
204
|
+
/** Invite someone to a project by email (owner only). Arguments: project_id, email. */
|
|
205
|
+
inviteTeammate(args = {}) {
|
|
206
|
+
const a = { ...args }; for (const k of ["project_id", "email"]) if (a[k] == null) throw new Error(`invite_teammate: ${k} is required`);
|
|
207
|
+
const path = "/agentapp/projects/{project_id}/team".replace("{project_id}", encodeURIComponent(a.project_id)); delete a.project_id;
|
|
208
|
+
return this.request("POST", path, { body: a });
|
|
209
|
+
}
|
|
210
|
+
}
|