voice-notify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

火山引擎语音通知发送技能

Volcengine Voice Notification Sending Skill

基于火山引擎语音服务API向指定手机号码发送语音通知。
Send voice notifications to specified mobile phone numbers based on the Volcengine Voice Service API.

适用场景

Applicable Scenarios

  1. 用户提到「给{手机号}发送语音通知」「帮我给{手机号}打语音电话」
  2. 用户提到「用{语言}给{手机号}发送语音通知」
  3. 用户提到「给{手机号}发送{关键词}语音通知」
  4. 用户需要通过语音方式通知重要信息
  1. When the user mentions "Send a voice notification to {phone number}" "Help me make a voice call to {phone number}"
  2. When the user mentions "Send a voice notification to {phone number} in {language}"
  3. When the user mentions "Send a {keyword} voice notification to {phone number}"
  4. When the user needs to notify important information via voice

核心执行流程

Core Execution Process

当你收到发送语音通知的请求时,请严格按照以下 4 个步骤依次执行:

When you receive a request to send a voice notification, please strictly follow the 4 steps below in order:

第 1 步:提取手机号码

Step 1: Extract Mobile Phone Number

从用户的指令中提取 11 位手机号码。如果用户没有提供手机号,请先询问用户。

Extract the 11-digit mobile phone number from the user's instruction. If the user does not provide a phone number, ask the user first.

第 2 步:查询可用号码池

Step 2: Query Available Number Pools

