dsh-feishu-bind: Bind Feishu Bot via Browser QR Scan

Preface

Connecting Feishu (Lark) to DeepSeek Harness (dsh) typically involves SSHing into a machine to run a wizard, or relying on dsh’s built-in web interface to complete app creation and credential configuration. These steps are scattered across the terminal and multiple interfaces. When rebinding or running parallel multi-bots, one must manually manage env files and systemd units.

dsh-feishu-bind, published by community maintainer smallwhitelin, is categorized as a networking tool. The plugin starts a minimal HTTP service locally: opening it in a browser presents a QR code. After scanning the code with the Feishu App to authorize, credentials are written to a specified env file, and the bridge can optionally be auto-restarted. It functions without relying on the dsh web surface’s profile. The following section introduces its positioning, capabilities, and installation usage.

What is this

Browser Scan-to-Bind Feishu Bot — A small plugin for dsh. The plugin includes a node:http service (default 127.0.0.1:3001), with inject: [], and zero web dependencies.

The overall flow can be summarized as:

Browser ──GET /──► Plugin's built-in HTTP service (default 127.0.0.1:3001)
                        │
                        ├─ registerApp ──► Feishu Authorization Page (Scan → Create New / Update Existing App)
                        │
                        └─ Authorization Success → Write env file → Restart Bridge → Page shows Green Check (Wired)

Maintenance Repo: https://github.com/smallwhitelin/dsh-feishu-bind
Community Directory Page: https://www.skillhub.cn/plugins/smallwhitelin/dsh-feishu-bind
License: MIT (Consistent in README and package.json). The current package version in available data is 0.4.1, requiring Node.js >= 24.

Core Features

The following capabilities are derived from the repository README, categorized by use case.

Web Scanning & Status

Capability Description
Web Scan Opens the page to display a QR code, accessible via mobile or desktop browser
Green Check Status Writes credentials and restarts the bridge after scanning; the green check only appears if a newer long connection ready log appears after binding
Refresh to Swap Code Refreshing the page starts a new authorization round; old QR codes are invalidated
Click Green Check to Swap Clicking the green check after binding generates a new code; scanning it rebinds the bot

Apps & Permissions

  • Reuse Existing App: If FEISHU_APP_ID exists in env or config, it proceeds to “Update this app and re-authorize,” keeping the bot identity unchanged; if not, it creates a new one. forceCreate: true forces creating a new one every time.
  • Preset Permissions: The authorization page pre-checks im:message, im:message:send_as_bot, im:resource, as well as im.message.receive_v1 events and card.action.trigger callbacks.
  • Zero Heavy Dependencies: The Feishu device code flow is implemented within lib/register-app.js without pulling in @larksuiteoapi/node-sdk, avoiding interception by pnpm build scripts.

Multi-Bot Parallelism (Independent Instances)

“Create New App” can spawn a set of fully isolated instances: independent DSH_HOME, credentials, and systemd user services; plugin trees, model configs, memory, and skills each have their own copies, running in parallel with existing bots. The binding page only runs on the main instance (derived instances have DSH_BIND_ENABLED=0). The page allows “Bind with New App” specifying an instance name (default feishu2, feishu3, etc.).

Robustness

Missing dependencies, port occupation, or file write failures are only logged and reported on the page; they will not throw into the plugin tree. Pure logic and external side effects are injectable, and npm test requires no network or real SDK.

Installation & Enablement

Please review the repository source code and MIT license before installing; the plugin runs with the current dsh process permissions. The binding page can create Feishu apps and write credentials to the local machine, effectively acting as a local access point.

Direct installation method from README:

dsh plugin --profile <your profile> add github:smallwhitelin/dsh-feishu-bind
systemctl --user restart dsh-<your bridge>.service   # or other ways you start dsh

Local Package Installation

If installing from the source directory, the README specifies running npm pack (which runs tests) first, then adding the generated tgz:

cd dsh-feishu-bind
npm pack

dsh plugin --profile <your profile> add ./dsh-feishu-bind-<version>.tgz
systemctl --user restart dsh-<your bridge>.service

After startup, a line similar to the following should appear in dsh logs:

