Feishu Open Platform—bots, Bitable, and approval flows from the terminal.
Official & reference links
All opencli feishu subcommands are listed under “Command reference”; HTTP details remain in the official docs, but this page lists every CLI entry point.
Overview
opencli feishu wraps common Open Platform tasks: app credentials, long-connection debugging, Bitable import/export, etc. Assumes you already created an enterprise app in the Feishu Open Platform.
Prerequisites
| Item | Notes |
|---|
| App ID / App Secret | From “Credentials & basic info” |
| Bot capabilities | Enable required scopes (messages, contacts, …) |
| Node.js 20+ | Same as global opencli |
curl | Optional for gateway checks |
Install
After installing the main CLI globally, the Feishu module ships with it:
npm install -g @opencli/cli@latest
opencli feishu --help
Internal registry:
npm install -g @opencli/cli@latest --registry=https://your-registry.example.com
Never commit secrets to Git. Prefer environment variables or encrypted local config.
Option A: environment variables (CI / local shell)
export FEISHU_APP_ID=cli_xxxxxxxx
export FEISHU_APP_SECRET=xxxxxxxxxxxxxxxx
FEISHU_APP_ID: app id, usually cli_ prefix.
FEISHU_APP_SECRET: server-side only.
Option B: OpenCLI local config
opencli feishu config init --app-id cli_xxxxxxxx
opencli feishu config set app_secret --from-env FEISHU_APP_SECRET
config init: creates ~/.opencli/feishu.json skeleton with app_id.
config set app_secret --from-env: reads secret from env into encrypted storage (avoids shell history).
Obtain tenant_access_token
Most business APIs need a tenant token:
opencli feishu auth tenant-token --print
| Item | Notes |
|---|
tenant-token | Exchange app_id + app_secret for tenant_access_token |
--print | Print token to stdout for piping to curl (clear screen after debugging) |
Tokens cache under ~/.opencli/feishu/cache.json and refresh before expiry.
Command reference (full)
opencli feishu --help
auth
| Command | Description |
|---|
opencli feishu auth tenant-token [--print] [--no-cache] | Fetch/cache tenant_access_token; --print to stdout |
opencli feishu auth app-token [--print] | App-level token flows (per tenant setup) |
opencli feishu auth tenant-token --print
app
| Command | Description |
|---|
opencli feishu app info | Print app id, name, status |
opencli feishu app scopes | List enabled permission scopes |
opencli feishu app scopes
config
| Command | Description |
|---|
opencli feishu config init --app-id <id> | Initialize local config |
opencli feishu config set <key> --value <v> | Set a key |
opencli feishu config set <key> --from-env <ENV> | Read from env (e.g. secret) |
opencli feishu config get <key> | Read one key |
opencli feishu config path | Print config file path |
opencli feishu config init --app-id cli_xxxxxxxx
opencli feishu config set app_secret --from-env FEISHU_APP_SECRET
opencli feishu config path
message
| Command | Description |
|---|
| `opencli feishu message send —receive-id-type <chat_id | open_id |
opencli feishu message send --receive-id-type chat_id --receive-id oc_xxxx --text "OpenCLI connectivity test"
bitable
| Command | Description |
|---|
opencli feishu bitable export --app-token <t> --table-id <tbl> --out <file> | Export CSV |
opencli feishu bitable records list --app-token <t> --table-id <tbl> [--page-size N] [--page-token <t>] | Paginated records |
opencli feishu bitable export --app-token BaseAppToken --table-id tblXXXX --out ./export.csv
drive
| Command | Description |
|---|
opencli feishu drive file upload --path <local> [--name <display>] | Upload asset, returns file_key |
http (debugging)
| Command | Description |
|---|
opencli feishu http get <open-api-path> [--query k=v ...] | Authenticated GET |
opencli feishu http post <open-api-path> --body '<json>' | Authenticated POST JSON |
events
| Command | Description |
|---|
opencli feishu events verify --url <public callback URL> | Verify challenge URL (per implementation) |
Debugging tips
- After setting the event callback URL in the console, use
opencli feishu events tunnel (if available) for local reverse-proxy debugging.
- On errors like
99991663, check the Feishu error-code docs for scopes and IP allowlists.