npm package: @intercom/cli
Description: CLI tool for managing Intercom workspaces
Latest version: 0.3.1

# Intercom CLI

CLI tool for managing Intercom workspaces. Designed for both human operators and AI agents.

## Install

```bash
npm install -g @intercom/cli
```

## Quick Start

```bash
# Authenticate with your API token
export INTERCOM_TOKEN="<your-token>"

# Check your identity
intercom me

# List help center articles
intercom articles list

# Get a conversation
intercom conversations get <conversation-id>

# Set up a workspace with articles and Fin
intercom setup --company-name "Acme" --articles-from ./docs
```

## Commands

| Command | Description |
|---|---|
| `intercom api <endpoint>` | Raw API access (like `gh api`) |
| `intercom auth login\|logout\|status\|list\|switch` | Manage authentication |
| `intercom auth bootstrap\|signup\|verify-email` | Workspace provisioning |
| `intercom me` | Show current admin and workspace |
| `intercom articles list\|get\|create\|update\|delete` | Manage help center articles |
| `intercom contacts list\|get\|create\|update\|delete\|search` | Manage contacts |
| `intercom conversations list\|get\|reply\|search` | Manage conversations |
| `intercom help-center list\|get\|create` | Manage help center collections |
| `intercom messenger get\|update\|snippet` | Configure Messenger |
| `intercom fin manifest\|enable\|download` | Fin AI Agent core |
| `intercom fin procedures list\|get\|validate\|test\|publish` | Fin procedures |
| `intercom fin guidance\|attributes\|audiences\|workflows\|simulations` | Fin SDK resources |
| `intercom fin data-connectors list\|get` | Fin data connectors |
| `intercom setup` | Orchestrate full workspace setup |
| `intercom config get\|set\|list` | Manage CLI configuration |
| `intercom pricing` | Show current Intercom pricing |
| `intercom completion bash\|zsh\|fish` | Generate shell completions |

## Global Flags

| Flag | Description |
|---|---|
| `--json` | Output as pretty-printed JSON |
| `--jq <expr>` | Filter JSON output (subset of jq) |
| `--workspace <id>` | Override default workspace |
| `--verbose` | Show HTTP request/response details |
| `--no-retry` | Disable automatic rate limit retry |
| `--timeout <seconds>` | Request timeout in seconds |
| `--agent` | Force machine-readable output (JSON/NDJSON) |
| `--human` | Force human-readable output even when piped |
| `--wide` | Show all columns with wider truncation |
| `--version` | Print CLI version |

## Agent / Pipe Mode

When stdout is not a TTY (piped to another program), the CLI automatically outputs compact NDJSON — one JSON object per line. No flag needed:

```bash
# Automatic NDJSON when piped
intercom articles list | jq '.title'

# Force JSON with flag
intercom articles list --json

# Filter inline
intercom articles list --jq '.data[].title'
```

## Raw API Access

The `intercom api` command provides direct access to any Intercom API endpoint:

```bash
# GET request (default)
intercom api /me

# POST with fields
intercom api /articles -f title="Hello" -f author_id=123

# Typed fields (booleans, numbers, file reads)
intercom api /articles -F draft:=true -F body=@article.html

# Auto-paginate
intercom api /articles --paginate

# Use jq to filter
intercom api /contacts --jq '.data[].email'
```

## Environment Variables

| Variable | Description |
|---|---|
| `INTERCOM_TOKEN` | API token (bypasses credential store) |
| `INTERCOM_API_BASE_URL` | Override API base URL |
| `INTERCOM_APP_BASE_URL` | Override app base URL |
| `INTERCOM_CONFIG_DIR` | Override config directory |
| `INTERCOM_PASSWORD` | Password for signup/bootstrap |

## Development

```bash
git clone git@github.com:intercom/cli.git
cd cli
npm ci
npm run build   # Build to dist/
npm test        # Run tests (~5s)
npm run lint    # TypeScript typecheck
npm run dev     # Watch mode

# Try it locally
export INTERCOM_TOKEN="<your-token>"
node dist/index.js me
```

See [SETUP.md](SETUP.md) for full developer setup guide.

## License

MIT