Convert Telegram Voice Messages to Professional Emails with Whisper, GPT-4 & Gmail

Telegram Voice Message → Automatic Email

Imagine: What if you could turn a simple Telegram voice message into a professional email—without typing, copying, pasting, or even opening Gmail?

This workflow does it all for you: just record a voice note, and it will transcribe, format, and write a clean HTML email, then send it to the right person—all by itself.

Prerequisites

Create a Telegram bot** (via BotFather) and get the token. Have an OpenAI account** (API key for Whisper and GPT-4). Set up a Gmail account with OAuth2.** Import the JSON template** into your automation platform.

🧩 Detailed Flow Architecture

  1. Telegram Trigger

Node: Telegram Trigger
This node listens to all Message events received by the specified bot (e.g., “BOT OFFICIEL BAPTISTE”).
Whenever a user sends a voice message, the trigger fires automatically.

> ⚠️ Only one Telegram trigger per bot is possible (API limitation).

Key parameter:
Trigger On: Message

  1. Wait

Node: Wait
Used to buffer or smooth out calls to avoid collisions if you receive several voice messages in a row.

  1. Retrieve the Audio File

Node: Get a file
Type:** Telegram (resource: file) Parameter:**
fileId = {{$json"message"["file_id"]}}
This node fetches the voice file from Telegram received in step 1

  1. Automatic Transcription (Whisper)

Node: Transcribe a recording
Resource:** audio
Operation:** transcribe
API Key:** Your OpenAI account
The audio file is sent to OpenAI Whisper: the output is clean, accurate text ready to be processed.

  1. Optional Wait (Wait1)

Node: Wait1
Same purpose as step 2: useful if you want to buffer or add a delay to absorb processing time.

  1. Structured Email Generation (GPT-4 + Output Parser)

Node: AI Agent
This is the core of the flow:

The transcribed text is sent to GPT-4 (or GPT-4.1-mini here, via OpenAI Chat Model) Prompt used:**

    You are an assistant specialized in writing professional emails.

Based on the text below, you must: {{ $json.text }}

Detect if there is a recipient's email address in the text (or something similar like "send to fort.baptiste.pro")
   If it’s not a complete address, complete it by assuming it ends with @gmail.com.
Understand the user's intent (resignation, refusal, application, excuse, request, etc.)
Generate a relevant and concise email subject, faithful to the content
Write a professional message, structured in HTML:
   With a polite tone, adapted to the situation
   Formatted with HTML tags (`, `, etc.)
   No spelling mistakes in French
   My first name is jeremy and if the text says he is not happy, specify the wish to resign

⚠️ You must always return your answer in the following strict JSON format, with no extra text:

    {
  "email": "adresse@gmail.com",
  "subject": "Objet de l’email",
  "body": "Contenu HTML de l’email"
}

Everything is strictly validated and formatted with the Structured Output Parser node.

  1. Automatic Email Sending (Gmail)

Node: Send a message
To:** {{$json.output.email}} Subject:** {{$json.output.subject}} HTML Body:** {{$json.output.body}}
This node takes the JSON structure returned by the AI and sends the email via Gmail, to the right recipient, with the correct subject and full HTML formatting.

0
Downloads
0
Views
8.64
Quality Score
intermediate
Complexity
Author:Baptiste Fort(View Original →)
Created:8/13/2025
Updated:8/25/2025

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments