reply-cli 0.1.2 → 0.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.
Files changed (58) hide show
  1. package/README.md +104 -361
  2. package/dist/commands/auth.d.ts +5 -0
  3. package/dist/commands/auth.js +31 -0
  4. package/dist/commands/auth.js.map +1 -0
  5. package/dist/commands/contacts.d.ts +26 -11
  6. package/dist/commands/contacts.js +284 -193
  7. package/dist/commands/contacts.js.map +1 -1
  8. package/dist/commands/email-accounts.d.ts +11 -0
  9. package/dist/commands/email-accounts.js +97 -0
  10. package/dist/commands/email-accounts.js.map +1 -0
  11. package/dist/commands/inbox.d.ts +30 -0
  12. package/dist/commands/inbox.js +225 -0
  13. package/dist/commands/inbox.js.map +1 -0
  14. package/dist/commands/lists.d.ts +20 -0
  15. package/dist/commands/lists.js +137 -0
  16. package/dist/commands/lists.js.map +1 -0
  17. package/dist/commands/reports.d.ts +10 -0
  18. package/dist/commands/reports.js +70 -0
  19. package/dist/commands/reports.js.map +1 -0
  20. package/dist/commands/schedules.d.ts +1 -4
  21. package/dist/commands/schedules.js +19 -79
  22. package/dist/commands/schedules.js.map +1 -1
  23. package/dist/commands/sequence-contacts.d.ts +17 -6
  24. package/dist/commands/sequence-contacts.js +105 -117
  25. package/dist/commands/sequence-contacts.js.map +1 -1
  26. package/dist/commands/sequences-stats.d.ts +39 -4
  27. package/dist/commands/sequences-stats.js +75 -159
  28. package/dist/commands/sequences-stats.js.map +1 -1
  29. package/dist/commands/sequences.d.ts +16 -6
  30. package/dist/commands/sequences.js +118 -132
  31. package/dist/commands/sequences.js.map +1 -1
  32. package/dist/index.js +61 -26
  33. package/dist/index.js.map +1 -1
  34. package/dist/utils/client.d.ts +29 -2
  35. package/dist/utils/client.js +73 -54
  36. package/dist/utils/client.js.map +1 -1
  37. package/dist/utils/command.d.ts +8 -1
  38. package/dist/utils/command.js +32 -1
  39. package/dist/utils/command.js.map +1 -1
  40. package/dist/utils/csv.d.ts +19 -0
  41. package/dist/utils/csv.js +118 -0
  42. package/dist/utils/csv.js.map +1 -0
  43. package/dist/utils/output.d.ts +12 -3
  44. package/dist/utils/output.js +17 -7
  45. package/dist/utils/output.js.map +1 -1
  46. package/dist/utils/pagination.d.ts +22 -0
  47. package/dist/utils/pagination.js +37 -0
  48. package/dist/utils/pagination.js.map +1 -0
  49. package/dist/utils/resolve.d.ts +4 -0
  50. package/dist/utils/resolve.js +34 -0
  51. package/dist/utils/resolve.js.map +1 -0
  52. package/package.json +3 -3
  53. package/dist/commands/accounts.d.ts +0 -6
  54. package/dist/commands/accounts.js +0 -62
  55. package/dist/commands/accounts.js.map +0 -1
  56. package/dist/commands/import.d.ts +0 -6
  57. package/dist/commands/import.js +0 -137
  58. package/dist/commands/import.js.map +0 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <h1 align="center">Reply.io CLI</h1>
2
2
 
3
3
  <p align="center">
4
- Manage sequences, contacts, email accounts, and schedules — directly from your terminal.
4
+ Manage contacts, lists, sequences, inbox, and reports — directly from your terminal.
5
5
  </p>
6
6
 
7
7
  <p align="center">
@@ -14,428 +14,171 @@
14
14
 
15
15
  ## Overview
16
16
 
