OpenCLI Online

Feishu

Feishu CLI

Feishu Open Platform—bots, Bitable, and approval flows from the terminal.

TypeLink
Feishu Open Platformhttps://open.feishu.cn/
API / docs hubhttps://open.feishu.cn/document/
Developer console (apps & credentials)https://open.feishu.cn/app/

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

ItemNotes
App ID / App SecretFrom “Credentials & basic info”
Bot capabilitiesEnable required scopes (messages, contacts, …)
Node.js 20+Same as global opencli
curlOptional 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

Configure credentials

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
ItemNotes
tenant-tokenExchange app_id + app_secret for tenant_access_token
--printPrint 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

CommandDescription
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

CommandDescription
opencli feishu app infoPrint app id, name, status
opencli feishu app scopesList enabled permission scopes
opencli feishu app scopes

config

CommandDescription
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 pathPrint 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

CommandDescription
`opencli feishu message send —receive-id-type <chat_idopen_id
opencli feishu message send --receive-id-type chat_id --receive-id oc_xxxx --text "OpenCLI connectivity test"

bitable

CommandDescription
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

CommandDescription
opencli feishu drive file upload --path <local> [--name <display>]Upload asset, returns file_key

http (debugging)

CommandDescription
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

CommandDescription
opencli feishu events verify --url <public callback URL>Verify challenge URL (per implementation)

Debugging tips

  1. After setting the event callback URL in the console, use opencli feishu events tunnel (if available) for local reverse-proxy debugging.
  2. On errors like 99991663, check the Feishu error-code docs for scopes and IP allowlists.