feishu-video
by @yangmiok
Send voice/audio messages to Feishu (Lark) users. Converts audio files to OPUS format and sends as voice message, not file attachment. create by Alex
clawhub install feishu-video๐ About This Skill
name: Feishu Audio Message description: Send voice/audio messages to Feishu (Lark) users. Converts audio files to OPUS format and sends as voice message, not file attachment. create by Alex dependencies: ffmpeg
Feishu Audio Message Skill
This skill enables sending voice messages (not file attachments) to Feishu/Lark users via the Open API.
When to Use
Use this skill when:
Requirements
1. ffmpeg - Required for audio conversion to OPUS format 2. Node.js 18+ - For running the send script 3. Feishu App Credentials: - App ID - App Secret - Target user's Open ID
How It Works
1. Convert audio to OPUS - Feishu requires audio in OPUS format
2. Upload audio file - Upload to Feishu with file_type: opus and duration
3. Send audio message - Send with msg_type: audio
Usage
Step 1: Convert Audio to OPUS
ffmpeg -i input.mp3 -c:a libopus -b:a 32k output.opus
Step 2: Get Audio Duration
ffprobe -v quiet -show_format -print_format json input.mp3
Look for "duration" field in output
Step 3: Run the Script
node scripts/send-voice.mjs \
--app-id "cli_xxx" \
--app-secret "xxx" \
--user-id "ou_xxx" \
--audio-file "audio.opus" \
--duration 3480
Or use environment variables:
export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"
node scripts/send-voice.mjs --user-id "ou_xxx" --audio-file "audio.opus" --duration 3480
API Details
1. Get Tenant Access Token
POST https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal
2. Upload Audio File
POST https://open.feishu.cn/open-apis/im/v1/files
Content-Type: multipart/form-datafile_type: opus
file_name: voice.opus
duration:
file:
3. Send Audio Message
POST https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id{
"receive_id": "ou_xxx",
"msg_type": "audio",
"content": "{\"file_key\":\"file_v3_xxx\"}"
}
Important Notes
Example Output
๐ค ๅผๅงๅ้่ฏญ้ณๆถๆฏๅฐ้ฃไนฆ...๐ ้ณ้ขๆไปถ: /path/to/voice.opus
โฑ๏ธ ๆถ้ฟ: 3480ms
โ
่ทๅ Tenant Access Token ๆๅ
โ
ไธไผ ่ฏญ้ณๆไปถๆๅ, file_key: file_v3_00uh_xxx
โ
ๅ้่ฏญ้ณๆถๆฏๆๅ!
ๆถๆฏ ID: om_x100b5731827e6ca4b10d48c15dfa3ab
๐ ๅฎๆ๏ผ
Troubleshooting
| Error | Solution |
|-------|----------|
| file type not support | Convert to OPUS format |
| duration is required | Add duration parameter |
| permission denied | Check app has messaging scope |
| user not found | Verify user Open ID |
โก When to Use
๐ก Examples
Step 1: Convert Audio to OPUS
ffmpeg -i input.mp3 -c:a libopus -b:a 32k output.opus
Step 2: Get Audio Duration
ffprobe -v quiet -show_format -print_format json input.mp3
Look for "duration" field in output
Step 3: Run the Script
node scripts/send-voice.mjs \
--app-id "cli_xxx" \
--app-secret "xxx" \
--user-id "ou_xxx" \
--audio-file "audio.opus" \
--duration 3480
Or use environment variables:
export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"
node scripts/send-voice.mjs --user-id "ou_xxx" --audio-file "audio.opus" --duration 3480
๐ Tips & Best Practices
| Error | Solution |
|-------|----------|
| file type not support | Convert to OPUS format |
| duration is required | Add duration parameter |
| permission denied | Check app has messaging scope |
| user not found | Verify user Open ID |