Feishu Voice Bubble
Send native voice bubble messages in Feishu using Edge TTS + opus format.
Why This Exists
Feishu bot API only renders voice bubbles for audio message type with opus format.
Standard TTS outputs mp3 → Feishu shows it as a file attachment, not a voice bubble.
This skill: Edge TTS → opus → Feishu audio → native voice bubble.
Prerequisites
CODEBLOCK0
No API keys required. Edge TTS is free.
Usage
Basic
CODEBLOCK1
With Options
CODEBLOCK2
Long Text Auto-Split
CODEBLOCK3
Produces output_1.opus, output_2.opus, etc. Split at sentence boundaries.
Send to Feishu
CODEBLOCK4
The .opus extension triggers Feishu's native audio message type automatically.
Arguments
| Arg | Description | Default |
|---|
| INLINECODE4 | Text to convert | required |
| INLINECODE5 |
Output .opus path | required |
|
--voice | Edge TTS voice name | zh-CN-XiaoxiaoNeural |
|
--rate | Speech rate (+20%, -10%) | +0% |
|
--pitch | Pitch adjust (+5%, -5%) | +0% |
|
--split | Auto-split at N chars | 0 (disabled) |
Chinese Voices
| Voice | Gender | Style |
|---|
| zh-CN-XiaoxiaoNeural | F | Warm, versatile (default) |
| zh-CN-XiaoyiNeural |
F | Gentle, storytelling |
| zh-CN-YunxiNeural | M | Young, energetic |
| zh-CN-YunjianNeural | M | Broadcast, professional |
| zh-CN-YunyangNeural | M | News anchor, authoritative |
| zh-CN-liaoning-XiaobeiNeural | F | Northeastern dialect |
| zh-CN-shaanxi-XiaoniNeural | F | Shaanxi dialect |
How It Works
- 1. Edge TTS converts text → INLINECODE10
- Saved as
.opus file - Feishu plugin detects
.opus → uploads as opus type → sends as audio message - Feishu client renders native voice bubble with play button
Limitations
- - Requires internet (Microsoft hosted service)
- No SLA (free public service)
- ~10 min max audio per request
- INLINECODE15 must be installed in the working directory or globally
Feishu语音气泡
使用Edge TTS + opus格式在飞书中发送原生语音气泡消息。
为什么存在这个功能
飞书机器人API仅支持opus格式的audio消息类型渲染语音气泡。
标准TTS输出mp3格式 → 飞书将其显示为文件附件,而非语音气泡。
本技能:Edge TTS → opus → 飞书音频 → 原生语音气泡。
前置条件
bash
npm install node-edge-tts
无需API密钥。Edge TTS免费使用。
使用方法
基础用法
bash
node scripts/gen_voice.js 你好世界 output.opus
带参数选项
bash
node scripts/gen_voice.js 播报内容 output.opus --voice zh-CN-YunxiNeural --rate +15% --pitch -5%
长文本自动分段
bash
node scripts/gen_voice.js 很长的文本... output.opus --split 500
生成output1.opus、output2.opus等文件。在句子边界处进行分段。
发送到飞书
json
{ action: send, filePath: output.opus }
.opus扩展名会自动触发飞书的原生音频消息类型。
参数说明
| 参数 | 描述 | 默认值 |
|---|
| <text> | 要转换的文本 | 必填 |
| <output> |
输出.opus文件路径 | 必填 |
| --voice | Edge TTS语音名称 | zh-CN-XiaoxiaoNeural |
| --rate | 语速(+20%,-10%) | +0% |
| --pitch | 音调调整(+5%,-5%) | +0% |
| --split | 按N个字符自动分段 | 0(禁用) |
中文语音列表
| 语音 | 性别 | 风格 |
|---|
| zh-CN-XiaoxiaoNeural | 女 | 温暖、多才多艺(默认) |
| zh-CN-XiaoyiNeural |
女 | 温柔、讲故事风格 |
| zh-CN-YunxiNeural | 男 | 年轻、充满活力 |
| zh-CN-YunjianNeural | 男 | 播音、专业风格 |
| zh-CN-YunyangNeural | 男 | 新闻主播、权威风格 |
| zh-CN-liaoning-XiaobeiNeural | 女 | 东北方言 |
| zh-CN-shaanxi-XiaoniNeural | 女 | 陕西方言 |
工作原理
- 1. Edge TTS将文本转换为webm-24khz-16bit-mono-opus格式
- 保存为.opus文件
- 飞书插件检测到.opus文件 → 以opus类型上传 → 作为audio消息发送
- 飞书客户端渲染带有播放按钮的原生语音气泡
局限性
- - 需要网络连接(微软托管服务)
- 无服务等级协议(免费公共服务)
- 每次请求最长约10分钟音频
- node-edge-tts必须安装在工作目录或全局环境中