yirlo 0.0.0-stage → 1.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.
Files changed (4) hide show
  1. package/README.md +30 -2
  2. package/mcp.js +24 -0
  3. package/package.json +29 -3
  4. package/yirlo.js +210 -0
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
1
+ # Yirlo
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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
+ ## MCP server
20
+
21
+ Remote (recommended): add `https://yirlo.com/mcp` with the header `Authorization: Bearer <YIRLO_API_KEY>`.
22
+
23
+ ```
24
+ claude mcp add --transport http yirlo https://yirlo.com/mcp --header "Authorization: Bearer $YIRLO_API_KEY"
25
+ ```
26
+
27
+ Local (stdio), for apps that only run local servers:
28
+
29
+ ```json
30
+ { "mcpServers": { "yirlo": { "command": "npx", "args": ["-y", "yirlo-mcp"], "env": { "YIRLO_API_KEY": "yk_live_..." } } } }
31
+ ```
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,32 @@
1
1
  {
2
2
  "name": "yirlo",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.1.0",
4
+ "description": "Yirlo SDK and MCP server: run your AI cold email outreach (projects, campaigns, inbox, hot leads, budgets) from code or an AI agent.",
5
+ "type": "module",
6
+ "main": "yirlo.js",
7
+ "exports": {
8
+ ".": "./yirlo.js"
9
+ },
10
+ "bin": {
11
+ "yirlo-mcp": "mcp.js"
12
+ },
13
+ "files": [
14
+ "yirlo.js",
15
+ "mcp.js",
16
+ "README.md"
17
+ ],
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "homepage": "https://yirlo.com/api-docs",
22
+ "keywords": [
23
+ "yirlo",
24
+ "cold email",
25
+ "outbound",
26
+ "lead generation",
27
+ "mcp",
28
+ "ai agent",
29
+ "sdk"
30
+ ],
31
+ "license": "MIT"
6
32
  }
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
+ }