SuperAPI AI Directory

feishu-voice-tts

Office & productivity

View repository

Updated 10-16 09:40

About this skill

Feishu Voice TTS

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:

  1. text(required) the text to be broadcast
  2. open_id(required, can be replaced by an environment variable) Feishu user open_id
  3. voice(optional) edge-tts voice, default zh-CN-YunxiNeural

Environment variables (optional, take precedence over the configuration file):

  • FEISHU_APP_ID
  • FEISHU_APP_SECRET
  • FEISHU_OPEN_ID
  • EDGE_TTS_VOICE

Workflow

Execute in the following order, do not skip steps:

  1. Text to speech:edge-tts generate mp3
  2. Transcode:ffmpeg convert to audio/ogg(opus encoding, 16k mono)
  3. Get tenant token: Feishu /auth/v3/tenant_access_token/internal
  4. Upload voice file: Feishu /im/v1/files, get file_key
  5. Send audio message: Feishu /im/v1/messages,msg_type=audio + file_key

On success the script outputs:

{"success": true, "message_id": "...", "file_key": "..."}

Requirements

  • ffmpeg available
  • edge-tts available (the script automatically tries the following entry points):
    • edge-tts
    • ~/Library/Python/3.14/bin/edge-tts
    • python3 -m edge_tts
  • OpenClaw configuration exists on this machine:~/.openclaw/openclaw.json
    • Default read:channels.feishu.accounts.feishu-main.appId/appSecret

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/msg Troubleshoot
  • Downgraded to text: confirm that what is sent is msg_type=audio and that content contains the uploaded file_key

scripts/

  • scripts/send_feishu_voice.sh: complete automation script (TTS + transcoding + upload + send)