Feishu Voice

v1.2.0

飞书语音消息发送技能。将文本转换为语音并发送到飞书,支持 TTS 生成、格式转换、语速调整、时长读取、文件上传和消息发送。

1· 1.4k·30 current·32 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for franklu0819-lang/feishu-voice.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Feishu Voice" (franklu0819-lang/feishu-voice) from ClawHub.
Skill page: https://clawhub.ai/franklu0819-lang/feishu-voice
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Required env vars: FEISHU_APP_ID, FEISHU_APP_SECRET, COZE_API_KEY
Required binaries: ffmpeg, ffprobe, jq
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Canonical install target

openclaw skills install franklu0819-lang/feishu-voice

ClawHub CLI

Package manager switcher

npx clawhub@latest install feishu-voice
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description (Feishu voice/TTS → Feishu) match the included script and SKILL.md. Requested binaries (ffmpeg, ffprobe, jq) and env vars (FEISHU_APP_ID, FEISHU_APP_SECRET, COZE_API_KEY) are appropriate and necessary for TTS generation, format conversion, duration reading, and uploading to Feishu.
Instruction Scope
The SKILL.md and scripts stay within the stated workflow: call an external coze-tts script to make MP3, optionally adjust speed, convert to opus, read duration, upload to Feishu, and send the message. One notable behavior: the send_voice.sh locates and executes a separate coze-tts script by checking several workspace paths (including $HOME and /opt paths) or OPENCLAW_WORKSPACE. Executing that external script is expected for this skill but means you should trust the coze-tts implementation that will run.
Install Mechanism
This is instruction-only with a shell script; there is no download/install step that fetches remote code during installation. No suspicious remote install URLs or archive extraction are present.
Credentials
Required env vars are limited to FEISHU_APP_ID/FEISHU_APP_SECRET (for Feishu token) and COZE_API_KEY (for TTS) — these are proportionate to the described functionality. Optional multi-app vars are reasonable. No unrelated secrets or excessive credentials are requested.
Persistence & Privilege
Skill does not request always:true and does not modify other skills or system settings. It runs as a user-invocable script and may be invoked autonomously by the agent (default), which is normal for skills.
Assessment
This skill appears coherent and implements exactly what it claims: generate TTS via coze-tts, convert/measure audio, upload to Feishu, and send an audio message. Before installing or running it: 1) Verify and trust the coze-tts script that this skill will execute (it searches common workspace paths and will run whatever it finds there). Inspect that script and the workspace paths to ensure they are not malicious. 2) Provide only a Feishu app with the minimal permissions needed (im:message, send_as_bot) and avoid using high-privilege tenant credentials unnecessarily. 3) Keep COZE_API_KEY and FEISHU_* secrets in a secure place; consider testing in an isolated account/workspace first. 4) Note minor metadata/version inconsistencies across files (package.json/_meta.json/registry), which is a quality issue but not a direct security problem. If you cannot inspect the coze-tts implementation or workspace paths, treat that as a risk because arbitrary code in those scripts could run with your environment credentials.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

Binsffmpeg, ffprobe, jq
EnvFEISHU_APP_ID, FEISHU_APP_SECRET, COZE_API_KEY
audiovk974pbj81a8nhynjetg8jrvw9d83k6jfchinesevk974pbj81a8nhynjetg8jrvw9d83k6jfcozevk974pbj81a8nhynjetg8jrvw9d83k6jffeishuvk974pbj81a8nhynjetg8jrvw9d83k6jflatestvk975vrwqfxe8sf0x4h5kh5w02n83rqggmessagingvk974pbj81a8nhynjetg8jrvw9d83k6jfttsvk974pbj81a8nhynjetg8jrvw9d83k6jfvoicevk974pbj81a8nhynjetg8jrvw9d83k6jf
1.4kdownloads
1stars
7versions
Updated 4w ago
v1.2.0
MIT-0

飞书语音消息发送技能

将文本转换为语音消息发送到飞书,支持在飞书聊天窗口直接播放。

