← 返回
沟通协作 Key 中文

Feishu Group Ops

Manage Feishu (Lark) group chats using natural language. Use when the user wants to: add or remove group members, list groups or members, send a message to a...
使用自然语言管理飞书群聊。适用于:添加或移除群成员、查看群组或成员列表、向群组发送消息等操作。
vinzeny
沟通协作 clawhub v1.0.1 1 版本 99862.3 Key: 需要
★ 0
Stars
📥 725
下载
💾 20
安装
1
版本
#latest

概述

Feishu Group Manager

Quick Reference

OperationCommandBilled
----------------------------
Check permissionscheck_permissionsFree
Get access tokenget_tokenFree
List all groupslist_chatsFree
Find group by namefind_chat --nameFree
List group memberslist_members --chat_idFree
Search user by namefind_user --nameFree
Add member to groupadd_member0.002 USDT
Remove memberremove_member0.002 USDT
Send messagesend_message0.002 USDT
Rename grouprename_chat0.002 USDT
Create groupcreate_chat0.002 USDT

When a write operation returns {"error": "payment_required", ...}: stop, show the message field to the user, and wait for them to top up before retrying.


First Use: Credential Check + Permission Verification

The user is already chatting via Feishu, so the app exists and credentials are configured. No need to ask them to set anything up.

Credentials are resolved automatically in this order:

  1. Environment variables FEISHU_APP_ID / FEISHU_APP_SECRET
  2. ~/.openclaw/openclaw.jsonchannels.feishu.accounts..appId / appSecret

On the first request of a session, run:

python3 {baseDir}/scripts/feishu.py check_permissions

If all_ok: true — proceed directly.

If all_ok: false — show the user a friendly message listing missing permissions and how to grant them, e.g.:

> "Before I can manage your groups, your Feishu app needs a couple of extra permissions (takes ~2 min).

>

> Missing:

> - im:chat.member — add/remove group members

> - contact:user.id:readonly — search members by name

>

> Steps:

> 1. Open https://open.feishu.cn/app and find your app

> 2. Go to Permission Management → search and enable the permissions above

> 3. Go to Version Management → create a new version → submit for review

> 4. Once approved (usually a few minutes), let me know and I'll continue."

Re-run check_permissions after the user confirms. Cache the result for the session — only re-check if the user says they just updated permissions, or if Feishu returns error code 99991672.


Execution Flow

Step 1 — Understand intent

Confirm briefly in the user's language, e.g.: "Got it, I'll add Zhang San to the Marketing group."

Step 2 — Gather info

python3 {baseDir}/scripts/feishu.py get_token
python3 {baseDir}/scripts/feishu.py find_chat --token TOKEN --name "marketing"
python3 {baseDir}/scripts/feishu.py find_user --token TOKEN --name "Zhang San"

If multiple matches are returned, list them and ask the user to confirm.

Step 3 — Confirm before any write

> "I'm about to add Zhang San (Marketing dept.) to Marketing Group. Confirm?"

Wait for confirmation before executing.

Step 4 — Execute and report

Success: "Done! Zhang San has been added to Marketing Group."

Failure: Explain in plain language — never expose raw API errors.


Command Reference

# Check app permissions
python3 {baseDir}/scripts/feishu.py check_permissions

# Get tenant access token (auto-reads credentials)
python3 {baseDir}/scripts/feishu.py get_token

# List all groups
python3 {baseDir}/scripts/feishu.py list_chats --token TOKEN

# Find group by name (fuzzy)
python3 {baseDir}/scripts/feishu.py find_chat --token TOKEN --name "NAME"

# List group members
python3 {baseDir}/scripts/feishu.py list_members --token TOKEN --chat_id CHAT_ID

# Search user by name
python3 {baseDir}/scripts/feishu.py find_user --token TOKEN --name "NAME"

# Add member to group (billed)
python3 {baseDir}/scripts/feishu.py add_member \
  --token TOKEN --chat_id CHAT_ID \
  --target_user_id TARGET_UID --user_id CALLER_UID

# Remove member from group (billed)
python3 {baseDir}/scripts/feishu.py remove_member \
  --token TOKEN --chat_id CHAT_ID \
  --target_user_id TARGET_UID --user_id CALLER_UID

# Send message to group (billed)
python3 {baseDir}/scripts/feishu.py send_message \
  --token TOKEN --chat_id CHAT_ID --text "MESSAGE" --user_id CALLER_UID

# Rename group (billed)
python3 {baseDir}/scripts/feishu.py rename_chat \
  --token TOKEN --chat_id CHAT_ID --name "NEW NAME" --user_id CALLER_UID

# Create group and add members (billed)
python3 {baseDir}/scripts/feishu.py create_chat \
  --token TOKEN --name "GROUP NAME" --user_ids "uid1,uid2" --user_id CALLER_UID

--user_id is the caller's Feishu open_id — used for billing. Retrieve it from conversation context or from find_user results.


Error Handling

ErrorResponse
-----------------
Group not found"I couldn't find a group called 'X'. Could you give me the full name?"
User not found"I couldn't find anyone called 'X'. Please check the name or provide their email."
Feishu error 99991672Re-run check_permissions and show missing permission guidance
Token expiredAutomatically re-call get_token and retry
Network error"There was a problem reaching Feishu. Please try again in a moment."
payment_requiredShow the message field (includes top-up link), stop, wait for user

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-31 04:20 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

suspicious
查看报告

🔗 相关推荐

communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 114 📥 52,449
communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,688
communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,596