reply-cli 0.1.2 → 0.3.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 +99 -393
- package/dist/api/headers.d.ts +4 -0
- package/dist/api/headers.js +13 -0
- package/dist/api/headers.js.map +1 -0
- package/dist/auth/oauth-flow.d.ts +38 -0
- package/dist/auth/oauth-flow.js +193 -0
- package/dist/auth/oauth-flow.js.map +1 -0
- package/dist/auth/pkce.d.ts +9 -0
- package/dist/auth/pkce.js +19 -0
- package/dist/auth/pkce.js.map +1 -0
- package/dist/auth/request-identity.d.ts +16 -0
- package/dist/auth/request-identity.js +67 -0
- package/dist/auth/request-identity.js.map +1 -0
- package/dist/auth/resolve.d.ts +23 -0
- package/dist/auth/resolve.js +55 -0
- package/dist/auth/resolve.js.map +1 -0
- package/dist/auth/status.d.ts +19 -0
- package/dist/auth/status.js +27 -0
- package/dist/auth/status.js.map +1 -0
- package/dist/auth/token.d.ts +29 -0
- package/dist/auth/token.js +39 -0
- package/dist/auth/token.js.map +1 -0
- package/dist/commands/api.d.ts +19 -0
- package/dist/commands/api.js +137 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/auth.d.ts +21 -0
- package/dist/commands/auth.js +266 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/authed.d.ts +13 -0
- package/dist/commands/authed.js +20 -0
- package/dist/commands/authed.js.map +1 -0
- package/dist/commands/profile.d.ts +31 -0
- package/dist/commands/profile.js +348 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/commands/team.d.ts +17 -0
- package/dist/commands/team.js +146 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.js +80 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +15 -0
- package/dist/context.js +17 -0
- package/dist/context.js.map +1 -0
- package/dist/credentials/file-store.d.ts +13 -0
- package/dist/credentials/file-store.js +88 -0
- package/dist/credentials/file-store.js.map +1 -0
- package/dist/credentials/types.d.ts +25 -0
- package/dist/credentials/types.js +3 -0
- package/dist/credentials/types.js.map +1 -0
- package/dist/index.js +104 -41
- package/dist/index.js.map +1 -1
- package/dist/profile.d.ts +51 -0
- package/dist/profile.js +295 -0
- package/dist/profile.js.map +1 -0
- package/dist/teams.d.ts +14 -0
- package/dist/teams.js +103 -0
- package/dist/teams.js.map +1 -0
- package/dist/utils/client.d.ts +21 -9
- package/dist/utils/client.js +136 -88
- package/dist/utils/client.js.map +1 -1
- package/dist/utils/errors.d.ts +47 -0
- package/dist/utils/errors.js +86 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/output.d.ts +7 -10
- package/dist/utils/output.js +39 -71
- package/dist/utils/output.js.map +1 -1
- package/package.json +10 -25
- package/dist/commands/accounts.d.ts +0 -6
- package/dist/commands/accounts.js +0 -62
- package/dist/commands/accounts.js.map +0 -1
- package/dist/commands/contacts.d.ts +0 -20
- package/dist/commands/contacts.js +0 -321
- package/dist/commands/contacts.js.map +0 -1
- package/dist/commands/import.d.ts +0 -6
- package/dist/commands/import.js +0 -137
- package/dist/commands/import.js.map +0 -1
- package/dist/commands/schedules.d.ts +0 -9
- package/dist/commands/schedules.js +0 -119
- package/dist/commands/schedules.js.map +0 -1
- package/dist/commands/sequence-contacts.d.ts +0 -8
- package/dist/commands/sequence-contacts.js +0 -141
- package/dist/commands/sequence-contacts.js.map +0 -1
- package/dist/commands/sequences-stats.d.ts +0 -7
- package/dist/commands/sequences-stats.js +0 -183
- package/dist/commands/sequences-stats.js.map +0 -1
- package/dist/commands/sequences.d.ts +0 -12
- package/dist/commands/sequences.js +0 -225
- package/dist/commands/sequences.js.map +0 -1
- package/dist/utils/auth.d.ts +0 -2
- package/dist/utils/auth.js +0 -33
- package/dist/utils/auth.js.map +0 -1
- package/dist/utils/command.d.ts +0 -11
- package/dist/utils/command.js +0 -20
- package/dist/utils/command.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reply-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Command-line interface for Reply.io.
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Command-line interface for Reply.io. v1: authentication (OAuth + API key) and identity.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"reply": "dist/index.js"
|
|
@@ -13,34 +13,14 @@
|
|
|
13
13
|
"clean": "rm -rf dist",
|
|
14
14
|
"test": "vitest run",
|
|
15
15
|
"test:watch": "vitest",
|
|
16
|
-
"
|
|
16
|
+
"prepare": "husky"
|
|
17
17
|
},
|
|
18
18
|
"author": "Reply.io",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/
|
|
22
|
+
"url": "git+https://github.com/reply-team/reply-cli.git"
|
|
23
23
|
},
|
|
24
|
-
"bugs": {
|
|
25
|
-
"url": "https://github.com/replyio/reply-cli/issues"
|
|
26
|
-
},
|
|
27
|
-
"homepage": "https://github.com/replyio/reply-cli#readme",
|
|
28
|
-
"keywords": [
|
|
29
|
-
"reply",
|
|
30
|
-
"reply-io",
|
|
31
|
-
"replyio",
|
|
32
|
-
"cli",
|
|
33
|
-
"sales-engagement",
|
|
34
|
-
"outreach",
|
|
35
|
-
"email-automation",
|
|
36
|
-
"sequences",
|
|
37
|
-
"campaigns",
|
|
38
|
-
"contacts",
|
|
39
|
-
"cold-email",
|
|
40
|
-
"sales-automation",
|
|
41
|
-
"email-outreach",
|
|
42
|
-
"crm"
|
|
43
|
-
],
|
|
44
24
|
"engines": {
|
|
45
25
|
"node": ">=20.0.0"
|
|
46
26
|
},
|
|
@@ -49,8 +29,13 @@
|
|
|
49
29
|
"README.md"
|
|
50
30
|
],
|
|
51
31
|
"devDependencies": {
|
|
32
|
+
"@commitlint/cli": "^19.8.1",
|
|
33
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
34
|
+
"@semantic-release/exec": "^7.1.0",
|
|
52
35
|
"@types/node": "^20.0.0",
|
|
53
|
-
"
|
|
36
|
+
"husky": "^9.1.7",
|
|
37
|
+
"semantic-release": "^24.2.9",
|
|
38
|
+
"typescript": "^5.6.0",
|
|
54
39
|
"vitest": "^4.0.0"
|
|
55
40
|
},
|
|
56
41
|
"dependencies": {
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import type { Print_opts } from '../utils/output';
|
|
3
|
-
declare const handle_list: (api_key: string, print_opts: Print_opts) => Promise<void>;
|
|
4
|
-
declare const handle_check: (api_key: string) => Promise<void>;
|
|
5
|
-
declare const accounts_command: Command;
|
|
6
|
-
export { accounts_command, handle_list, handle_check };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handle_check = exports.handle_list = exports.accounts_command = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const client_1 = require("../utils/client");
|
|
6
|
-
const auth_1 = require("../utils/auth");
|
|
7
|
-
const output_1 = require("../utils/output");
|
|
8
|
-
const handle_list = async (api_key, print_opts) => {
|
|
9
|
-
const accounts = await (0, client_1.get)(api_key, '/v1/emailAccounts');
|
|
10
|
-
if (!accounts || accounts.length === 0) {
|
|
11
|
-
(0, output_1.info)('No email accounts connected.');
|
|
12
|
-
(0, output_1.info)('Connect an email account at:');
|
|
13
|
-
(0, output_1.info)(' https://run.reply.io/Dashboard/Material#/settings/email-accounts');
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (print_opts.json || print_opts.pretty) {
|
|
17
|
-
(0, output_1.print)(accounts, print_opts);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
(0, output_1.print_table)(accounts.map(a => ({
|
|
21
|
-
ID: String(a.id),
|
|
22
|
-
'Sender Name': a.senderName || '—',
|
|
23
|
-
'Email Address': a.emailAddress,
|
|
24
|
-
})), ['ID', 'Sender Name', 'Email Address']);
|
|
25
|
-
};
|
|
26
|
-
exports.handle_list = handle_list;
|
|
27
|
-
const handle_check = async (api_key) => {
|
|
28
|
-
const accounts = await (0, client_1.get)(api_key, '/v1/emailAccounts');
|
|
29
|
-
if (!accounts || accounts.length === 0) {
|
|
30
|
-
console.log('NO_ACCOUNTS');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
console.log(`ACCOUNTS_FOUND:${accounts.length}`);
|
|
34
|
-
console.log(JSON.stringify(accounts.map(a => ({
|
|
35
|
-
id: a.id,
|
|
36
|
-
senderName: a.senderName,
|
|
37
|
-
emailAddress: a.emailAddress,
|
|
38
|
-
}))));
|
|
39
|
-
};
|
|
40
|
-
exports.handle_check = handle_check;
|
|
41
|
-
const accounts_command = new commander_1.Command('accounts')
|
|
42
|
-
.description('Manage connected email accounts');
|
|
43
|
-
exports.accounts_command = accounts_command;
|
|
44
|
-
accounts_command
|
|
45
|
-
.command('list')
|
|
46
|
-
.description('List all connected email accounts')
|
|
47
|
-
.addHelpText('after', '\nExamples:\n reply accounts list\n reply accounts list --json')
|
|
48
|
-
.action(async function () {
|
|
49
|
-
const opts = this.optsWithGlobals();
|
|
50
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
51
|
-
await handle_list(key, { json: opts.json, pretty: opts.pretty });
|
|
52
|
-
});
|
|
53
|
-
accounts_command
|
|
54
|
-
.command('check')
|
|
55
|
-
.description('Check if any email accounts are connected (machine-readable)')
|
|
56
|
-
.addHelpText('after', '\nOutputs ACCOUNTS_FOUND:<count> or NO_ACCOUNTS (exit 1).\n\nExamples:\n reply accounts check')
|
|
57
|
-
.action(async function () {
|
|
58
|
-
const opts = this.optsWithGlobals();
|
|
59
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
60
|
-
await handle_check(key);
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=accounts.js.map
|
|
@@ -1 +0,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,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import type { Print_opts } from '../utils/output';
|
|
3
|
-
declare const handle_list: (api_key: string, opts: {
|
|
4
|
-
page?: string;
|
|
5
|
-
limit?: string;
|
|
6
|
-
} & Print_opts) => Promise<void>;
|
|
7
|
-
declare const handle_get: (api_key: string, id_or_email: string, print_opts: Print_opts) => Promise<void>;
|
|
8
|
-
declare const handle_create: (api_key: string, opts: Record<string, string>, print_opts: Print_opts) => Promise<void>;
|
|
9
|
-
declare const handle_update: (api_key: string, opts: Record<string, string>, print_opts: Print_opts) => Promise<void>;
|
|
10
|
-
declare const handle_delete: (api_key: string, id_or_email: string) => Promise<void>;
|
|
11
|
-
declare const handle_search: (api_key: string, opts: {
|
|
12
|
-
email?: string;
|
|
13
|
-
linkedin?: string;
|
|
14
|
-
}, print_opts: Print_opts) => Promise<void>;
|
|
15
|
-
declare const handle_mark_replied: (api_key: string, email: string) => Promise<void>;
|
|
16
|
-
declare const handle_mark_finished: (api_key: string, email: string) => Promise<void>;
|
|
17
|
-
declare const handle_opt_out: (api_key: string, email: string) => Promise<void>;
|
|
18
|
-
declare const handle_stats: (api_key: string, email: string, print_opts: Print_opts) => Promise<void>;
|
|
19
|
-
declare const contacts_command: Command;
|
|
20
|
-
export { contacts_command, handle_list, handle_get, handle_create, handle_update, handle_delete, handle_search, handle_mark_replied, handle_mark_finished, handle_opt_out, handle_stats, };
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handle_stats = exports.handle_opt_out = exports.handle_mark_finished = exports.handle_mark_replied = exports.handle_search = exports.handle_delete = exports.handle_update = exports.handle_create = exports.handle_get = exports.handle_list = exports.contacts_command = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const client_1 = require("../utils/client");
|
|
6
|
-
const auth_1 = require("../utils/auth");
|
|
7
|
-
const output_1 = require("../utils/output");
|
|
8
|
-
const is_email = (v) => v.includes('@');
|
|
9
|
-
const handle_list = async (api_key, opts) => {
|
|
10
|
-
const page = opts.page || '1';
|
|
11
|
-
const limit = opts.limit || '25';
|
|
12
|
-
const result = await (0, client_1.get)(api_key, `/v1/people?page=${page}&limit=${limit}`);
|
|
13
|
-
const people = result?.people || result;
|
|
14
|
-
if (!people || people.length === 0) {
|
|
15
|
-
(0, output_1.info)('No contacts found.');
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (opts.json || opts.pretty) {
|
|
19
|
-
(0, output_1.print)(result, opts);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
(0, output_1.print_table)(people.map(p => ({
|
|
23
|
-
ID: String(p.id),
|
|
24
|
-
Email: p.email,
|
|
25
|
-
Name: (0, output_1.truncate)(`${p.firstName || ''} ${p.lastName || ''}`.trim(), 25),
|
|
26
|
-
Company: (0, output_1.truncate)(p.company || '—', 20),
|
|
27
|
-
Title: (0, output_1.truncate)(p.title || '—', 20),
|
|
28
|
-
Added: (0, output_1.format_date)(p.addingDate),
|
|
29
|
-
})), ['ID', 'Email', 'Name', 'Company', 'Title', 'Added']);
|
|
30
|
-
const total = result?.total;
|
|
31
|
-
const pages_count = result?.pagesCount;
|
|
32
|
-
if (total)
|
|
33
|
-
(0, output_1.info)(`\nShowing page ${page}/${pages_count || '?'} (${people.length} of ${total} contacts). Use --page N to paginate.`);
|
|
34
|
-
};
|
|
35
|
-
exports.handle_list = handle_list;
|
|
36
|
-
const handle_get = async (api_key, id_or_email, print_opts) => {
|
|
37
|
-
const endpoint = is_email(id_or_email)
|
|
38
|
-
? `/v1/people?email=${encodeURIComponent(id_or_email)}`
|
|
39
|
-
: `/v1/people?id=${id_or_email}`;
|
|
40
|
-
const result = await (0, client_1.get)(api_key, endpoint);
|
|
41
|
-
if (!result) {
|
|
42
|
-
(0, output_1.info)('Contact not found.');
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
(0, output_1.print)(result, { ...print_opts, pretty: print_opts.pretty ?? true });
|
|
46
|
-
};
|
|
47
|
-
exports.handle_get = handle_get;
|
|
48
|
-
const handle_create = async (api_key, opts, print_opts) => {
|
|
49
|
-
if (!opts.email || !opts.firstName)
|
|
50
|
-
(0, output_1.fail)('Required: --email and --first-name');
|
|
51
|
-
const body = {
|
|
52
|
-
email: opts.email,
|
|
53
|
-
firstName: opts.firstName,
|
|
54
|
-
};
|
|
55
|
-
if (opts.lastName)
|
|
56
|
-
body.lastName = opts.lastName;
|
|
57
|
-
if (opts.company)
|
|
58
|
-
body.company = opts.company;
|
|
59
|
-
if (opts.title)
|
|
60
|
-
body.title = opts.title;
|
|
61
|
-
if (opts.phone)
|
|
62
|
-
body.phone = opts.phone;
|
|
63
|
-
if (opts.linkedin)
|
|
64
|
-
body.linkedInProfile = opts.linkedin;
|
|
65
|
-
if (opts.city)
|
|
66
|
-
body.city = opts.city;
|
|
67
|
-
if (opts.state)
|
|
68
|
-
body.state = opts.state;
|
|
69
|
-
if (opts.country)
|
|
70
|
-
body.country = opts.country;
|
|
71
|
-
if (opts.custom) {
|
|
72
|
-
body.customFields = opts.custom.split(',').map(pair => {
|
|
73
|
-
const [key, ...val_parts] = pair.split('=');
|
|
74
|
-
return { key: key.trim(), value: val_parts.join('=').trim() };
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
const result = await (0, client_1.post)(api_key, '/v1/people', body);
|
|
78
|
-
(0, output_1.success)(`Contact created/updated: ${result.firstName} ${result.lastName || ''} <${result.email}> (ID: ${result.id})`);
|
|
79
|
-
if (print_opts.json || print_opts.pretty)
|
|
80
|
-
(0, output_1.print)(result, print_opts);
|
|
81
|
-
};
|
|
82
|
-
exports.handle_create = handle_create;
|
|
83
|
-
const handle_update = async (api_key, opts, print_opts) => {
|
|
84
|
-
if (!opts.email)
|
|
85
|
-
(0, output_1.fail)('Required: --email (used as the matching key)');
|
|
86
|
-
const body = { email: opts.email };
|
|
87
|
-
if (opts.firstName)
|
|
88
|
-
body.firstName = opts.firstName;
|
|
89
|
-
if (opts.lastName)
|
|
90
|
-
body.lastName = opts.lastName;
|
|
91
|
-
if (opts.company)
|
|
92
|
-
body.company = opts.company;
|
|
93
|
-
if (opts.title)
|
|
94
|
-
body.title = opts.title;
|
|
95
|
-
if (opts.phone)
|
|
96
|
-
body.phone = opts.phone;
|
|
97
|
-
if (opts.linkedin)
|
|
98
|
-
body.linkedInProfile = opts.linkedin;
|
|
99
|
-
if (opts.city)
|
|
100
|
-
body.city = opts.city;
|
|
101
|
-
if (opts.state)
|
|
102
|
-
body.state = opts.state;
|
|
103
|
-
if (opts.country)
|
|
104
|
-
body.country = opts.country;
|
|
105
|
-
const result = await (0, client_1.post)(api_key, '/v1/people', body);
|
|
106
|
-
(0, output_1.success)(`Contact updated: ${result.email} (ID: ${result.id})`);
|
|
107
|
-
if (print_opts.json || print_opts.pretty)
|
|
108
|
-
(0, output_1.print)(result, print_opts);
|
|
109
|
-
};
|
|
110
|
-
exports.handle_update = handle_update;
|
|
111
|
-
const handle_delete = async (api_key, id_or_email) => {
|
|
112
|
-
if (is_email(id_or_email)) {
|
|
113
|
-
await (0, client_1.del)(api_key, `/v1/people/?email=${encodeURIComponent(id_or_email)}`);
|
|
114
|
-
(0, output_1.success)(`Deleted contact: ${id_or_email}`);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
await (0, client_1.del)(api_key, `/v1/people/?id=${id_or_email}`);
|
|
118
|
-
(0, output_1.success)(`Deleted contact ID: ${id_or_email}`);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
exports.handle_delete = handle_delete;
|
|
122
|
-
const handle_search = async (api_key, opts, print_opts) => {
|
|
123
|
-
if (opts.email) {
|
|
124
|
-
const result = await (0, client_1.get)(api_key, `/v1/people?email=${encodeURIComponent(opts.email)}`);
|
|
125
|
-
if (result) {
|
|
126
|
-
(0, output_1.success)(`Found: ${result.firstName} ${result.lastName || ''} <${result.email}> (ID: ${result.id})`);
|
|
127
|
-
(0, output_1.print)(result, print_opts);
|
|
128
|
-
}
|
|
129
|
-
else
|
|
130
|
-
(0, output_1.info)('Contact not found.');
|
|
131
|
-
}
|
|
132
|
-
else if (opts.linkedin) {
|
|
133
|
-
const result = await (0, client_1.post)(api_key, '/v1/people/lookup', { linkedin: opts.linkedin });
|
|
134
|
-
if (result?.ids?.length)
|
|
135
|
-
(0, output_1.success)(`Found contact IDs: ${result.ids.join(', ')}`);
|
|
136
|
-
else
|
|
137
|
-
(0, output_1.info)('No contacts found for that LinkedIn URL.');
|
|
138
|
-
}
|
|
139
|
-
else
|
|
140
|
-
(0, output_1.fail)('Provide --email or --linkedin to search.');
|
|
141
|
-
};
|
|
142
|
-
exports.handle_search = handle_search;
|
|
143
|
-
const handle_mark_replied = async (api_key, email) => {
|
|
144
|
-
await (0, client_1.post)(api_key, '/v1/actions/markasreplied', { email });
|
|
145
|
-
(0, output_1.success)(`Contact ${email} marked as replied in all sequences.`);
|
|
146
|
-
};
|
|
147
|
-
exports.handle_mark_replied = handle_mark_replied;
|
|
148
|
-
const handle_mark_finished = async (api_key, email) => {
|
|
149
|
-
await (0, client_1.post)(api_key, '/v1/actions/markasfinished', { email });
|
|
150
|
-
(0, output_1.success)(`Contact ${email} marked as finished in all sequences.`);
|
|
151
|
-
};
|
|
152
|
-
exports.handle_mark_finished = handle_mark_finished;
|
|
153
|
-
const handle_opt_out = async (api_key, email) => {
|
|
154
|
-
await (0, client_1.post)(api_key, '/v1/actions/removepersonfromallcampaigns', { email });
|
|
155
|
-
(0, output_1.success)(`Contact ${email} removed from all sequences (opted out).`);
|
|
156
|
-
};
|
|
157
|
-
exports.handle_opt_out = handle_opt_out;
|
|
158
|
-
const handle_stats = async (api_key, email, print_opts) => {
|
|
159
|
-
const encoded_email = email.replace('@', '%40');
|
|
160
|
-
const result = await (0, client_1.get)(api_key, `/v1/stats/person?email=${encoded_email}`);
|
|
161
|
-
if (!result) {
|
|
162
|
-
(0, output_1.info)('Contact not found.');
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (print_opts.json || print_opts.pretty) {
|
|
166
|
-
(0, output_1.print)(result, print_opts);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
console.log(`\nContact: ${output_1.pc.bold(result.fullName || result.email)}`);
|
|
170
|
-
console.log(` Email: ${result.email}`);
|
|
171
|
-
console.log(` Blocked: ${result.isBlocked ? output_1.pc.red('Yes') : output_1.pc.green('No')}`);
|
|
172
|
-
console.log(` Opted out: ${result.isOptedOut ? output_1.pc.red('Yes') : output_1.pc.green('No')}`);
|
|
173
|
-
console.log();
|
|
174
|
-
if (result.campaigns?.length) {
|
|
175
|
-
(0, output_1.print_table)(result.campaigns.map(c => ({
|
|
176
|
-
Sequence: (0, output_1.truncate)(c.name || '—', 30),
|
|
177
|
-
Status: typeof c.status === 'number' ? (0, output_1.status_label)(c.status) : (c.status || '—'),
|
|
178
|
-
'Person Status': c.personStatus || '—',
|
|
179
|
-
'Reply Date': c.replyDate ? (0, output_1.format_date)(c.replyDate) : '—',
|
|
180
|
-
Inbox: c.inboxState || '—',
|
|
181
|
-
})), ['Sequence', 'Status', 'Person Status', 'Reply Date', 'Inbox']);
|
|
182
|
-
for (const c of result.campaigns) {
|
|
183
|
-
if (c.emails?.length) {
|
|
184
|
-
console.log(output_1.pc.bold(`\n ${c.name} — Emails:`));
|
|
185
|
-
for (const e of c.emails) {
|
|
186
|
-
const status = e.isOpened ? output_1.pc.green('opened') : output_1.pc.dim('not opened');
|
|
187
|
-
const reply = e.isReplied ? ` | ${output_1.pc.green('replied')}` : '';
|
|
188
|
-
console.log(` ${output_1.pc.dim((0, output_1.format_date)(e.sentDate))} ${output_1.pc.cyan((0, output_1.truncate)(e.subject || '(no subject)', 50))} [${status}${reply}]`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
else
|
|
194
|
-
(0, output_1.info)('No sequence activity for this contact.');
|
|
195
|
-
};
|
|
196
|
-
exports.handle_stats = handle_stats;
|
|
197
|
-
const contacts_command = new commander_1.Command('contacts')
|
|
198
|
-
.description('Manage contacts (prospects)');
|
|
199
|
-
exports.contacts_command = contacts_command;
|
|
200
|
-
contacts_command
|
|
201
|
-
.command('list')
|
|
202
|
-
.description('List contacts (paginated)')
|
|
203
|
-
.option('--page <n>', 'Page number (default: 1)')
|
|
204
|
-
.option('--limit <n>', 'Contacts per page (default: 25)')
|
|
205
|
-
.addHelpText('after', '\nExamples:\n reply contacts list\n reply contacts list --page 2 --limit 50')
|
|
206
|
-
.action(async function () {
|
|
207
|
-
const opts = this.optsWithGlobals();
|
|
208
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
209
|
-
await handle_list(key, { page: opts.page, limit: opts.limit, json: opts.json, pretty: opts.pretty });
|
|
210
|
-
});
|
|
211
|
-
contacts_command
|
|
212
|
-
.command('get')
|
|
213
|
-
.description('Get contact details by ID or email')
|
|
214
|
-
.argument('<id-or-email>', 'Contact ID or email address')
|
|
215
|
-
.addHelpText('after', '\nExamples:\n reply contacts get john@example.com\n reply contacts get 12345678')
|
|
216
|
-
.action(async function (id_or_email) {
|
|
217
|
-
const opts = this.optsWithGlobals();
|
|
218
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
219
|
-
await handle_get(key, id_or_email, { json: opts.json, pretty: opts.pretty });
|
|
220
|
-
});
|
|
221
|
-
contacts_command
|
|
222
|
-
.command('create')
|
|
223
|
-
.description('Create a new contact')
|
|
224
|
-
.requiredOption('--email <email>', 'Email address (required)')
|
|
225
|
-
.requiredOption('--first-name <name>', 'First name (required)')
|
|
226
|
-
.option('--last-name <name>', 'Last name')
|
|
227
|
-
.option('--company <company>', 'Company name')
|
|
228
|
-
.option('--title <title>', 'Job title')
|
|
229
|
-
.option('--phone <phone>', 'Phone number')
|
|
230
|
-
.option('--linkedin <url>', 'LinkedIn profile URL')
|
|
231
|
-
.option('--city <city>', 'City')
|
|
232
|
-
.option('--state <state>', 'State')
|
|
233
|
-
.option('--country <country>', 'Country')
|
|
234
|
-
.option('--custom <fields>', 'Custom fields: Key1=Val1,Key2=Val2')
|
|
235
|
-
.addHelpText('after', '\nExamples:\n reply contacts create --email john@co.com --first-name John --company Acme')
|
|
236
|
-
.action(async function () {
|
|
237
|
-
const opts = this.optsWithGlobals();
|
|
238
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
239
|
-
await handle_create(key, opts, { json: opts.json, pretty: opts.pretty });
|
|
240
|
-
});
|
|
241
|
-
contacts_command
|
|
242
|
-
.command('update')
|
|
243
|
-
.description('Update an existing contact (matched by email)')
|
|
244
|
-
.requiredOption('--email <email>', 'Email address (matching key)')
|
|
245
|
-
.option('--first-name <name>', 'First name')
|
|
246
|
-
.option('--last-name <name>', 'Last name')
|
|
247
|
-
.option('--company <company>', 'Company name')
|
|
248
|
-
.option('--title <title>', 'Job title')
|
|
249
|
-
.option('--phone <phone>', 'Phone number')
|
|
250
|
-
.option('--linkedin <url>', 'LinkedIn profile URL')
|
|
251
|
-
.option('--city <city>', 'City')
|
|
252
|
-
.option('--state <state>', 'State')
|
|
253
|
-
.option('--country <country>', 'Country')
|
|
254
|
-
.addHelpText('after', '\nExamples:\n reply contacts update --email john@co.com --company "New Corp"')
|
|
255
|
-
.action(async function () {
|
|
256
|
-
const opts = this.optsWithGlobals();
|
|
257
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
258
|
-
await handle_update(key, opts, { json: opts.json, pretty: opts.pretty });
|
|
259
|
-
});
|
|
260
|
-
contacts_command
|
|
261
|
-
.command('delete')
|
|
262
|
-
.description('Delete a contact by ID or email')
|
|
263
|
-
.argument('<id-or-email>', 'Contact ID or email address')
|
|
264
|
-
.addHelpText('after', '\nExamples:\n reply contacts delete john@example.com\n reply contacts delete 12345678')
|
|
265
|
-
.action(async function (id_or_email) {
|
|
266
|
-
const opts = this.optsWithGlobals();
|
|
267
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
268
|
-
await handle_delete(key, id_or_email);
|
|
269
|
-
});
|
|
270
|
-
contacts_command
|
|
271
|
-
.command('search')
|
|
272
|
-
.description('Search for a contact by email or LinkedIn URL')
|
|
273
|
-
.option('--email <email>', 'Search by email address')
|
|
274
|
-
.option('--linkedin <url>', 'Search by LinkedIn profile URL')
|
|
275
|
-
.addHelpText('after', '\nExamples:\n reply contacts search --email john@co.com\n reply contacts search --linkedin https://linkedin.com/in/john')
|
|
276
|
-
.action(async function () {
|
|
277
|
-
const opts = this.optsWithGlobals();
|
|
278
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
279
|
-
await handle_search(key, { email: opts.email, linkedin: opts.linkedin }, { json: opts.json, pretty: opts.pretty });
|
|
280
|
-
});
|
|
281
|
-
contacts_command
|
|
282
|
-
.command('mark-replied')
|
|
283
|
-
.description('Mark a contact as replied in all sequences')
|
|
284
|
-
.argument('<email>', 'Contact email address')
|
|
285
|
-
.addHelpText('after', '\nExamples:\n reply contacts mark-replied john@co.com')
|
|
286
|
-
.action(async function (email) {
|
|
287
|
-
const opts = this.optsWithGlobals();
|
|
288
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
289
|
-
await handle_mark_replied(key, email);
|
|
290
|
-
});
|
|
291
|
-
contacts_command
|
|
292
|
-
.command('mark-finished')
|
|
293
|
-
.description('Mark a contact as finished in all sequences')
|
|
294
|
-
.argument('<email>', 'Contact email address')
|
|
295
|
-
.addHelpText('after', '\nExamples:\n reply contacts mark-finished john@co.com')
|
|
296
|
-
.action(async function (email) {
|
|
297
|
-
const opts = this.optsWithGlobals();
|
|
298
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
299
|
-
await handle_mark_finished(key, email);
|
|
300
|
-
});
|
|
301
|
-
contacts_command
|
|
302
|
-
.command('opt-out')
|
|
303
|
-
.description('Remove a contact from all sequences')
|
|
304
|
-
.argument('<email>', 'Contact email address')
|
|
305
|
-
.addHelpText('after', '\nExamples:\n reply contacts opt-out john@co.com')
|
|
306
|
-
.action(async function (email) {
|
|
307
|
-
const opts = this.optsWithGlobals();
|
|
308
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
309
|
-
await handle_opt_out(key, email);
|
|
310
|
-
});
|
|
311
|
-
contacts_command
|
|
312
|
-
.command('stats')
|
|
313
|
-
.description('View contact performance: sequence activity, email history')
|
|
314
|
-
.argument('<email>', 'Contact email address')
|
|
315
|
-
.addHelpText('after', '\nShows blocked/opted-out status, sequence memberships, and per-email open/reply tracking.\n\nExamples:\n reply contacts stats john@co.com')
|
|
316
|
-
.action(async function (email) {
|
|
317
|
-
const opts = this.optsWithGlobals();
|
|
318
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
319
|
-
await handle_stats(key, email, { json: opts.json, pretty: opts.pretty });
|
|
320
|
-
});
|
|
321
|
-
//# sourceMappingURL=contacts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/commands/contacts.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,4CAA+C;AAC/C,wCAA8C;AAC9C,4CAAsH;AA+CtH,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAA,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAEvD,MAAM,WAAW,GAAG,KAAK,EAAC,OAAe,EAAE,IAAkD,EAAC,EAAE;IAC5F,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC;IAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;IACjC,MAAM,MAAM,GAAG,MAAM,IAAA,YAAG,EAAkB,OAAO,EAAE,mBAAmB,IAAI,UAAU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EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEP,gBAAgB;KACX,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,qCAAqC,CAAC;KAClD,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;KAC5C,WAAW,CAAC,OAAO,EAAE,mDAAmD,CAAC;KACzE,MAAM,CAAC,KAAK,WAAyB,KAAa;IAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEP,gBAAgB;KACX,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,4DAA4D,CAAC;KACzE,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;KAC5C,WAAW,CAAC,OAAO,EAAE,6IAA6I,CAAC;KACnK,MAAM,CAAC,KAAK,WAAyB,KAAa;IAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;AAC3E,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import type { Print_opts } from '../utils/output';
|
|
3
|
-
declare const handle_preview: (api_key: string, file_path: string, print_opts: Print_opts) => Promise<void>;
|
|
4
|
-
declare const handle_upload: (api_key: string, file_path: string, mapping_json: string, list_id?: string, overwrite?: boolean) => Promise<void>;
|
|
5
|
-
declare const import_command: Command;
|
|
6
|
-
export { import_command, handle_preview, handle_upload };
|
package/dist/commands/import.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handle_upload = exports.handle_preview = exports.import_command = void 0;
|
|
7
|
-
const commander_1 = require("commander");
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const client_1 = require("../utils/client");
|
|
10
|
-
const auth_1 = require("../utils/auth");
|
|
11
|
-
const output_1 = require("../utils/output");
|
|
12
|
-
const REPLY_FIELDS = [
|
|
13
|
-
'email', 'firstName', 'lastName', 'company', 'title', 'phone',
|
|
14
|
-
'city', 'state', 'country', 'linkedInProfile', 'companySize', 'industry',
|
|
15
|
-
'timeZoneId',
|
|
16
|
-
];
|
|
17
|
-
const parse_csv_line = (line) => {
|
|
18
|
-
const fields = [];
|
|
19
|
-
let current = '';
|
|
20
|
-
let in_quotes = false;
|
|
21
|
-
for (let i = 0; i < line.length; i++) {
|
|
22
|
-
const ch = line[i];
|
|
23
|
-
if (ch === '"') {
|
|
24
|
-
if (in_quotes && line[i + 1] === '"') {
|
|
25
|
-
current += '"';
|
|
26
|
-
i++;
|
|
27
|
-
}
|
|
28
|
-
else
|
|
29
|
-
in_quotes = !in_quotes;
|
|
30
|
-
}
|
|
31
|
-
else if (ch === ',' && !in_quotes) {
|
|
32
|
-
fields.push(current.trim());
|
|
33
|
-
current = '';
|
|
34
|
-
}
|
|
35
|
-
else
|
|
36
|
-
current += ch;
|
|
37
|
-
}
|
|
38
|
-
fields.push(current.trim());
|
|
39
|
-
return fields;
|
|
40
|
-
};
|
|
41
|
-
const handle_preview = async (api_key, file_path, print_opts) => {
|
|
42
|
-
if (!file_path || !fs_1.default.existsSync(file_path))
|
|
43
|
-
(0, output_1.fail)(`CSV file not found: ${file_path}`);
|
|
44
|
-
const content = fs_1.default.readFileSync(file_path, 'utf-8');
|
|
45
|
-
const lines = content.split('\n').filter(l => l.trim());
|
|
46
|
-
if (lines.length === 0)
|
|
47
|
-
(0, output_1.fail)('CSV file is empty.');
|
|
48
|
-
const headers = parse_csv_line(lines[0]);
|
|
49
|
-
const preview_rows = lines.slice(1, 4).map(parse_csv_line);
|
|
50
|
-
if (print_opts.json || print_opts.pretty) {
|
|
51
|
-
let custom_fields = [];
|
|
52
|
-
try {
|
|
53
|
-
custom_fields = await (0, client_1.get)(api_key, '/v1/custom-fields/all') || [];
|
|
54
|
-
}
|
|
55
|
-
catch { }
|
|
56
|
-
(0, output_1.print)({
|
|
57
|
-
headers,
|
|
58
|
-
sampleRows: preview_rows,
|
|
59
|
-
totalRows: lines.length - 1,
|
|
60
|
-
replyFields: REPLY_FIELDS,
|
|
61
|
-
customFields: custom_fields,
|
|
62
|
-
}, print_opts);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
console.log('CSV Columns and Sample Data:');
|
|
66
|
-
(0, output_1.print_table)(preview_rows.map(row => {
|
|
67
|
-
const obj = {};
|
|
68
|
-
headers.forEach((h, i) => obj[h] = row[i] || '');
|
|
69
|
-
return obj;
|
|
70
|
-
}), headers);
|
|
71
|
-
console.log(`\nTotal rows: ${lines.length - 1}`);
|
|
72
|
-
console.log('\n--- Available Reply.io Fields ---');
|
|
73
|
-
console.log('Standard: ' + REPLY_FIELDS.join(', '));
|
|
74
|
-
try {
|
|
75
|
-
const custom_fields = await (0, client_1.get)(api_key, '/v1/custom-fields/all');
|
|
76
|
-
if (custom_fields?.length) {
|
|
77
|
-
console.log('Custom fields: ' + custom_fields.map(f => `${f.title} (${f.fieldType === 0 ? 'text' : 'number'})`).join(', '));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch { }
|
|
81
|
-
console.log('\n--- CSV_HEADERS_JSON ---');
|
|
82
|
-
console.log(JSON.stringify(headers));
|
|
83
|
-
console.log('--- END ---');
|
|
84
|
-
};
|
|
85
|
-
exports.handle_preview = handle_preview;
|
|
86
|
-
const handle_upload = async (api_key, file_path, mapping_json, list_id, overwrite) => {
|
|
87
|
-
if (!file_path || !fs_1.default.existsSync(file_path))
|
|
88
|
-
(0, output_1.fail)(`CSV file not found: ${file_path}`);
|
|
89
|
-
const mapping = JSON.parse(mapping_json);
|
|
90
|
-
const options = {
|
|
91
|
-
overwriteExisting: overwrite || false,
|
|
92
|
-
mapping: { prospect: mapping },
|
|
93
|
-
};
|
|
94
|
-
if (list_id)
|
|
95
|
-
options.listId = parseInt(list_id);
|
|
96
|
-
(0, output_1.info)(`Uploading ${file_path}...`);
|
|
97
|
-
const file_blob = new Blob([fs_1.default.readFileSync(file_path)], { type: 'text/csv' });
|
|
98
|
-
const form_data = new FormData();
|
|
99
|
-
const file_name = file_path.split('/').pop() || 'contacts.csv';
|
|
100
|
-
form_data.append('file', file_blob, file_name);
|
|
101
|
-
form_data.append('options', JSON.stringify(options));
|
|
102
|
-
const result = await (0, client_1.post_form_data)(api_key, '/v1/people/import/schedules-embedded', form_data);
|
|
103
|
-
if (result?.importSessionId)
|
|
104
|
-
(0, output_1.success)(`CSV upload started. Import session ID: ${result.importSessionId}`);
|
|
105
|
-
else {
|
|
106
|
-
(0, output_1.success)('CSV upload completed.');
|
|
107
|
-
console.log(JSON.stringify(result, null, 2));
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
exports.handle_upload = handle_upload;
|
|
111
|
-
const import_command = new commander_1.Command('import')
|
|
112
|
-
.description('Import contacts from CSV files');
|
|
113
|
-
exports.import_command = import_command;
|
|
114
|
-
import_command
|
|
115
|
-
.command('preview')
|
|
116
|
-
.description('Preview CSV headers, sample data, and available Reply.io fields')
|
|
117
|
-
.requiredOption('--file <path>', 'Path to CSV file')
|
|
118
|
-
.addHelpText('after', '\nShows CSV columns, sample rows, and available Reply.io fields for mapping.\n\nExamples:\n reply import preview --file contacts.csv')
|
|
119
|
-
.action(async function () {
|
|
120
|
-
const opts = this.optsWithGlobals();
|
|
121
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
122
|
-
await handle_preview(key, opts.file, { json: opts.json, pretty: opts.pretty });
|
|
123
|
-
});
|
|
124
|
-
import_command
|
|
125
|
-
.command('upload')
|
|
126
|
-
.description('Upload a CSV file with column-to-field mapping')
|
|
127
|
-
.requiredOption('--file <path>', 'Path to CSV file')
|
|
128
|
-
.requiredOption('--mapping <json>', 'JSON mapping of Reply fields to CSV column names')
|
|
129
|
-
.option('--list-id <id>', 'Assign contacts to a list')
|
|
130
|
-
.option('--overwrite', 'Overwrite existing contacts')
|
|
131
|
-
.addHelpText('after', '\nUploads CSV with a mapping from Reply.io fields to CSV column headers.\n\nExamples:\n reply import upload --file contacts.csv --mapping \'{"email":"Email Address","firstName":"First Name"}\'\n reply import upload --file contacts.csv --mapping \'{"email":"Email"}\' --overwrite --list-id 42')
|
|
132
|
-
.action(async function () {
|
|
133
|
-
const opts = this.optsWithGlobals();
|
|
134
|
-
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
135
|
-
await handle_upload(key, opts.file, opts.mapping, opts.listId, opts.overwrite);
|
|
136
|
-
});
|
|
137
|
-
//# sourceMappingURL=import.js.map
|