# Feishu Diary for Obsidian [中文说明](#中文说明) Talk to a Feishu bot, and it lands in your Obsidian vault as a diary. No server required — everything goes through Feishu's official open platform APIs (WebSocket long connection). Also available as a **standalone CLI** — `npx feishu-diary` writes the same diary into any local directory, no Obsidian needed (see [CLI usage](#cli-usage)). ## Features - **Scan to set up**: create your Feishu app by scanning a QR code in the plugin settings — permissions and event subscriptions are pre-configured automatically - **Per-machine enable switch**: the bot service is off by default and toggled per machine (stored in local storage, not synced with your vault) — safe to run the same vault on multiple machines, only one of them listens - **Send anything, it's a diary entry**: each message becomes an entry in `FeishuDiary/YYYY/YYYY-MM.md` (one file per month, one `## day` section per day), with messages in the same minute sharing one timestamp heading - **Two-state reaction receipts**: ⏳ received → ✅ done, no chat noise; only commands and errors produce text replies - **Attachments**: images/videos embedded, files linked, voice notes stored as-is (Ogg/Opus, playable inside Obsidian) - **Natural language commands**: 撤回 (undo last) / 结束 / 晚安 (seal the day) / 在吗 (ping) / 记:xxx (force note) / 帮助 (help) / 叫我XX (set nickname) - **Daily reminder**: reminds you only if you haven't written today (default 21:30), goes silent after 3 unanswered days, catches up on launch - **Logical day boundary**: messages before 4 AM count as the previous day, while the timestamp heading keeps the real time - **Data contract**: append-only, atomic writes, frontmatter written once at creation, attachments never deleted (see `docs/DECISIONS.md`) ## Network usage This plugin connects to the following endpoints on your machine: - `open.feishu.cn` — Feishu Open Platform: send/receive messages, download message resources, manage the app you own - `accounts.feishu.cn` — scan-to-create-app device authorization (only when you use the QR setup) - `msg-frontier.feishu.cn` — WebSocket long connection for receiving messages Your App Secret is stored in Obsidian's SecretStorage, never in plugin data files. The bot only recognizes the first user who messages it (or the user who scanned the QR code) — no contact permissions are requested. ## Setup 1. Install the plugin and open its settings 2. Click "扫码创建" (Scan to create) and confirm on your phone — this creates a Feishu custom app with the required permissions (the "Enable on this machine" switch turns on automatically) 3. Publish the app version in the Feishu developer console (the QR flow pre-fills everything; publishing takes two clicks) 4. Find the bot in Feishu and start talking The bot service is **off by default** and toggled per machine via "在本机启用" (Enable on this machine) — the switch is stored locally and never synced with your vault, so multi-machine vaults only listen on the machines you choose. ## CLI usage The same pipeline ships as an npm package (`feishu-diary`) for headless environments — a home server, a NAS, a Raspberry Pi, or simply anywhere without Obsidian: ```sh npx feishu-diary init # scan a QR code to create the Feishu app, then publish it # (link provided) — writes ~/.feishu-diary.json (mode 600) npx feishu-diary # runs with zero arguments, reading that config file ``` Prefer explicit credentials? Everything is overridable (`args > env > config file > defaults`): ```sh npx feishu-diary --app-id cli_xxx --app-secret yyy --dir ~/diary # or via environment variables (a .env file works too, see --env-file) FEISHU_APP_ID=cli_xxx FEISHU_APP_SECRET=yyy npx feishu-diary --dir ~/diary ``` Run `npx feishu-diary --help` for the full option list; the config file fields and URL hooks are documented in [docs/config.md](docs/config.md). Notes: - Files land in `