Overview
Convert text to speech (edge-tts), then transcode it to Opus usable by Feishu (OGG container), and send it by calling the Feishu Open Platform's standard process of "first upload the file, then send an audio message", avoiding "sending the file directly being downgraded to text".
Quick Start
Run the script:
skills/feishu-voice-tts/scripts/send_feishu_voice.sh "用户你好,这是一条语音消息" "user_open_id"
Parameters:
text(required) the text to be broadcastopen_id(required, can be replaced by an environment variable) Feishu user open_idvoice(optional) edge-tts voice, defaultzh-CN-YunxiNeural
Environment variables (optional, take precedence over the configuration file):
FEISHU_APP_IDFEISHU_APP_SECRETFEISHU_OPEN_IDEDGE_TTS_VOICE
Workflow
Execute in the following order, do not skip steps:
- Text to speech:
edge-ttsgenerate mp3 - Transcode:
ffmpegconvert toaudio/ogg(opus encoding, 16k mono) - Get tenant token: Feishu
/auth/v3/tenant_access_token/internal - Upload voice file: Feishu
/im/v1/files, getfile_key - Send audio message: Feishu
/im/v1/messages,msg_type=audio+file_key
On success the script outputs:
{"success": true, "message_id": "...", "file_key": "..."}
Requirements
ffmpegavailableedge-ttsavailable (the script automatically tries the following entry points):edge-tts~/Library/Python/3.14/bin/edge-ttspython3 -m edge_tts
- OpenClaw configuration exists on this machine:
~/.openclaw/openclaw.json- Default read:
channels.feishu.accounts.feishu-main.appId/appSecret
- Default read:
Failure Handling
- Missing dependencies: install according to the error (for example
python3 -m pip install --user edge-tts) - Feishu API failure: the script will directly output the raw JSON error, troubleshoot according to
code/msgTroubleshoot - Downgraded to text: confirm that what is sent is
msg_type=audioand thatcontentcontains the uploadedfile_key
scripts/
scripts/send_feishu_voice.sh: complete automation script (TTS + transcoding + upload + send)