17
- `reply-cli` is the command-line interface for [Reply.io](https://reply.io). It installs the `reply` command for managing your outreach from the terminal:
18
-
19
- | Command | What it does |
20
- |---|---|
21
- | `reply sequences` | List, create, clone, start, pause, and archive outreach sequences |
22
- | `reply sequences stats` | View per-step performance, top performers, and aggregate summary |
23
- | `reply sequence-contacts` | Add and remove contacts from sequences |
24
- | `reply contacts` | Create, update, delete, and search contacts with lifecycle actions |
25
- | `reply accounts` | List connected email accounts |
26
- | `reply schedules` | Manage sending schedules |
27
- | `reply import` | Import contacts from CSV with column mapping |
28
-
29
- ---
30
-
31
- ## Table of Contents
32
-
33
- - [Installation](#installation)
34
- - [Quick Start](#quick-start)
35
- - [Authentication](#authentication)
36
- - [Commands](#commands)
37
- - [sequences](#sequences)
38
- - [sequences stats](#sequences-stats)
39
- - [sequence-contacts](#sequence-contacts)
40
- - [contacts](#contacts)
41
- - [import](#import)
42
- - [accounts](#accounts)
43
- - [schedules](#schedules)
44
- - [Output Modes](#output-modes)
45
- - [Pipe-Friendly Usage](#pipe-friendly-usage)
46
- - [Troubleshooting](#troubleshooting)
47
-
48
- ---
49
-
50
- ## Installation
51
-
52
- > **Requires [Node.js](https://nodejs.org/) >= 20**
17
+ `reply-cli` is the command-line interface for the [Reply.io](https://reply.io) **v3 API**. It installs the `reply` command — deterministic, scriptable, and built for humans, CI, and AI agents alike:
53
18
 
54
19
  ```bash
55
20
  npm install -g reply-cli
56
- ```
57
-
58
- Or run without installing:
59
-
60
- ```bash
61
- npx reply-cli sequences list
62
- ```
63
-
64
- ---
65
-
66
- ## Quick Start
67
-
68
- ```bash
69
- # 1. Set your API key
70
- export REPLY_API_KEY=your-api-key
71
-
72
- # 2. List your sequences
73
- reply sequences list
74
-
75
- # 3. Create a contact
76
- reply contacts create --email john@example.com --first-name John --company Acme
77
-
78
- # 4. Add the contact to a sequence
79
- reply sequence-contacts add --contact john@example.com --sequence 12345
80
-
81
- # 5. Check sequence performance
82
- reply sequences stats 12345
83
-
84
- # 6. View aggregate stats
85
- reply sequences stats --summary
86
- ```
87
-
88
- ---
89
-
90
- ## Authentication
91
21
 
92
- Get your API key from [Reply.io Settings > API](https://run.reply.io/Dashboard/Material#/settings/api).
93
-
94
- ```bash
95
- # Environment variable
96
22
  export REPLY_API_KEY=your-api-key
97
-
98
- # Or pass directly to any command
99
- reply sequences list --api-key your-api-key
100
-
101
- # Or put it in a .env file in your project directory
102
- echo "REPLY_API_KEY=your-api-key" >> .env
23
+ reply auth whoami
24
+ reply sequences list --status active
25
+ reply contacts import prospects.csv --dry-run
103
26
  ```
104
27
 
105
- **Resolution order** (highest priority first):
28
+ **Who it's for**
106
29
 
107
- ```
108
- --api-key flag → REPLY_API_KEY env var → .env file (walks up directories)
109
- ```
30
+ - **Humans** who prefer the terminal over the web app for routine operations
31
+ - **Shell scripts and CI** that automate outreach workflows
32
+ - **AI agents** (Claude Code, Codex, Cursor, and friends) that need a predictable execution layer — see the [Reply.io Agent Skill](https://github.com/replyio/reply-skill), which drives this CLI
110
33
 
111
34
  ---
112
35
 
113
- ## Commands
114
-
115
- ### `sequences`
116
-
117
- Manage outreach sequences (campaigns).
118
-
119
- ```bash
120
- reply sequences list # List all sequences with stats
121
- reply sequences get <id> # Get details and email steps
122
- reply sequences create # Create from stdin JSON
123
- reply sequences update <id> # Update settings from stdin JSON
124
- reply sequences clone <id> --name "New Name" # Clone with all steps
125
- reply sequences start <id> # Start sending emails
126
- reply sequences pause <id> # Pause sending
127
- reply sequences archive <id> # Archive sequence
128
- ```
129
-
130
- **Examples**
131
-
132
- ```bash
133
- # List all sequences
134
- reply sequences list
135
-
136
- # Get sequence details as JSON
137
- reply sequences get 12345 --json
138
-
139
- # Create a sequence from a config file
140
- cat config.json | reply sequences create
141
-
142
- # Clone a sequence
143
- reply sequences clone 12345 --name "Q2 Outreach"
144
-
145
- # Start a paused sequence
146
- reply sequences start 12345
147
- ```
148
-
149
- **Create sequence JSON format:**
150
-
151
- ```json
152
- {
153
- "name": "My Sequence",
154
- "emailAccounts": ["sender@company.com"],
155
- "settings": {
156
- "emailsCountPerDay": 50,
157
- "daysToFinishProspect": 7,
158
- "EmailSendingDelaySeconds": 55
159
- },
160
- "steps": [
161
- {
162
- "number": "1",
163
- "InMinutesCount": "0",
164
- "templates": [{ "subject": "Quick question", "body": "Hi {{FirstName}}!" }]
165
- },
166
- {
167
- "number": "2",
168
- "InMinutesCount": "1440",
169
- "templates": [{ "subject": "Following up", "body": "Hi {{FirstName}}, just checking in." }]
170
- }
171
- ]
172
- }
173
- ```
174
-
175
- ---
176
-
177
- ### `sequences stats`
178
-
179
- View sequence performance statistics.
180
-
181
- ```bash
182
- reply sequences stats <id> # Detailed per-step stats for a sequence
183
- reply sequences stats --top # Top 3 sequences by reply rate
184
- reply sequences stats --summary # Aggregate performance across all sequences
185
- ```
186
-
187
- **Examples**
36
+ ## Installation
188
37
 
189
38
  ```bash
190
- # Per-step breakdown: sent, opens, replies, bounces, clicks
191
- reply sequences stats 12345
192
-
193
- # Top performers
194
- reply sequences stats --top
195
-
196
- # Account-wide summary as JSON
197
- reply sequences stats --summary --json
39
+ npm install -g reply-cli # installs the `reply` command
40
+ # or run without installing:
41
+ npx -y reply-cli auth whoami
198
42
  ```
199
43
 
200
- ---
201
-
202
- ### `sequence-contacts`
44
+ Requires Node.js 20+.
203
45
 
204
- Add or remove contacts from sequences.
46
+ ## Authentication
205
47
 
206
- ```bash
207
- reply sequence-contacts add --contact <email> --sequence <id> [--force]
208
- reply sequence-contacts add-new --contact <email> --first-name <name> --sequence <id>
209
- reply sequence-contacts add-bulk --contacts <ids> --sequence <id> [--overwrite]
210
- reply sequence-contacts remove --contact <email> --sequence <id>
211
- reply sequence-contacts remove-all --contact <email>
212
- ```
48
+ The CLI uses your Reply.io API key (Reply → **Settings → API Keys**) against the v3 API (`Authorization: Bearer`). Resolution order:
213
49
 
214
- | Subcommand | What it does |
215
- |---|---|
216
- | `add` | Enroll an existing contact in a sequence. `--force` moves from another active sequence |
217
- | `add-new` | Create a contact and enroll in one step |
218
- | `add-bulk` | Enroll multiple contacts by ID (comma-separated) |
219
- | `remove` | Remove from a specific sequence |
220
- | `remove-all` | Remove from all sequences |
50
+ 1. `--api-key <key>` flag
51
+ 2. `REPLY_API_KEY` environment variable
52
+ 3. `REPLY_API_KEY=...` in a `.env` file (current directory or up to 5 parent directories)
221
53
 
222
- **Examples**
54
+ Verify your setup:
223
55
 
224
56
  ```bash
225
- # Add existing contact to sequence
226
- reply sequence-contacts add --contact john@co.com --sequence 12345
227
-
228
- # Create + enroll in one step
229
- reply sequence-contacts add-new --contact jane@co.com --first-name Jane --sequence 12345
230
-
231
- # Bulk enroll by contact IDs
232
- reply sequence-contacts add-bulk --contacts 111,222,333 --sequence 12345
233
-
234
- # Remove from all sequences
235
- reply sequence-contacts remove-all --contact john@co.com
57
+ reply auth whoami
58
+ # ✓ API key is valid.
236
59
  ```
237
60
 
238
- ---
239
-
240
- ### `contacts`
241
-
242
- Manage contacts (prospects).
61
+ The key is never logged or written anywhere by the CLI.
243
62
 
244
- ```bash
245
- reply contacts list [--page N --limit N] # Paginated contact list
246
- reply contacts get <id|email> # Contact details
247
- reply contacts create --email <email> --first-name <name> [options]
248
- reply contacts update --email <email> [options]
249
- reply contacts delete <id|email> # Delete a contact
250
- reply contacts search --email <email> # Search by email
251
- reply contacts search --linkedin <url> # Lookup by LinkedIn URL
252
- reply contacts mark-replied <email> # Mark as replied in all sequences
253
- reply contacts mark-finished <email> # Mark as finished in all sequences
254
- reply contacts opt-out <email> # Remove from all sequences
255
- reply contacts stats <email> # Campaign history and email activity
256
- ```
63
+ ## Commands
257
64
 
258
- | Flag | Description |
65
+ | Command | Description |
259
66
  |---|---|
260
- | `--email <email>` | Email address (required for create/update) |
261
- | `--first-name <name>` | First name (required for create) |
262
- | `--last-name <name>` | Last name |
263
- | `--company <company>` | Company name |
264
- | `--title <title>` | Job title |
265
- | `--phone <phone>` | Phone number |
266
- | `--linkedin <url>` | LinkedIn profile URL |
267
- | `--city`, `--state`, `--country` | Location fields |
268
- | `--custom <fields>` | Custom fields: `Key1=Val1,Key2=Val2` |
269
-
270
- **Examples**
271
-
272
- ```bash
273
- # Create a contact
274
- reply contacts create --email john@co.com --first-name John --company Acme --title CEO
275
-
276
- # Update company
277
- reply contacts update --email john@co.com --company "New Corp"
67
+ | `reply auth whoami` | Verify API key, show user and team |
68
+ | `reply contacts list\|get\|create\|update\|delete` | Contact CRUD (by ID or email) |
69
+ | `reply contacts search` | Filter contacts (`--term`, `--list`, `--sequence`, `--rule prop=cond:value`) |
70
+ | `reply contacts statuses <id\|email>` | Opt-out, call, meeting, and per-sequence status |
71
+ | `reply contacts import <file.csv>` | CSV import with auto column mapping, dedupe options, `--dry-run` |
72
+ | `reply lists list\|get\|create\|add-contacts` | Contact lists |
73
+ | `reply sequences list\|get\|create\|update` | Sequences (create accepts `--name` or full JSON config on stdin) |
74
+ | `reply sequences start\|pause\|archive <id>` | Sequence lifecycle (start/archive prompt for confirmation) |
75
+ | `reply sequences stats [id]` | Performance for one or all sequences (`--top`, `--preset`, `--from/--to`) |
76
+ | `reply sequences contacts list\|add\|remove <id>` | Contacts within a sequence |
77
+ | `reply inbox threads list\|get` | Inbox threads (`--unread`, `--category`, `--sequence`, `--search`) |
78
+ | `reply inbox reply <thread-id>` | Send a reply on a thread (confirmation-gated) |
79
+ | `reply inbox categories list\|assign` | Inbox categories |
80
+ | `reply reports emails` | Account-level email performance overview |
81
+ | `reply reports sequences` | Per-sequence performance table |
82
+ | `reply email-accounts list\|check` | Connected sending accounts |
83
+ | `reply schedules list\|get` | Sending schedules |
278
84
 
279
- # View contact performance
280
- reply contacts stats john@co.com
85
+ Run `reply <group> --help` for flags and examples on every command.
281
86
 
282
- # Mark as finished
283
- reply contacts mark-finished john@co.com
284
- ```
87
+ ## JSON output & AI agents
285
88
 
286
- ---
287
-
288
- ### `import`
289
-
290
- Import contacts from CSV files.
89
+ Every command supports `--json` (compact) and `--pretty` (formatted). Data goes to **stdout**, status and errors go to **stderr** — safe to pipe:
291
90
 
292
91
  ```bash
293
- reply import preview --file <path> # Preview CSV and available fields
294
- reply import upload --file <path> --mapping <json> [opts] # Upload with column mapping
92
+ reply sequences list --status active --json | jq '.items[].id'
93
+ reply contacts search --term "acme.com" --all --json | jq '.count'
295
94
  ```
296
95
 
297
- | Flag | Description |
298
- |---|---|
299
- | `--file <path>` | Path to CSV file |
300
- | `--mapping <json>` | JSON mapping Reply fields to CSV column names |
301
- | `--list-id <id>` | Assign contacts to a list |
302
- | `--overwrite` | Overwrite existing contacts |
303
-
304
- **Examples**
96
+ Errors with `--json` emit a single machine-readable line on stderr:
305
97
 
306
- ```bash
307
- # Preview CSV structure and available Reply.io fields
308
- reply import preview --file contacts.csv
309
-
310
- # Upload with mapping
311
- reply import upload \
312
- --file contacts.csv \
313
- --mapping '{"email":"Email Address","firstName":"First Name","company":"Company"}' \
314
- --overwrite
98
+ ```json
99
+ {"error":{"status":404,"code":"contact.notFound","title":"Not Found","detail":"Contact with ID 999 not found","hint":"Resource not found. It may have been deleted."}}
315
100
  ```
316
101
 
317
- ---
102
+ **Exit codes**: `0` success · `1` API or runtime error · `2` usage error.
318
103
 
319
- ### `accounts`
104
+ ## Pagination
320
105
 
321
- Manage connected email accounts.
106
+ List commands take `--limit <n>` (default 25, max 1000), `--skip <n>`, and `--all` to fetch every page. `--all` responses are wrapped as `{"items":[…],"count":N,"pagesFetched":P}`. Rate limits (100/min, 3000/hr) are handled automatically — the client honors `Retry-After` and backs off on 429/5xx.
322
107
 
323
- ```bash
324
- reply accounts list # List all connected email accounts
325
- reply accounts check # Machine-readable check (ACCOUNTS_FOUND:<n> or NO_ACCOUNTS)
326
- ```
327
-
328
- ---
108
+ ## Safety flags
329
109
 
330
- ### `schedules`
110
+ Write operations are explicit:
331
111
 
332
- Manage sending schedules.
112
+ - **`--dry-run`** — bulk commands (`contacts import`, `sequences contacts add`, `lists add-contacts`) print what would happen (`{"dryRun":true,…}`) and make **zero** API calls.
113
+ - **`--yes`** — confirmation prompts (delete, import, start, archive, reply, add/remove sequence contacts) are interactive on a TTY; in scripts and agents, pass `--yes` explicitly. Without a TTY and without `--yes`, the command refuses (exit 1) rather than proceeding silently.
333
114
 
334
115
  ```bash
335
- reply schedules list # List all schedules
336
- reply schedules get <id> # Schedule details
337
- reply schedules create # Create from stdin JSON
338
- reply schedules delete <id> # Delete a schedule
339
- reply schedules set-default <id> # Set as the default schedule
116
+ reply contacts import prospects.csv --dry-run # inspect mapping first
117
+ reply contacts import prospects.csv --list 42 --skip-existing --yes --json
118
+ reply sequences contacts add 12345 --contacts john@co.com,jane@co.com --dry-run
119
+ reply sequences start 12345 --yes
340
120
  ```
341
121
 
342
- **Examples**
122
+ ## Automation examples
343
123
 
344
124
  ```bash
345
- # List schedules
346
- reply schedules list
347
-
348
- # Create a schedule
349
- echo '{
350
- "name": "Business Hours",
351
- "timezoneId": "Eastern Standard Time",
352
- "mainTimings": [
353
- {"weekDay":"Monday","isActive":true,"timeRanges":[{"fromTime":{"hour":9,"minute":0},"toTime":{"hour":17,"minute":0}}]},
354
- {"weekDay":"Tuesday","isActive":true,"timeRanges":[{"fromTime":{"hour":9,"minute":0},"toTime":{"hour":17,"minute":0}}]}
355
- ]
356
- }' | reply schedules create
357
-
358
- # Set as default
359
- reply schedules set-default 12345
360
- ```
361
-
362
- ---
363
-
364
- ## Output Modes
125
+ # Weekly performance digest
126
+ reply reports emails --preset lastWeek --json | jq '{delivered, replied, interested}'
365
127
 
366
- Every command supports:
128
+ # Pause every sequence with a reply rate under 1%
129
+ reply sequences stats --json \
130
+ | jq -r '.[] | select(.emailOverview.delivered > 100 and .emailOverview.repliedPercentage < 1) | .sequenceId' \
131
+ | xargs -I{} reply sequences pause {}
367
132
 
368
- | Mode | Flag | Behavior |
369
- |---|---|---|
370
- | Human-readable | *(default)* | Formatted table with colors |
371
- | JSON | `--json` | Compact JSON to stdout |
372
- | Pretty JSON | `--pretty` | Indented JSON to stdout |
373
-
374
- ```bash
375
- # Table output (default)
376
- reply sequences list
377
-
378
- # Compact JSON
379
- reply sequences list --json
380
-
381
- # Pretty JSON
382
- reply sequences list --pretty
133
+ # Import → verify → enroll
134
+ reply contacts import new-leads.csv --list 42 --skip-existing --yes --json
135
+ reply contacts search --list 42 --all --json | jq '.count'
136
+ reply sequences contacts add 12345 --contacts 111,222,333 --yes --json
383
137
  ```
384
138
 
385
- ---
139
+ ## Migration from 0.1.x
386
140
 
387
- ## Pipe-Friendly Usage
141
+ 0.2.0 moves the CLI from Reply's deprecated v1/v2 API to the current **v3 API**. Your API key keeps working — the commands changed:
388
142
 
389
- When stdout is not a TTY, colors are automatically disabled. Errors go to `stderr`, data to `stdout`.
143
+ | 0.1.x | 0.2.0 |
144
+ |---|---|
145
+ | `reply accounts list\|check` | `reply email-accounts list\|check` |
146
+ | `reply sequence-contacts add\|add-bulk` | `reply sequences contacts add` |
147
+ | `reply sequence-contacts remove\|remove-all` | `reply sequences contacts remove` |
148
+ | `reply import preview --file x.csv` | `reply contacts import x.csv --dry-run` |
149
+ | `reply import upload --file x.csv --mapping …` | `reply contacts import x.csv` (auto-mapping; `--mapping` to override) |
150
+ | `reply contacts list --page 2` | `reply contacts list --skip 25` (or `--all`) |
151
+ | `reply contacts stats <email>` | `reply contacts statuses <email>` |
152
+ | `reply contacts mark-replied\|mark-finished\|opt-out` | removed (v1-only actions) — use `reply contacts update` / `sequences contacts remove` |
153
+ | `reply sequences clone` | removed for now — planned for 0.3 via v3 templates |
154
+ | `reply schedules create\|delete\|set-default` | removed for now (read-only in 0.2) |
155
+ | numeric sequence statuses (`0/2/4`) | strings: `new` \| `active` \| `paused` \| `archived` |
390
156
 
391
- ```bash
392
- # Get all sequence IDs
393
- reply sequences list --json | jq '.[].id'
157
+ Write operations (start, delete, import, reply) now require a confirmation or `--yes` — update scripts accordingly.
394
158
 
395
- # Export contacts as JSON
396
- reply contacts list --limit 100 --json > contacts.json
159
+ ## Coming soon
397
160
 
398
- # Check if accounts exist in a script
399
- if reply accounts check 2>/dev/null; then
400
- echo "Accounts connected"
401
- fi
402
- ```
161
+ Not in this release because the underlying v3 endpoints aren't generally available yet:
403
162
 
404
- ---
163
+ - `reply prospects search` — Live Data B2B prospect search
164
+ - `reply contacts enrich` — email/phone enrichment
405
165
 
406
- ## Troubleshooting
166
+ See the [Reply.io API docs](https://docs.reply.io) for timing.
407
167
 
408
- **`REPLY_API_KEY not found`**
168
+ ## Development
409
169
 
410
170
  ```bash
411
- export REPLY_API_KEY=your-api-key
412
- # or
413
- echo "REPLY_API_KEY=your-api-key" >> .env
171
+ git clone https://github.com/replyio/reply-cli.git
172
+ cd reply-cli
173
+ npm install
174
+ npm run build # tsc → dist/
175
+ npm test # vitest unit tests (mocked fetch, no network)
176
+ REPLY_API_KEY=... npm run test:integration # live read-only smoke tests
177
+ node dist/index.js auth whoami
414
178
  ```
415
179
 
416
- **`Invalid API key`**
417
-
418
- Check your key at [Reply.io Settings > API](https://run.reply.io/Dashboard/Material#/settings/api).
180
+ Project layout: `src/index.ts` (program), `src/commands/*` (one file per command group), `src/utils/*` (client, auth, output, pagination, CSV). Dependencies are intentionally minimal: `commander` and `picocolors`.
419
181
 
420
- **`Rate limit exceeded`**
182
+ ## License
421
183
 
422
- Reply.io allows 15,000 API calls/month. Some endpoints (campaign list, stats) have a 10-second throttle between requests.
423
-
424
- **`Access denied`**
425
-
426
- You may need the owner/master API key for this operation.
427
-
428
- ---
429
-
430
- ## Links
431
-
432
- - [Reply.io](https://reply.io)
433
- - [Reply.io API Documentation](https://apidocs.reply.io)
434
- - [API Key Settings](https://run.reply.io/Dashboard/Material#/settings/api)
435
- - [Report an Issue](https://github.com/replyio/reply-cli/issues)
436
-
437
- ---
438
-
439
- <p align="center">
440
- <sub>MIT License</sub>
441
- </p>
184
+ MIT © Reply.io
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ import type { Print_opts } from '../utils/output';
3
+ declare const handle_whoami: (api_key: string, print_opts: Print_opts) => Promise<void>;
4
+ declare const auth_command: Command;
5
+ export { auth_command, handle_whoami };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handle_whoami = exports.auth_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_whoami = async (api_key, print_opts) => {
9
+ const result = await (0, client_1.get)(api_key, '/whoami');
10
+ if (print_opts.json || print_opts.pretty) {
11
+ (0, output_1.print)(result, print_opts);
12
+ return;
13
+ }
14
+ (0, output_1.success)('API key is valid.');
15
+ console.log(` User: ${output_1.pc.bold(result.username)} (ID: ${result.userId})`);
16
+ console.log(` Team: ${result.teamId}`);
17
+ };
18
+ exports.handle_whoami = handle_whoami;
19
+ const auth_command = new commander_1.Command('auth')
20
+ .description('Verify authentication');
21
+ exports.auth_command = auth_command;
22
+ auth_command
23
+ .command('whoami')
24
+ .description('Verify the API key and show the authenticated user')
25
+ .addHelpText('after', '\nExamples:\n reply auth whoami\n reply auth whoami --json')
26
+ .action(async function () {
27
+ const opts = this.optsWithGlobals();
28
+ const key = (0, auth_1.resolve_api_key)(opts.apiKey);
29
+ await handle_whoami(key, { json: opts.json, pretty: opts.pretty });
30
+ });
31
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,4CAAoC;AACpC,wCAA8C;AAC9C,4CAAmD;AASnD,MAAM,aAAa,GAAG,KAAK,EAAC,OAAe,EAAE,UAAsB,EAAC,EAAE;IAClE,MAAM,MAAM,GAAG,MAAM,IAAA,YAAG,EAAS,OAAO,EAAE,SAAS,CAAC,CAAC;IACrD,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,MAAM,EACxC,CAAC;QACG,IAAA,cAAK,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC1B,OAAO;IACX,CAAC;IACD,IAAA,gBAAO,EAAC,mBAAmB,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,YAAY,WAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC;AAeoB,sCAAa;AAbnC,MAAM,YAAY,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KACnC,WAAW,CAAC,uBAAuB,CAAC,CAAC;AAYlC,oCAAY;AAVpB,YAAY;KACP,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,oDAAoD,CAAC;KACjE,WAAW,CAAC,OAAO,EAAE,8DAA8D,CAAC;KACpF,MAAM,CAAC,KAAK;IACT,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,aAAa,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC"}
@@ -1,20 +1,35 @@
1
1
  import { Command } from 'commander';
2
2
  import type { Print_opts } from '../utils/output';
3
3
  declare const handle_list: (api_key: string, opts: {
4
- page?: string;
5
4
  limit?: string;
5
+ skip?: string;
6
+ all?: boolean;
6
7
  } & Print_opts) => Promise<void>;
7
8
  declare const handle_get: (api_key: string, id_or_email: string, print_opts: Print_opts) => Promise<void>;
8
9
  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>;
10
+ declare const handle_update: (api_key: string, id_or_email: string, opts: Record<string, string>, print_opts: Print_opts) => Promise<void>;
11
+ declare const handle_delete: (api_key: string, id_or_email: string, opts: {
12
+ yes?: boolean;
13
+ }) => Promise<void>;
11
14
  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>;
15
+ term?: string;
16
+ list?: string;
17
+ sequence?: string;
18
+ rule?: string[];
19
+ limit?: string;
20
+ skip?: string;
21
+ all?: boolean;
22
+ } & Print_opts) => Promise<void>;
23
+ declare const handle_statuses: (api_key: string, id_or_email: string, print_opts: Print_opts) => Promise<void>;
24
+ declare const handle_import: (api_key: string, file_path: string, opts: {
25
+ mapping?: string;
26
+ list?: string;
27
+ sequence?: string;
28
+ skipExisting?: boolean;
29
+ overwrite?: boolean;
30
+ detectTimezone?: boolean;
31
+ dryRun?: boolean;
32
+ yes?: boolean;
33
+ } & Print_opts) => Promise<undefined>;
19
34
  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, };
35
+ export { contacts_command, handle_list, handle_get, handle_create, handle_update, handle_delete, handle_search, handle_statuses, handle_import, };