快速开始

5分钟内完成接入

按照以下步骤,快速将秘书宝宝集成到您的应用中

01

关注我们

关注公众号(自动注册)并获取API密钥

02

下载SDK

产品: ❶文字转语音(TTS) ❷电话语音通知 ❸App语音通知 语言: ❶Java ❷Go ❸Nodejs ❹PHP

03

调用API

文字转语音(TTS),以nodejs语言为例

//TTS nodejs sample
async function ttsPostRequest(url,token,bodyData) {
  const headers = {
    'Content-Type': 'application/json',
    'X-Mishu-Token': token
  };

  try {
    const response = await fetch(url, {
      method: 'POST',
      headers: headers,
      body: JSON.stringify(bodyData)
    });

    if (!response.ok) {
      throw new Error(`Server error: ${response.status}`);
    }

    const jsonResult = await response.json();
    return jsonResult;

  } catch (error) {
    console.error('Request failed:', error.message);
    return null;
  }
}
//call
const url = "https://api2.mishubaobao.com/v1/api/tts";
const token = 'your token';//Change to your own token
const bodyData = {
  text: "hello,world",
  speed: 1.0,
  pitch: 0,
  style: "whisper",
  voice: "zh-CN-XiaoxiaoNeural"
};

const result = await ttsPostRequest(url,token,bodyData); 

console.log('Request result:', result);

恭喜!您已完成基础接入

查看完整文档了解更多高级功能

需要帮助?

我们的技术团队随时为您提供支持