Guides

Message TranslationUSER-ONLY

User Walkthrough 12 of 18

User clients can translate messages and text into another language.

Translating a Message

Use translateMessage with the target language code, chat identifier, and message identifier.

const translation = await client.translateMessage("en", chatId, messageId);

console.log(translation.text);

Use translateMessages to translate multiple messages at once.

Translating Text

Use translateText with the target language code and a TextToTranslate.

const translation = await client.translateText("en", {
  text: "Hola",
  entities: [],
});

console.log(translation.text);

Use translateTexts to translate multiple texts at once.