@kyoji2/intercom-cli 0.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.
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/dist/index.js +25859 -0
- package/package.json +66 -0
- package/src/client.ts +132 -0
- package/src/commands/admins.ts +77 -0
- package/src/commands/articles.ts +229 -0
- package/src/commands/auth.ts +115 -0
- package/src/commands/companies.ts +176 -0
- package/src/commands/contacts.ts +410 -0
- package/src/commands/conversations.ts +350 -0
- package/src/commands/events.ts +91 -0
- package/src/commands/index.ts +82 -0
- package/src/commands/overview.ts +128 -0
- package/src/commands/tags.ts +112 -0
- package/src/index.ts +689 -0
- package/src/utils/config.ts +114 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/output.ts +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kyoji2
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Intercom CLI
|
|
2
|
+
|
|
3
|
+
AI-native CLI for Intercom - manage customer conversations, contacts, messages, and support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### From npm (recommended)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun install -g @kyoji2/intercom-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### From source
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/kyoji2/intercom-cli.git
|
|
17
|
+
cd intercom-cli
|
|
18
|
+
bun install
|
|
19
|
+
bun link
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Verify installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
intercom --version
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Prerequisites
|
|
29
|
+
|
|
30
|
+
- **Bun runtime** (v1.0 or later) - [Install Bun](https://bun.sh)
|
|
31
|
+
- **Intercom account** with API access token
|
|
32
|
+
|
|
33
|
+
### Getting an Access Token
|
|
34
|
+
|
|
35
|
+
1. Log in to your [Intercom workspace](https://app.intercom.com/)
|
|
36
|
+
2. Navigate to **Settings** → **Developers** → **Developer Hub**
|
|
37
|
+
3. Create a new app or select an existing one
|
|
38
|
+
4. Go to **Configure** → **Authentication**
|
|
39
|
+
5. Copy your **Access Token**
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Authentication
|
|
45
|
+
intercom login [token] # Login with your access token
|
|
46
|
+
intercom whoami # Show current admin and workspace
|
|
47
|
+
intercom logout # Remove credentials
|
|
48
|
+
|
|
49
|
+
# Get context about the account
|
|
50
|
+
intercom context # Admin info and workspace details
|
|
51
|
+
intercom schema # Show API schemas (for AI context)
|
|
52
|
+
|
|
53
|
+
# Manage contacts
|
|
54
|
+
intercom contact list # List contacts
|
|
55
|
+
intercom contact search --email "user@example.com"
|
|
56
|
+
intercom contact create --email "new@example.com" --name "John Doe"
|
|
57
|
+
intercom contact get <id>
|
|
58
|
+
intercom contact update <id> --name "New Name"
|
|
59
|
+
intercom contact delete <id>
|
|
60
|
+
|
|
61
|
+
# Manage conversations
|
|
62
|
+
intercom conversation list
|
|
63
|
+
intercom conversation search --state open
|
|
64
|
+
intercom conversation get <id>
|
|
65
|
+
intercom conversation reply <id> --admin <admin-id> --body "Thank you!"
|
|
66
|
+
intercom conversation close <id> --admin <admin-id>
|
|
67
|
+
|
|
68
|
+
# Manage companies
|
|
69
|
+
intercom company create --company-id "acme" --name "Acme Corp"
|
|
70
|
+
intercom company list
|
|
71
|
+
intercom company get <id>
|
|
72
|
+
|
|
73
|
+
# Manage tags
|
|
74
|
+
intercom tag list
|
|
75
|
+
intercom tag create "VIP Customer"
|
|
76
|
+
|
|
77
|
+
# Help center articles
|
|
78
|
+
intercom article list
|
|
79
|
+
intercom article search "getting started"
|
|
80
|
+
intercom article get <id>
|
|
81
|
+
|
|
82
|
+
# Track events
|
|
83
|
+
intercom event track --name "purchase" --user-id "user123"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Commands
|
|
87
|
+
|
|
88
|
+
### Authentication
|
|
89
|
+
|
|
90
|
+
| Command | Description |
|
|
91
|
+
|---------|-------------|
|
|
92
|
+
| `intercom login [token]` | Save access token (prompts if not provided) |
|
|
93
|
+
| `intercom logout` | Remove stored credentials |
|
|
94
|
+
| `intercom whoami` | Show current admin and workspace info |
|
|
95
|
+
| `intercom context` | Show account context (admins, workspace) |
|
|
96
|
+
| `intercom schema` | Output API schemas for AI context |
|
|
97
|
+
|
|
98
|
+
### Contacts
|
|
99
|
+
|
|
100
|
+
| Command | Description |
|
|
101
|
+
|---------|-------------|
|
|
102
|
+
| `intercom contact create` | Create a new contact |
|
|
103
|
+
| `intercom contact get <id>` | Get contact details |
|
|
104
|
+
| `intercom contact update <id>` | Update a contact |
|
|
105
|
+
| `intercom contact delete <id>` | Delete a contact |
|
|
106
|
+
| `intercom contact search` | Search contacts |
|
|
107
|
+
| `intercom contact list` | List contacts |
|
|
108
|
+
| `intercom contact note <id> <body>` | Add note to contact |
|
|
109
|
+
| `intercom contact notes <id>` | List contact notes |
|
|
110
|
+
| `intercom contact tag <id> <tag-id>` | Tag a contact |
|
|
111
|
+
| `intercom contact untag <id> <tag-id>` | Remove tag from contact |
|
|
112
|
+
| `intercom contact attach-company <id> <company-id>` | Attach contact to company |
|
|
113
|
+
|
|
114
|
+
### Conversations
|
|
115
|
+
|
|
116
|
+
| Command | Description |
|
|
117
|
+
|---------|-------------|
|
|
118
|
+
| `intercom conversation list` | List conversations |
|
|
119
|
+
| `intercom conversation get <id>` | Get conversation details |
|
|
120
|
+
| `intercom conversation search` | Search conversations |
|
|
121
|
+
| `intercom conversation reply <id>` | Reply to conversation |
|
|
122
|
+
| `intercom conversation assign <id>` | Assign conversation |
|
|
123
|
+
| `intercom conversation close <id>` | Close conversation |
|
|
124
|
+
| `intercom conversation open <id>` | Reopen conversation |
|
|
125
|
+
| `intercom conversation snooze <id>` | Snooze conversation |
|
|
126
|
+
|
|
127
|
+
### Companies
|
|
128
|
+
|
|
129
|
+
| Command | Description |
|
|
130
|
+
|---------|-------------|
|
|
131
|
+
| `intercom company create` | Create a company |
|
|
132
|
+
| `intercom company get <id>` | Get company details |
|
|
133
|
+
| `intercom company list` | List companies |
|
|
134
|
+
| `intercom company update <id>` | Update a company |
|
|
135
|
+
|
|
136
|
+
### Tags
|
|
137
|
+
|
|
138
|
+
| Command | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| `intercom tag list` | List all tags |
|
|
141
|
+
| `intercom tag create <name>` | Create a tag |
|
|
142
|
+
| `intercom tag get <id>` | Get tag details |
|
|
143
|
+
| `intercom tag delete <id>` | Delete a tag |
|
|
144
|
+
|
|
145
|
+
### Articles
|
|
146
|
+
|
|
147
|
+
| Command | Description |
|
|
148
|
+
|---------|-------------|
|
|
149
|
+
| `intercom article list` | List articles |
|
|
150
|
+
| `intercom article get <id>` | Get article details |
|
|
151
|
+
| `intercom article search <query>` | Search articles |
|
|
152
|
+
| `intercom article create` | Create an article |
|
|
153
|
+
| `intercom article update <id>` | Update an article |
|
|
154
|
+
| `intercom article delete <id>` | Delete an article |
|
|
155
|
+
|
|
156
|
+
### Admins
|
|
157
|
+
|
|
158
|
+
| Command | Description |
|
|
159
|
+
|---------|-------------|
|
|
160
|
+
| `intercom admin list` | List all admins |
|
|
161
|
+
| `intercom admin get <id>` | Get admin details |
|
|
162
|
+
|
|
163
|
+
### Events
|
|
164
|
+
|
|
165
|
+
| Command | Description |
|
|
166
|
+
|---------|-------------|
|
|
167
|
+
| `intercom event track` | Track a custom event |
|
|
168
|
+
| `intercom event list` | List events for a user |
|
|
169
|
+
|
|
170
|
+
## Global Options
|
|
171
|
+
|
|
172
|
+
All commands support:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
--dry-run # Log actions without making API calls
|
|
176
|
+
-f, --format <format> # Output format: toon (default) or json
|
|
177
|
+
-v, --version # Show version
|
|
178
|
+
-h, --help # Show help
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Output Formats
|
|
182
|
+
|
|
183
|
+
### TOON (Default)
|
|
184
|
+
|
|
185
|
+
Token-optimized format designed for AI agents:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
field_name: value
|
|
189
|
+
another_field: value
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### JSON
|
|
193
|
+
|
|
194
|
+
Standard JSON output with `--format json`:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"field_name": "value"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Environment Variables
|
|
203
|
+
|
|
204
|
+
| Variable | Description |
|
|
205
|
+
|----------|-------------|
|
|
206
|
+
| `INTERCOM_ACCESS_TOKEN` | Access token (takes priority over config file) |
|
|
207
|
+
|
|
208
|
+
## Configuration
|
|
209
|
+
|
|
210
|
+
Credentials are stored in `~/.config/intercom-cli/config.json`
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Run in development mode
|
|
216
|
+
bun run dev
|
|
217
|
+
|
|
218
|
+
# Run tests
|
|
219
|
+
bun test
|
|
220
|
+
|
|
221
|
+
# Lint code
|
|
222
|
+
bun run lint
|
|
223
|
+
|
|
224
|
+
# Format code
|
|
225
|
+
bun run format
|
|
226
|
+
|
|
227
|
+
# Type check
|
|
228
|
+
bun run typecheck
|
|
229
|
+
|
|
230
|
+
# Build
|
|
231
|
+
bun run build
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## License
|
|
235
|
+
|
|
236
|
+
MIT
|