Install Cli

作者 intercom62773a7d4b8aMIT收录于 2026年10月8日更新于 2026年10月8日

Install and authenticate the Intercom CLI (`@intercom/cli`) — a command-line tool for managing Intercom workspaces, designed for both human operators and AI agents. Use when the user asks to "install the Intercom CLI", "set up the intercom command", "install @intercom/cli", or wants shell access to their Intercom workspace.

仅含说明DevOps & Cloud
AI 生成的概览

全局安装并验证 Intercom CLI,涵盖工作区设置、验证与故障排查。

功能
指导全局安装 @intercom/cli npm 包,并说明如何将其与 Intercom 工作区进行身份验证,可使用现有访问令牌或配置新工作区。内容包括验证步骤、可选的 shell 补全、多工作区处理,以及常见安装、认证和区域错误的排查方法。最终产出的是一个可用且已认证的命令行工具,而非文件产物。
适用场景
当用户要求安装 Intercom CLI、设置 intercom 命令、安装 @intercom/cli,或希望以 shell 方式访问其 Intercom 工作区时使用。适用于人工交互操作以及自动化或代理场景。
运行要求
需要 Node.js >= 20.6.0 和 npm;需要访问 npm 仓库和 Intercom API 的网络连接;需要 Intercom 访问令牌或新工作区的凭据。该技能不包含脚本,仅为说明文档。

Install Intercom CLI

Install the @intercom/cli package globally and authenticate it against the user's workspace. The CLI complements this plugin: the plugin is for in-conversation MCP usage, while the CLI is for shell access, scripting, and workspace provisioning.

Prerequisites

Before installing, verify the user has:

  1. Node.js >= 20.6.0 — Run node --version to check. If missing or older, direct them to install via nodejs.org or their version manager (nvm, fnm, volta).
  2. npm — Comes bundled with Node.

If node --version returns < 20.6.0, stop and ask the user to upgrade before proceeding. The CLI will not run on older versions.

Step 1: Install Globally

bash
npm install -g @intercom/cli

Verify the install:

bash
intercom --version

If the user gets a permission error (EACCES) on macOS or Linux, they likely have a system Node install. Recommend either:

  • Switching to a user-managed Node via nvm/fnm/volta (preferred), or
  • Configuring an npm prefix under their home directory.

Do not suggest sudo npm install -g — installing global packages as root is a known footgun and will cause permissions issues on later updates.

Step 2: Authenticate

There are two paths. Ask the user which applies.

Path A: Existing Workspace (most common)

The user has an Intercom workspace and needs to connect the CLI to it.

  1. Direct them to the Developer Hub.
  2. Click New app (or select an existing app).
  3. Under Authentication, copy the Access Token.
  4. Authenticate one of two ways:

Option 1 — Persistent (recommended for interactive use):

bash
intercom auth login --token "<paste-token-here>"

This stores the token in the OS keyring (Keychain on macOS, Secret Service on Linux, Credential Manager on Windows) so future commands don't need the env var.

Option 2 — Environment variable (recommended for CI / scripting):

bash
export INTERCOM_TOKEN="<paste-token-here>"

Add this to ~/.zshrc, ~/.bashrc, or the equivalent so it persists across shells. For CI, set it as a secret in the pipeline config.

The env var takes precedence over the keyring-stored credential when both are present.

Path B: New Workspace (provisioning)

The user wants to create a brand-new Intercom workspace from scratch — no token needed.

bash
intercom setup --company-name "Acme"

This command provisions a workspace, signs the user in, and stores the resulting credentials. The CLI will prompt for an email, password, and verification code during the flow.

If the user has additional setup needs (importing articles, enabling Fin, etc.), point them at:

bash
intercom setup --help

Step 3: Verify

Run:

bash
intercom me

Expected output: the admin's name, email, and the active workspace ID. If this fails:

ErrorLikely CauseFix
Not authenticatedNo token in keyring or envRe-run Step 2
401 UnauthorizedToken revoked or wrong workspaceGenerate a new token in the Developer Hub
command not found: intercomGlobal install path not on $PATHRun npm config get prefix, ensure <prefix>/bin is on $PATH

Step 4 (Optional): Shell Completions

Recommend this only if the user uses intercom interactively in their shell.

bash
# zsh — append to ~/.zshrcintercom completion zsh >> ~/.zshrc
# bash — append to ~/.bashrcintercom completion bash >> ~/.bashrc
# fishintercom completion fish > ~/.config/fish/completions/intercom.fish

Restart the shell or source the rc file for completions to take effect.

Quick Reference

After install, the user can run any of these. Don't dump this whole list at them — surface relevant commands based on their goal.

CommandPurpose
intercom meShow current admin + workspace
intercom api <endpoint>Raw API access (like gh api)
intercom articles list|get|searchHelp center articles
intercom contacts list|get|searchContacts
intercom conversations list|get|searchConversations
intercom fin manifest|enable|downloadFin AI Agent
intercom messenger get|update|snippetMessenger config
intercom config listShow CLI config

Full reference: @intercom/cli README.

Agent / Pipe Mode

The CLI auto-detects when stdout is piped and switches to compact NDJSON (one JSON object per line). This makes it ergonomic for scripts and AI agents:

bash
# Auto NDJSON when pipedintercom articles list | jq '.title'
# Force JSONintercom articles list --json
# Inline jq filterintercom articles list --jq '.data[].title'

If the user is using the CLI from a Claude Code agent or other automation, prefer --json or --jq over parsing human-formatted output.

Multi-Workspace

If the user manages multiple workspaces:

bash
intercom auth list                  # show stored credentialsintercom auth switch <workspace>    # change defaultintercom me --workspace <id>        # one-off override

Each workspace's credential is stored separately in the keyring.

Troubleshooting

npm install -g Hangs or Fails on Corporate Network

The user's npm registry may be proxied. Check npm config get registry — if it points at an internal mirror, that mirror may not have @intercom/cli published. Set the registry explicitly for this install:

bash
npm install -g @intercom/cli --registry=https://registry.npmjs.org

intercom Command Found But Crashes Immediately

Usually a Node version mismatch. Run node --version and confirm it's >= 20.6.0. If using nvm, ensure the active version (nvm current) is the one the global install used.

Token Stored But Commands Still Fail With 401

The INTERCOM_TOKEN env var overrides the keyring. Run unset INTERCOM_TOKEN and try again — a stale env var may be shadowing a fresh keyring credential.

Wrong Region (EU / Australia)

The CLI defaults to the US API. If the workspace is hosted in EU or Australia:

bash
export INTERCOM_API_BASE_URL="https://api.eu.intercom.io"      # EUexport INTERCOM_API_BASE_URL="https://api.au.intercom.io"      # Australia

Set this in the shell rc file alongside the token.

来源与署名

来源:intercom/claude-plugin-external位于skills/install-cli提交62773a7

许可证: MIT

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架