功能特性

  • ✅ TTS 文字转语音(使用 coze-tts
  • ✅ 支持语速调整(0.5-2.0x)
  • ✅ 自动转换为 opus 格式(飞书要求)
  • ✅ 读取音频时长
  • ✅ 上传到飞书服务器
  • ✅ 发送可播放的语音消息

前置要求

环境变量

必需变量:

# 飞书配置(必需)
export FEISHU_APP_ID="cli_xxx"              # 飞书应用 ID
export FEISHU_APP_SECRET="your_secret"      # 飞书应用密钥

# Coze 配置(用于 TTS)
export COZE_API_KEY="your_coze_key"         # Coze API 密钥

可选变量:

# 接收者配置
export FEISHU_RECEIVER="ou_xxx"             # 默认接收者 Open ID

# 多应用配置(用于支持多个飞书应用)
export FEISHU_APP_ID_B="cli_xxx"            # 应用 B 的 ID
export FEISHU_APP_SECRET_B="your_secret"    # 应用 B 的密钥
export FEISHU_RECEIVER_B="ou_xxx"           # 应用 B 的接收者

# 工作区路径(用于定位依赖技能)
export OPENCLAW_WORKSPACE="/path/to/workspace"  # OpenClaw 工作区目录

必需工具

  • ffmpeg - 音频格式转换、语速调整
  • ffprobe - 读取音频信息
  • jq - JSON 处理

依赖技能

  • coze-tts - 文字转语音

使用方法

基本用法

# 发送语音消息
bash scripts/send_voice.sh "你好,这是一条语音消息"

高级选项

# 指定 voice_id 和语速
bash scripts/send_voice.sh "你好" 2 1.2

# 参数说明:
# - voice_id: Coze 音色 ID(默认 1)
# - 语速: 0.5-2.0(默认 1.0)

脚本说明

send_voice.sh

主脚本,完整的语音消息发送流程。

用法:

bash scripts/send_voice.sh <文本> [voice_id] [语速] [接收者]

参数:

  • 文本 (必需): 要转换为语音的文字
  • voice_id (可选): Coze 音色 ID(默认:1)
  • 语速 (可选): 0.5-2.0(默认:1.0)
  • 接收者 (可选): 飞书 open_id

环境变量:

  • FEISHU_APP_ID: 飞书应用 ID
  • FEISHU_APP_SECRET: 飞书应用密钥
  • FEISHU_RECEIVER: 接收者 Open ID(可选)
  • COZE_API_KEY: Coze API 密钥

流程说明

  1. TTS 生成: 使用 coze-tts 生成 MP3 格式音频
  2. 语速调整(可选): 使用 ffmpeg atempo 滤镜调整语速
  3. 格式转换: 使用 ffmpeg 转换为 opus 格式
  4. 读取时长: 使用 ffprobe 获取音频时长(毫秒)
  5. 上传文件: 上传到飞书,指定 file_type=opusduration
  6. 发送消息: 发送 msg_type=audio 消息

技术细节

音频格式要求

飞书语音消息要求:

  • 格式: opus (OGG 容器)
  • 编码: libopus
  • 比特率: 24k
  • 采样率: 24000 Hz
  • 声道: 单声道

Duration 参数

关键: 必须在上传时提供 duration 参数(整数毫秒),否则时长显示为 0。

# 正确的上传方式
curl -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
  -F "file=@voice.opus" \
  -F "file_type=opus" \
  -F "duration=6000"          # ← 关键参数(毫秒)

API 端点

端点用途
/auth/v3/tenant_access_token/internal获取访问令牌
/im/v1/files上传文件
/im/v1/messages发送消息

故障排查

语音没有时长

问题: 发送的语音消息时长显示为 0

解决: 确保在上传时传递了 duration 参数(整数毫秒)

# 获取时长(转换为毫秒)
DURATION_MS=$(ffprobe -v error -show_entries format=duration \
  -of default=noprint_wrappers=1:nokey=1 voice.opus | awk '{printf "%.0f", $1 * 1000}')

# 上传时带上 duration(毫秒)
curl ... -F "duration=$DURATION_MS"

无法播放

问题: 语音消息无法播放

可能原因:

  1. 格式不是 opus
  2. file_type 参数错误
  3. 文件损坏

解决:

# 检查格式
ffprobe voice.opus

# 重新转换
ffmpeg -i input.mp3 -c:a libopus -b:a 24k voice.opus

API 权限错误

问题: 上传时返回权限错误

解决: 确保飞书应用有以下权限:

  • im:message
  • im:message:send_as_bot

完整示例

# 设置环境变量
export FEISHU_APP_ID="your_app_id_here"
export FEISHU_APP_SECRET="your_app_secret_here"
export COZE_API_KEY="your_coze_key_here"

# 发送语音(默认设置)
bash scripts/send_voice.sh \
  "你好,这是一条测试语音消息。"

# 发送语音(指定 voice_id=2,语速 1.2x)
bash scripts/send_voice.sh \
  "你好,这是一条测试语音消息。" 2 1.2

注意事项

  1. Coze TTS 限制: 单次文本长度请参考 Coze 文档
  2. 整数时长: duration 必须是整数毫秒
  3. opus 格式: 飞书只接受 opus 格式的音频消息
  4. 语速范围: 支持 0.5-2.0x,使用 ffmpeg atempo 实现
  5. 文件清理: 临时文件会自动清理

相关技能

  • coze-tts: 文字转语音
  • coze-asr: 语音转文字

更新日志

2026-03-24: 从 zhipu-tts 迁移到 coze-tts,新增语速调整功能

Comments

Loading comments...