[feishu-bind] Binding page ready: http://127.0.0.1:3001/

Configuration

Default values are ready to use; overrides are written in the profile’s cordis.patch.yml, patching by plugin id feishu-bind. Do not modify the plugin’s bundled patch file.

- id: feishu-bind
  config:
    host: '127.0.0.1'
    port: 3001
    token: 'feishu888'       # Must change to your own; empty string = no password required
    envFile: '~/.config/dsh-feishu.env'
    stateFile: '~/.dsh/feishu-bind-state.json'
    serviceUnit: 'dsh-feishu.service'
    logFile: ''
    appId: ''
    appName: 'DSH Agent'
    appDesc: 'DeepSeek Harness Feishu Bot'
    autoRestart: true
    forceCreate: false

Key Points:

  • host / port: Defaults to listening only on local 127.0.0.1:3001.
  • token: Default feishu888. In production, change to a sufficiently long random string; '' disables the password (page warns: anyone with access to the URL can attempt to scan and bind).
  • envFile: Updates FEISHU_APP_ID / FEISHU_APP_SECRET / FEISHU_TENANT line by line, preserving other keys and comments, with 600 permissions. If left empty, credentials are only displayed on the page for manual configuration.
  • serviceUnit: The systemd user unit to restart upon successful binding; empty means no auto-restart.
  • independentInstances (README config table): Default true, spawns independent instances when creating new apps; false overwrites the current instance’s credentials.

To access from other devices, you must set up port forwarding or a reverse proxy yourself; if the address might be accessed by others, you must set a token and can open the page using ?k=<token>.

Typical Usage

After the installation and restart above, follow the README usage flow:

  1. Open http://127.0.0.1:3001/ in a browser → Enter access password (default feishu888) → QR code appears.
  2. Scan with Feishu App → Confirm app name and authorize on first use; existing apps will prompt to update and re-authorize.
  3. Page shows “Authorized, writing credentials and restarting bridge…”, then changes to ✓ Bound, Bridge Wired.
  4. Message the bot privately in Feishu; messages enter dsh.
  5. Rebind: Refresh page or click green check → New QR code → Scan again.

HTTP Interface (for automation or troubleshooting):

Method Path Description
GET / Binding page
GET /api/state State JSON
POST /api/qr Start new scanning round
POST /api/apply Manually rewrite credentials and restart bridge
POST /api/login Submit password
GET /healthz Liveness probe

phase transitions: idle → waiting → authorized → applying → bound / error.

Scenarios & Notes

Who is it for

  • Already using dsh + Feishu bridge, wanting to use a browser to complete app creation, env writing, and restarting with minimal terminal wizard interaction.
  • Need quick rebinding via refresh or clicking the green check, and want “Wired” status to rely on the updated long connection ready in logs, rather than false page success.
  • Need multiple Feishu bots running in parallel on the same machine, and accept independent instances having separate copies of plugin trees, memory, and skills (changes might require updating multiple places).

Security

  • Defaults to local listening only; when exposed to LAN or public network, token must be changed.
  • If no password is set, the scanner needs to be a Feishu tenant admin, but the bound app is controlled by their tenant.

Troubleshooting (Common Phenomena)

Phenomenon Handling
Page won’t open Check dsh logs [feishu-bind]; ss -ltnp \| grep <port> to check port occupation
Stuck waiting for scan QR code expires in ~10 min, click to swap; ensure machine can access Feishu
Stuck waiting for bridge restart/wiring systemctl --user status <serviceUnit>; logs need long connection ready

For Windows without systemd, the repository windows/ directory provides a scheduled task version of the flow and an isolation audit tool node windows/verify-iso.js <instance name>, semantics consistent with Linux side independent instances.

The DSH ecosystem emphasizes “Everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer. Please verify source code and permission requirements yourself before selecting plugins.

Conclusion

dsh-feishu-bind consolidates Feishu bot binding into a single line: “Open local page → Scan → Write env → Optional restart bridge,” supporting code swapping for rebinding and multi-instance isolation. If your workflow runs the dsh Feishu bridge via systemd user services, you can install via README and tighten token and paths in cordis.patch.yml.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye