Tools
Larkflow Openclaw
๐ค LarkFlow - Feishu approval workflow automation plugin for OpenClaw. Rule engine + AI sub-agent for auto-approve/reject/notify. ๅบไบ OpenClaw ็้ฃไนฆๅฎกๆนๆต่ชๅจๅๆไปถใ
Install
npm install
#
README
# LarkFlow ๐ค
> **Feishu Approval Workflow Automation โ powered by OpenClaw**
> ๅบไบ OpenClaw ็้ฃไนฆๅฎกๆนๆต่ชๅจๅๆไปถ
---
## What is LarkFlow?
LarkFlow is an **OpenClaw plugin** that automates Feishu (้ฃไนฆ) approval workflows. It listens for approval events, matches them against configurable rules, optionally uses AI to analyze complex cases, and takes automatic actions โ all through OpenClaw's plugin and hook system.
### Use Cases
- **๐ฐ Expense Reports** โ Auto-approve โคยฅ5000, AI-review ยฅ5000-20000, escalate >ยฅ20000
- **๐๏ธ Leave Requests** โ Auto-approve โค3 days, forward >3 days to manager
- **๐ Purchase Orders** โ Match budget codes, auto-reject overspend
- **๐ DevOps Approvals** โ Auto-approve staging deploys, escalate production
---
## Features
| Feature | Description |
|---------|-------------|
| **Rule Engine** | Define rules with priority, keyword match, amount ranges, applicant filters |
| **AI Decider** | Sub-agents analyze complex approvals using local/cloud models |
| **Feishu Integration** | Native webhook handling + notification via Feishu channel |
| **OpenClaw Hooks** | `message:received` hook for real-time approval detection |
| **Plugin Config** | JSON5 schema with full OpenClaw config validation |
---
## Quick Start
### 1. Install Plugin
```bash
# From local path
openclaw plugins install -l ./larkflow
# Or via npm (once published)
openclaw plugins install larkflow
```
### 2. Configure
Add to `~/.openclaw/openclaw.json`:
```json5
{
plugins: {
slots: {
// No slot needed โ LarkFlow registers hooks automatically
},
entries: {
larkflow: {
enabled: true,
config: {
feishuChatId: "oc_xxxxxxxxxxxxxxxxxxxxxxxxxxx",
notifyOnAction: true,
rules: [
{
name: "ๅฐ้ขๆฅ้่ชๅจ้่ฟ",
priority: 1,
match: {
approvalType: "expense_report",
titleContains: ["ๆฅ้", "expense"],
amountMax: 5000,
},
action: "auto_approve",
reason: "ๅฐ้ขๆฅ้่งๅ๏ผ้้ข โค ยฅ5000 ่ชๅจ้่ฟ",
},
{
name: "ๅคง้ข้่ดญ้AIๅฎกๆ ธ",
priority: 2,
match: {
approvalType: "purchase_order",
amountMin: 20000,
},
action: "ai_decide",
},
{
name: "่ถ
้ฟ่ฏทๅ่ฝฌไบบๅทฅ",
priority: 3,
match: {
approvalType: "leave",
titleContains: ["่ฏทๅ", "leave", "ไผๅ", "vacation"],
amountMin: 7, // days
},
action: "forward",
forwardTo: "ou_xxxxxxxxxx",
},
],
},
},
},
},
}
```
### 3. Restart Gateway
```bash
openclaw gateway restart
```
### 4. Verify
```bash
openclaw plugins list | grep larkflow
```
---
## Architecture
```
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ Feishu โโโโโโถโ LarkFlow โโโโโโถโ OpenClaw โ
โ Approval โ โ Webhook Handler โ โ Agent Loop โ
โ Webhook โ โโโโโโโโโโฌโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโ โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Rule Engine โ
โ (first match) โ
โโโโโโโโโโฌโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ
โ Auto Action โ โ AI Decider โ โ Forward โ
โ (approve/ โ โ (sub-agent) โ โ (to human) โ
โ reject) โ โ โ โ โ
โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Feishu Channel โ
โ (notification) โ
โโโโโโโโโโโโโโโโโโโโ
```
---
## Development
```bash
# Clone & setup
git clone https://github.com/sunecom/larkflow.git
cd larkflow
npm install
# Build
npm run build
# Test
npm test
# Run with dev Gateway
openclaw gateway --plugins ./dist
```
---
## Configuration Reference
### `openclaw.json` Plugin Config
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `feishuChatId` | string | โ
| โ | Feishu chat ID for notifications |
| `approvalWebhook` | string | โ | โ | Feishu approval webhook URL |
| `rules[]` | array | โ | [] | Approval rule list |
| `aiDecidePrompt` | string | โ | (default) | Custom prompt for AI decision |
| `notifyOnAction` | boolean | โ | true | Send notification on auto-action |
### Rule Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | โ
| Rule display name |
| `priority` | number | โ | Lower = higher priority (default 999) |
| `match.approvalType` | string | โ | Feishu approval code |
| `match.titleContains` | string[] | โ | Keyword match (any) |
| `match.amountMax` | number | โ | Amount โค this value |
| `match.amountMin` | number | โ | Amount โฅ this value |
| `match.applicantIds` | string[] | โ | Specific applicant IDs |
| `action` | enum | โ
| auto_approve / auto_reject / ai_decide / notify_only / forward |
| `forwardTo` | string | โ | User open_id for forward action |
| `reason` | string | โ | Reason logged with action |
---
> ๐ Powered by [AiToMoney Team](https://github.com/sunecom) | Check out our **GEO ToolKit** โ [geo.aitomoney.online](https://geo.aitomoney.online)
---
## License
MIT โ Free as a lobster in the ocean. ๐ฆ
tools
Comments
Sign in to leave a comment