@stephendolan/helpscout-cli 1.0.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 ADDED
@@ -0,0 +1,216 @@
1
+ # Help Scout CLI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@stephendolan/helpscout-cli.svg)](https://www.npmjs.com/package/@stephendolan/helpscout-cli)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@stephendolan/helpscout-cli.svg)](https://www.npmjs.com/package/@stephendolan/helpscout-cli)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Node.js Version](https://img.shields.io/node/v/@stephendolan/helpscout-cli.svg)](https://nodejs.org)
7
+
8
+ A command-line interface for Help Scout's Mailbox API 2.0, designed for LLMs and developers to quickly interface with Help Scout data.
9
+
10
+ ## Features
11
+
12
+ - **LLM-First Design**: JSON output by default for easy parsing and integration with AI assistants
13
+ - **Output Control**: Strip HTML from bodies, select specific fields, exclude API metadata
14
+ - **Advanced Search**: Full query syntax support for filtering conversations
15
+ - **Comprehensive Coverage**: Conversations, customers, tags, workflows, and mailboxes
16
+ - **Type Safety**: Built with TypeScript for robust error handling
17
+ - **Simple Authentication**: OAuth 2.0 credentials stored securely in OS keychain
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ # Install globally
23
+ npm install -g @stephendolan/helpscout-cli
24
+
25
+ # Or run directly without installing
26
+ npx @stephendolan/helpscout-cli conversations list
27
+ ```
28
+
29
+ ### Linux Prerequisites
30
+
31
+ Requires `libsecret` for keychain storage:
32
+
33
+ ```bash
34
+ # Ubuntu/Debian
35
+ sudo apt-get install libsecret-1-dev
36
+
37
+ # Fedora/RHEL
38
+ sudo dnf install libsecret-devel
39
+
40
+ # Arch Linux
41
+ sudo pacman -S libsecret
42
+ ```
43
+
44
+ Without `libsecret`, use the environment variables instead.
45
+
46
+ ### From Source
47
+
48
+ ```bash
49
+ git clone https://github.com/stephendolan/helpscout-cli.git
50
+ cd helpscout-cli
51
+ npm install
52
+ npm run link # Build and link globally
53
+ ```
54
+
55
+ ## Authentication
56
+
57
+ Help Scout uses OAuth 2.0 with Client Credentials. Create an OAuth application at [Help Scout > Your Profile > My Apps](https://secure.helpscout.net/authentication/authorizeClientApplication).
58
+
59
+ ```bash
60
+ helpscout auth login --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET
61
+ helpscout auth status # Check authentication status
62
+ helpscout auth logout # Remove stored credentials
63
+ ```
64
+
65
+ Or use environment variables:
66
+
67
+ ```bash
68
+ export HELPSCOUT_APP_ID=your_app_id
69
+ export HELPSCOUT_APP_SECRET=your_app_secret
70
+ export HELPSCOUT_MAILBOX_ID=your_default_mailbox_id # Optional
71
+ ```
72
+
73
+ ## Usage
74
+
75
+ ### Conversations
76
+
77
+ ```bash
78
+ # List conversations
79
+ helpscout conversations list
80
+ helpscout conversations list --status active
81
+ helpscout conversations list --mailbox 123 --tag urgent
82
+
83
+ # Advanced search
84
+ helpscout conversations list -q 'status:open tag:urgent'
85
+ helpscout conversations list -q 'customer:john@example.com'
86
+
87
+ # Aggregated summary
88
+ helpscout conversations list --summary
89
+
90
+ # View a conversation
91
+ helpscout conversations view 456
92
+
93
+ # View conversation threads
94
+ helpscout conversations threads 456
95
+
96
+ # Add/remove tags
97
+ helpscout conversations add-tag 456 urgent
98
+ helpscout conversations remove-tag 456 urgent
99
+
100
+ # Reply to a conversation
101
+ helpscout conversations reply 456 --text "Thank you for reaching out!"
102
+
103
+ # Add a note
104
+ helpscout conversations note 456 --text "Internal note here"
105
+
106
+ # Delete a conversation
107
+ helpscout conversations delete 456
108
+ ```
109
+
110
+ ### Customers
111
+
112
+ ```bash
113
+ # List customers
114
+ helpscout customers list
115
+ helpscout customers list --first-name John
116
+
117
+ # View a customer
118
+ helpscout customers view 789
119
+
120
+ # Create a customer
121
+ helpscout customers create --first-name John --last-name Doe --email john@example.com
122
+
123
+ # Update a customer
124
+ helpscout customers update 789 --organization "Acme Corp"
125
+
126
+ # Delete a customer
127
+ helpscout customers delete 789
128
+ ```
129
+
130
+ ### Tags
131
+
132
+ ```bash
133
+ # List all tags
134
+ helpscout tags list
135
+
136
+ # View a tag
137
+ helpscout tags view 123
138
+ ```
139
+
140
+ ### Workflows
141
+
142
+ ```bash
143
+ # List workflows
144
+ helpscout workflows list
145
+ helpscout workflows list --type manual
146
+
147
+ # Run a manual workflow
148
+ helpscout workflows run 123 --conversations 456,789
149
+
150
+ # Activate/deactivate
151
+ helpscout workflows activate 123
152
+ helpscout workflows deactivate 123
153
+ ```
154
+
155
+ ### Mailboxes
156
+
157
+ ```bash
158
+ # List mailboxes
159
+ helpscout mailboxes list
160
+
161
+ # View a mailbox
162
+ helpscout mailboxes view 123
163
+
164
+ # Set default mailbox
165
+ helpscout mailboxes set-default 123
166
+ ```
167
+
168
+ ## Global Options
169
+
170
+ - `-c, --compact` - Output minified JSON (single line)
171
+ - `-p, --plain` - Strip HTML from body fields, output plain text
172
+ - `-f, --fields <fields>` - Comma-separated list of fields to include in output
173
+ - `--include-metadata` - Include `_links` and `_embedded` in responses (stripped by default)
174
+ - `--help` - Show help for any command
175
+
176
+ ## Output Format
177
+
178
+ All commands return JSON by default:
179
+
180
+ - **Lists**: Objects with data arrays and pagination info
181
+ - **Single items**: Objects directly
182
+ - **Errors**: `{"error": {"name": "...", "detail": "...", "statusCode": 400}}`
183
+
184
+ ### Working with JSON Output
185
+
186
+ ```bash
187
+ # Get all conversation subjects
188
+ helpscout conversations list | jq '.conversations[].subject'
189
+
190
+ # Get only id and subject fields
191
+ helpscout conversations list --fields id,subject
192
+
193
+ # Get plain text bodies (HTML stripped)
194
+ helpscout conversations threads 456 --plain
195
+
196
+ # Count conversations by status
197
+ helpscout conversations list --summary | jq '.byStatus'
198
+ ```
199
+
200
+ ## API Rate Limits
201
+
202
+ Help Scout enforces these rate limits:
203
+
204
+ - **200 requests per minute** per account
205
+ - **12 write requests per 5 seconds** (POST, PUT, DELETE)
206
+
207
+ When exceeded, the API returns HTTP 429 errors. The CLI will report these as JSON errors.
208
+
209
+ ## References
210
+
211
+ - [Help Scout API Documentation](https://developer.helpscout.com/mailbox-api/)
212
+ - [Help Scout Search Filters](https://docs.helpscout.com/article/47-search-filters-with-operators)
213
+
214
+ ## License
215
+
216
+ MIT