Feishu (Lark) bot messaging and remote control for Claude Code and terminals
Project description
feishu-notify
飞书 (Lark) 机器人消息推送与远程控制。支持从飞书远程操控 Claude Code 或其他终端。
English | 中文
Features
- 🔔 Instant Push - Auto-notify on task completion
- 🎮 Remote Control - Send commands from Feishu to terminal
- 🪟 Multi-window - On-duty mode for window management
- 📱 Mobile Friendly - Optimized output for mobile reading
- 🎴 Interactive Cards - Window list with card display
- 🌐 i18n - Chinese and English support
Installation
# From PyPI (recommended)
pip install feishu-notify
# From source
git clone https://github.com/steptian/feishu-notify.git
cd feishu-notify
pip install -e .
Quick Start
1. Configure Feishu App
- Visit Feishu Open Platform to create an app
- Get App ID and App Secret
- Configure permissions:
im:message,im:message:send_as_bot - Publish the app and add to a group chat
2. Set Environment Variables
# Create config directory
mkdir -p ~/.config/feishu-notify
# Create .env file
cat > ~/.config/feishu-notify/.env << 'EOF'
FEISHU_APP_ID=cli_xxxxxxxxxx
FEISHU_APP_SECRET=xxxxxxxxxxxxxxxxxx
EOF
chmod 600 ~/.config/feishu-notify/.env
3. Start Long Polling Client
feishu-notify start
Or run directly:
python -m feishu_notify.client
4. Configure Claude Code Hook (Optional but Recommended)
Edit ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "feishu-notify hook"
}
]
}
]
}
}
Usage
From Feishu
Send messages directly (no prefix needed):
帮我写一个冒泡排序
今天上海天气怎么样?
Window management:
/windows # View active windows (interactive card)
/switch 1 # Switch to window 1
/on-duty # View current on-duty window
In Claude Code
feishu-notify send "Title" "Content" # Send custom notification
feishu-notify send "Task done" # Send simple notification
feishu-notify test # Test push
feishu-notify config --check # Validate configuration
Command Line
feishu-notify send "Title" "Content" # Send notification
feishu-notify test # Test
feishu-notify config --check # Check config
As a Python Library
from feishu_notify import send_to_feishu, Config
# Load config from environment
config = Config.from_env()
config.validate()
# Send message
send_to_feishu("Hello from Python!", config=config)
Architecture
┌─────────────┐ ┌─────────────┐
│ Feishu App │◄────WebSocket────►│ Client │
└─────────────┘ └──────┬──────┘
│
▼
┌─────────────┐
│ tmux session│
│(Claude Code)│
└─────────────┘
▲
│
┌──────┴──────┐
│ Stop Hook │
│ (auto-reply)│
└─────────────┘
File Structure
feishu-notify/
├── src/feishu_notify/
│ ├── __init__.py
│ ├── cli.py # CLI entry point
│ ├── client.py # WebSocket client
│ ├── config.py # Configuration management
│ ├── sender.py # Message sending
│ └── i18n.py # Internationalization
├── tests/
│ ├── test_config.py
│ └── test_sender.py
├── skills/ # Claude Code Skill
│ └── feishu-notify/
│ └── SKILL.md
├── pyproject.toml
└── README.md
Configuration
Environment Variables
| Variable | Required | Description |
|---|---|---|
FEISHU_APP_ID |
✅ | Feishu App ID |
FEISHU_APP_SECRET |
✅ | Feishu App Secret |
FEISHU_WEBHOOK_URL |
❌ | Group bot webhook (for simple push) |
FEISHU_NOTIFY_LANG |
❌ | Language: zh (default) or en |
Multi-window Scenario
When you have multiple Claude Code windows, use on-duty mode:
- In Claude Code terminal:
feishu-notify on-duty - Messages from Feishu will only go to the on-duty window
- Switch windows: Send
/windowsin Feishu → Click to switch
Troubleshooting
Message Send Failed
- Check
.envconfiguration is correct - Check if Feishu app is published
- Check if app is added to group chat
Reply Not Sent to Feishu
- Confirm Stop Hook is configured
- Confirm long polling client is running
- Check logs:
tail -f /tmp/feishu-longpoll.log
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=feishu_notify
# Type check
pyright src/
License
MIT
中文文档
飞书机器人消息推送与远程控制 Skill,支持从飞书远程操控 Claude Code。
特性
- 🔔 即时推送 - 任务完成自动通知到飞书
- 🎮 远程控制 - 从飞书发送命令到 Claude Code
- 🪟 多窗口管理 - 值班模式,指定窗口接收消息
- 📱 手机友好 - 输出优化,适合手机阅读
- 🎴 交互卡片 - 窗口列表卡片展示
安装
pip install feishu-notify
快速开始
- 配置飞书应用并获取 App ID 和 App Secret
- 创建
~/.config/feishu-notify/.env文件 - 运行
feishu-notify start启动长连接客户端
使用方式
从飞书发消息(无需前缀):
帮我写一个冒泡排序
今天上海天气怎么样?
窗口管理:
/windows # 查看活跃窗口
/switch 1 # 切换到窗口 1
/on-duty # 查看当前值班窗口
故障排除
消息发送失败
- 检查
.env配置是否正确 - 检查飞书应用是否已发布
- 检查应用是否已添加到群聊
回复没有发送到飞书
- 确认 Stop Hook 已配置
- 确认长连接客户端正在运行
- 检查日志:
tail -f /tmp/feishu-longpoll.log
许可证
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file feishu_cc-0.1.0.tar.gz.
File metadata
- Download URL: feishu_cc-0.1.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/37.3 requests/2.32.4 requests-toolbelt/1.0.0 urllib3/1.26.14 tqdm/4.66.5 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
550b9dbb9f3598dec888157551b4b8a4a6ab6b19ec8eca6ca6c4c6344c319f71
|
|
| MD5 |
00ed820f3c14a719824ef7f310c8a103
|
|
| BLAKE2b-256 |
af6702fcb87c6fcae879de0fc303d9aef62622d9752cca0bfb9b46662fb11570
|
File details
Details for the file feishu_cc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: feishu_cc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/37.3 requests/2.32.4 requests-toolbelt/1.0.0 urllib3/1.26.14 tqdm/4.66.5 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bd16c03cb9d19484eba2774d09f2457d3613d21848a06f4fde41bad4a4c84e3
|
|
| MD5 |
d2f15ce64181848d32e4763a10165bf4
|
|
| BLAKE2b-256 |
b2392490031d528d5743d60e087a251ba973f04bb775c1349a1773abbdaeb7e6
|