执行以下命令查询号码池:
bash
python3 scripts/voice_notify.py pool
从返回的 JSON 结果中:
  • 查看
    Result.Records
    数组
  • 选择一个
    NumberCount > 0
    (有号码可用)的号码池
  • 提取该号码池的
    NumberPoolNo
    字段值(例如:
    NP165357678402826428
注意: 优先选择第一个有号码的号码池。

Execute the following command to query number pools:
bash
python3 scripts/voice_notify.py pool
From the returned JSON result:
  • Check the
    Result.Records
    array
  • Select a number pool with
    NumberCount > 0
    (available numbers)
  • Extract the
    NumberPoolNo
    field value of this number pool (e.g.:
    NP165357678402826428
    )
Note: Prioritize selecting the first number pool with available numbers.

第 3 步:查询语音资源

Step 3: Query Voice Resources

执行以下命令查询语音资源:
bash
python3 scripts/voice_notify.py resource
从返回的 JSON 结果中:
  • 查看
    Result.Records
    数组
  • 根据用户指令中的关键词,在资源的
    Name
    Remark
    TtsTemplateContent
    Lang
    字 段中匹配
  • 选择最匹配的语音资源
  • 提取该资源的
    ResourceKey
    字段值
资源选择规则:
  1. 如果没有匹配的关键词,选择列表中的第一个资源

Execute the following command to query voice resources:
bash
python3 scripts/voice_notify.py resource
From the returned JSON result:
  • Check the
    Result.Records
    array
  • Match against the
    Name
    ,
    Remark
    ,
    TtsTemplateContent
    ,
    Lang
    fields of the resources according to the keywords in the user's instruction
  • Select the most matching voice resource
  • Extract the
    ResourceKey
    field value of this resource
Resource Selection Rules:
  1. If there are no matching keywords, select the first resource in the list

第 4 步:发送语音通知

Step 4: Send Voice Notification

执行以下命令发送语音通知:
bash
python3 scripts/voice_notify.py send <手机号> <资源Key> <号码池编号>
将第 1 步提取的手机号、第 3 步提取的资源Key、第 2 步提取的号码池编号填入命令中。

Execute the following command to send the voice notification:
bash
python3 scripts/voice_notify.py send <phone number> <resource key> <number pool ID>
Fill in the phone number extracted in Step 1, the resource key extracted in Step 3, and the number pool ID extracted in Step 2 into the command.

第 5 步:返回结果

Step 5: Return Result

send
命令的返回结果直接告知用户。

Directly inform the user of the return result of the
send
command.

脚本命令说明

Script Command Description

命令参数说明
resource
查询可用语音资源列表
pool
查询语音通知号码池列表
send
<手机号> <资源Key> <号码池编号>
发送语音通知
CommandParametersDescription
resource
NoneQuery the list of available voice resources
pool
NoneQuery the list of voice notification number pools
send
<phone number> <resource key> <number pool ID>
Send voice notification

完整使用示例

Complete Usage Examples

示例 1:简单发送

Example 1: Simple Sending

用户输入: 给13800138000发语音通知
你的执行:
  1. 提取手机号:
    13800138000
  2. 查询号码池:
bash
python3 scripts/voice_notify.py pool
假设返回结果中第一个有号码的号码池的
NumberPoolNo
NPabc
  1. 查询语音资源:
bash
python3 scripts/voice_notify.py resource
假设返回结果中第一个资源的
ResourceKey
312346368e676406285b8463931f090f4
  1. 发送语音通知:
bash
python3 scripts/voice_notify.py send 13800138000 312346368e676406285b8463931f090f4 NPabc
  1. 将发送结果告知用户

User Input: Send a voice notification to 13800138000
Your Execution:
  1. Extract phone number:
    13800138000
  2. Query number pools:
bash
python3 scripts/voice_notify.py pool
Assume the
NumberPoolNo
of the first number pool with available numbers in the returned result is
NPabc
  1. Query voice resources:
bash
python3 scripts/voice_notify.py resource
Assume the
ResourceKey
of the first resource in the returned result is
312346368e676406285b8463931f090f4
  1. Send voice notification:
bash
python3 scripts/voice_notify.py send 13800138000 312346368e676406285b8463931f090f4 NPabc
  1. Inform the user of the sending result

示例 2:指定语言

Example 2: Specify Language

用户输入: 用日语给13800138000发送语音通知
你的执行:
  1. 提取手机号:
    13800138000
  2. 查询号码池:
bash
python3 scripts/voice_notify.py pool
选择第一个有号码的号码池
  1. 查询语音资源:
bash
python3 scripts/voice_notify.py resource
在返回的资源列表中,查找
Lang
jap
Name
/
Remark
包含"日语"的资源,提取其
ResourceKey
  1. 发送语音通知:
bash
python3 scripts/voice_notify.py send 13800138000 <日语资源Key> <号码池编号>
  1. 将发送结果告知用户

User Input: Send a voice notification to 13800138000 in Japanese
Your Execution:
  1. Extract phone number:
    13800138000
  2. Query number pools:
bash
python3 scripts/voice_notify.py pool
Select the first number pool with available numbers
  1. Query voice resources:
bash
python3 scripts/voice_notify.py resource
In the returned resource list, find the resource with
Lang
as
jap
or
Name
/
Remark
containing "Japanese", and extract its
ResourceKey
  1. Send voice notification:
bash
python3 scripts/voice_notify.py send 13800138000 <Japanese resource key> <number pool ID>
  1. Inform the user of the sending result

示例 3:指定关键词

Example 3: Specify Keyword

用户输入: 给13800138000发送OCIC语音通知 你的执行:
  1. 提取手机号:
    13800138000
  2. 查询号码池:
bash
python3 scripts/voice_notify.py pool
选择第一个有号码的号码池
  1. 查询语音资源:
bash
python3 scripts/voice_notify.py resource
在返回的资源列表中,查找
Name
Remark
包含"OCIC"的资源,提取其
ResourceKey
  1. 发送语音通知:
bash
python3 scripts/voice_notify.py send 13800138000 <OCIC资源Key> <号码池编号>
  1. 将发送结果告知用户

User Input: Send an OCIC voice notification to 13800138000 Your Execution:
  1. Extract phone number:
    13800138000
  2. Query number pools:
bash
python3 scripts/voice_notify.py pool
Select the first number pool with available numbers
  1. Query voice resources:
bash
python3 scripts/voice_notify.py resource
In the returned resource list, find the resource with
Name
or
Remark
containing "OCIC", and extract its
ResourceKey
  1. Send voice notification:
bash
python3 scripts/voice_notify.py send 13800138000 <OCIC resource key> <number pool ID>
  1. Inform the user of the sending result

环境变量

Environment Variables

使用前需配置火山引擎访问密钥到系统环境变量或 OpenClaw 的 .env 文件:
  • VOLCENGINE_ACCESS_KEY:火山引擎访问密钥ID
  • VOLCENGINE_SECRET_KEY:火山引擎秘密访问密钥
获取方式:登录火山引擎控制台,在访问密钥管理中创建和获取。
Before use, configure the Volcengine access keys into the system environment variables or the .env file of OpenClaw:
  • VOLCENGINE_ACCESS_KEY: Volcengine Access Key ID
  • VOLCENGINE_SECRET_KEY: Volcengine Secret Access Key
Obtaining method: Log in to the Volcengine console, create and obtain it in Access Key Management.

错误处理

Error Handling

  • 若报错
    请设置环境变量 VOLCENGINE_ACCESS_KEY 和 VOLCENGINE_SECRET_KEY
    :提示用户配置火山引擎访问密钥。
  • 若报错
    没有找到可用的号码池
    :提示用户检查账户下是否有可用的语音通知号码池。
  • 若报错
    没有找到可用的语音资源
    :提示用户检查账户下是否有可用的语音资源文件。
  • 遇到其他报错时直接告知用户具体错误信息。
  • If the error
    Please set the environment variables VOLCENGINE_ACCESS_KEY and VOLCENGINE_SECRET_KEY
    occurs: Prompt the user to configure the Volcengine access keys.
  • If the error
    No available number pools found
    occurs: Prompt the user to check if there are available voice notification number pools under the account.
  • If the error
    No available voice resources found
    occurs: Prompt the user to check if there are available voice resource files under the account.
  • For other errors, directly inform the user of the specific error message.

参考文档

Reference Documents

  • https://www.volcengine.com/docs/6358/166389?lang=zh
    — 签名机制
  • https://www.volcengine.com/docs/6358/1722078?lang=zh
    — 查询可用语音资源
  • https://www.volcengine.com/docs/6358/172952?lang=zh
    — 单次发送语音通知
  • https://www.volcengine.com/docs/6358/173339?lang=zh
    — 查询号码池列表
  • https://www.volcengine.com/docs/6358/166389?lang=zh
    — Signature Mechanism
  • https://www.volcengine.com/docs/6358/1722078?lang=zh
    — Query Available Voice Resources
  • https://www.volcengine.com/docs/6358/172952?lang=zh
    — Send Voice Notification Once
  • https://www.volcengine.com/docs/6358/173339?lang=zh
    — Query Number Pool List