このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

Web

Feature Description

The voice-to-text feature supports recognizing the voice message you sent successfully or received, converting it into text.
Note:
Voice-to-text is a value-added paid feature, which is currently offered for free. You can contact us through the Telegram technical exchange group to enable and experience the full feature.
It is supported by v3.1.3 or later.

Effect Display



convertVoiceToText

The voice-to-text interface. Supported audio formats include wav, pcm, ogg-opus, speex, silk, mp3, m4a, aac, and amr.
API
chat.convertVoiceToText(options);
Parameter
The options parameter is of the Object type, and includes the following attribute values:
Name
Type
Description
message
Message
Audio message.
language
String | undefined
Language type, defaults to Chinese-English-Cantonese voice-to-text. Other selectable types:
zh (cmn-Hans-CN), Standard Chinese
en-US, English
yue-Hant-HK, Cantonese
ja-JP, Japanese
Returned Value
Promise
Sample
// Most commonly used Chinese-English-Cantonese voice-to-text. The language parameter can be omitted.
let promise = chat.convertVoiceToText({ message });
promise.then(function(imResponse)) {
// Voice-to-text conversion succeeded.
const { result } = imResponse.data;
}).catch(function(imError) {
// Voice-to-text conversion failed.
console.warn('convertVoiceToText error:', imError);
});
// Japanese voice-to-text
let promise = chat.convertVoiceToText({ message, language: 'ja-JP'});
promise.then(function(imResponse)) {
// Voice-to-text conversion succeeded.
const { result } = imResponse.data;
}).catch(function(imError) {
// Voice-to-text conversion failed.
console.warn('convertVoiceToText error:', imError);
});