Telegram Voice to Text
Description
Section titled “Description”The telegramVoiceToText module receives a voice message from Telegram (usually from the telegramReceive node), downloads the audio file from Telegram servers, transcribes it using the OpenAI Whisper API, and automatically sends the transcription back to the user’s Telegram chat. Additionally, it modifies the output data so the type changes from voice to text and the content becomes the transcription, allowing subsequent nodes to process the message as normal text.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | Credential with OpenAI apiKey for converting audio to text. |
Credentials
Section titled “Credentials”A credential with the following field is required:
apiKey: OpenAI API Key with access to the Whisper model for audio transcription.
Additionally, the node expects the input data to contain botToken (Telegram bot token, usually propagated from telegramReceive).
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": { "type": "text", "chatId": 123456789, "from": { "id": 123456789, "first_name": "Juan" }, "botToken": "123456:ABCdefGHI", "content": "Este es el texto transcrito del audio", "transcript": "Este es el texto transcrito del audio", "metadata": { "duration": 15, "mime_type": "audio/ogg" } }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "label": "Telegram VoiceToText", "credentials_id": "credencial_openai"}API Used
Section titled “API Used”- Telegram Bot API:
GET https://api.telegram.org/bot{token}/getFileto get the file path, andPOST https://api.telegram.org/bot{token}/sendMessageto send the transcription. - OpenAI Whisper API:
POST https://api.openai.com/v1/audio/transcriptionsto transcribe the audio.
- Requires input data to contain
content(audio file_id) andbotToken(Telegram bot token). - The audio file is temporarily downloaded to the
temporal/cli_{client_id}/folder on the server. - The transcription is automatically sent to the user on Telegram in Markdown format.
- The data type is changed from
voicetotextin the output, facilitating subsequent processing. - The
transcriptfield is added as an additional field to the existing data. - Internally uses the
openaiaudioToTextmodule for transcription.
Related Nodes
Section titled “Related Nodes”- telegramReceive (Telegram message trigger, provides input data)
- openaiaudioToText (transcription module used internally)
- decision (to evaluate the transcribed content)