Convert WhatsApp chat exports to beautifully formatted PDFs with automatic audio transcription using AI.
โญ Star this repo if you find it useful!
Click to see examples
Beautiful chat bubbles with green messages and audio transcriptions
Clean, simple design perfect for archiving
Generated PDF with embedded images and transcribed audio
- ๐ Automatic message parsing from WhatsApp exports
 - ๐๏ธ AI-powered audio transcription using OpenAI Whisper
 - ๐ผ๏ธ Embedded images directly in PDF
 - ๐ Media file references (documents, videos)
 - ๐ 100+ languages supported (6 built-in translations + auto-detect)
 - ๐จ Customizable HTML templates (WhatsApp-style layouts)
 - ๐ Multi-language interface (language files in 
languages/folder) - โ๏ธ Highly customizable (colors, fonts, spacing)
 - ๐พ Smart caching (instant regeneration, up to 98% time savings)
 - ๐ Batch processing (multiple chats at once)
 - ๐ Privacy options (exclude images)
 
# Install dependencies
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Single chat
python3 main.py "chat.zip"
# With language specification
python3 main.py "chat.zip" -l en
# All chats in folder (batch mode)
python3 main.py --batchOr use the convenience wrapper:
# Automatically sets up environment
./convert.sh "chat.zip"
# Verify setup
./check_setup.shWhatsApp exports are created on your phone. Here are the easiest ways to transfer them to your computer:
No file transfer needed! Upload directly from your phone:
# Start the web server on your computer
python3 web_upload.pyThen on your phone:
- Connect to the same WiFi as your computer
 - Open browser โ go to URL shown (e.g., 
http://192.168.1.100:8080) - Upload WhatsApp ZIP file
 - Download generated PDF!
 
Enable direct sharing from WhatsApp!
# Option 1: Cloudflared (Recommended - No warning page)
# Install cloudflared first:
# Linux:
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
sudo mv cloudflared-linux-amd64 /usr/local/bin/cloudflared
sudo chmod +x /usr/local/bin/cloudflared
# macOS:
brew install cloudflared
# Windows:
# Method 1: Using Scoop (recommended)
scoop install cloudflared
# Method 2: Using Chocolatey
choco install cloudflared
# Method 3: Manual installation
# 1. Download from: https://github.com/cloudflare/cloudflared/releases/latest
#    (choose: cloudflared-windows-amd64.exe for 64-bit or cloudflared-windows-386.exe for 32-bit)
# 2. Add the downloaded file to a folder (e.g., C:\Program Files\cloudflared\)
# 3. Add this folder to your PATH:
#    - Open Environment Variables: Win+R โ sysdm.cpl โ Environment Variables
#    - Add the folder to the "Path" variable in System variables
# 4. Restart your terminal
# Start with HTTPS tunnel (temporary URL, changes on restart)
python3 web_upload.py --https
# For PERSISTENT URL (same URL every time):
# Easy setup with helper script:
./setup_tunnel.sh
# Or manual setup:
# 1. Login to Cloudflare (one time)
cloudflared tunnel login
# 2. Create a named tunnel (one time)
cloudflared tunnel create chat2pdf
# 3. Configure DNS route (one time)
cloudflared tunnel route dns chat2pdf chat2pdf.yourdomain.com
# 4. Run with your tunnel name
python3 web_upload.py --tunnel-name chat2pdf
# Your URL will be: https://chat2pdf.yourdomain.com
# Option 2: ngrok (Alternative - Shows warning page on first visit)
pip install pyngrok
python3 web_upload.py --ngrokNote on Persistent URLs:
- Named tunnels require a domain managed by Cloudflare (free account OK)
 - If you don't have a domain, use the quick tunnel (
--https) - URL changes but it's instant - The helper script 
setup_tunnel.shwill guide you through the setup 
Setup (one time only):
- Open the HTTPS URL shown on your phone (e.g., 
https://xxxx.trycloudflare.comorhttps://xxxx.ngrok-free.app) - Tap "Install app" or "Add to Home Screen"
 - The "Chat2PDF" app will be installed on your phone
 
Every time you export a chat:
- WhatsApp โ Open chat โ โฎ โ More โ Export chat
 - Choose "Include Media"
 - Tap "Share" button
 - Select "Chat2PDF" from the share menu! ๐ฑ
 - File uploads automatically โ Download PDF when ready!
 
Requirements:
- โ Android + Chrome/Edge (iOS Safari doesn't support Share Target API)
 - โ
 Cloudflared installed (recommended) OR Free ngrok account: Sign up here โ Get auth token โ Run 
ngrok config add-authtoken YOUR_TOKEN 
Features:
- ๐ฑ Mobile-friendly interface
 - ๐จ Drag & drop upload
 - ๐ Language selection
 - โก Auto processing
 - ๐ฅ Direct PDF download
 - ๐ PWA Share Target (share directly from WhatsApp!)
 - ๐ Cloudflared: No warning pages, instant access
 
- Export chat on WhatsApp โ Choose "Include Media"
 - Save to Google Drive, iCloud, Dropbox, etc.
 - Download on your computer from the cloud service
 
- Export chat on WhatsApp
 - Choose "Email" as share method
 - Open email on computer and download attachment
 โ ๏ธ Limit: Email attachments usually max at 25 MB
- Export chat on WhatsApp โ Save to phone storage
 - Connect phone to computer via USB cable
 - Copy ZIP file from phone's WhatsApp folder:
- Android: 
/Internal Storage/WhatsApp/ - iOS: Use iTunes File Sharing or Finder
 
 - Android: 
 
- Export chat on WhatsApp
 - Share via Telegram (send to "Saved Messages"), Signal, etc.
 - Download from desktop app
 
Use apps like:
- SendAnywhere (no account needed)
 - LocalSend (open source, no internet needed)
 - Snapdrop (web-based, same network)
 
๐ก Tip: For large chats with media, cloud storage or local network transfer are fastest!
- Python 3.8+
 - ffmpeg (for audio conversion)
 - ~500 MB disk space (for Whisper model)
 
# Linux (Ubuntu/Debian)
sudo apt install ffmpeg
# macOS
brew install ffmpeg
# Windows
# Download from: https://ffmpeg.org/download.html
# Or use: choco install ffmpeg# Basic usage
python3 main.py chat.zip
# Specify output filename
python3 main.py chat.zip -o output.pdf
# Specify language for transcription
python3 main.py chat.zip -l en
# Using the wrapper script (easier)
./convert.sh chat.zip
./convert.sh chat.zip -o output.pdf -l enTip: The convert.sh wrapper script automatically:
- Creates virtual environment if needed
 - Installs dependencies
 - Activates the environment
 - Runs the transcriber
 
Process multiple chat files at once:
# Process all .zip files in current directory
python3 main.py --batch
# With language specification
python3 main.py --batch -l en
# Skip files that already have PDF output
python3 main.py --batch --skip-existing
# Custom file pattern
python3 main.py --batch --pattern "WhatsApp*.zip"Single file mode:
  python3 main.py <zip_file> [-o output.pdf] [-l language]
Batch mode:
  python3 main.py --batch [-l language] [--pattern "*.zip"] [--skip-existing]
Options:
  -o, --output      Output PDF filename
  -l, --language    Language for transcription (e.g., en, es, it, fr)
  --batch           Process all .zip files in current directory
  --pattern         File pattern for batch mode (default: *.zip)
  --skip-existing   Skip files that already have PDF output
  --help            Show help message
Customize everything via config.ini:
# Copy example configuration
cp config.example.ini config.ini
# Edit as needed
nano config.iniPDF Settings
[PDF]
page_size = A4              # or letter
left_margin = 0.5           # inches
right_margin = 0.5
max_image_width = 3.0       # inches
max_image_height = 2.5Whisper AI Settings
[WHISPER]
model = small               # tiny, base, small, medium, large
language = en               # Leave empty for auto-detectLayout Customization
[LAYOUT]
title_font_size = 20
sender_font_size = 10
message_font_size = 9
message_alignment = JUSTIFY  # LEFT, CENTER, RIGHT, JUSTIFYColors
[COLORS]
title_color = 075E54        # Hex color without #
sender_color = 25D366       # WhatsApp green
media_color = 0084FF
system_color = 808080Privacy
[PRIVACY]
exclude_images = false      # Set to true to exclude images from PDFHTML Templates
[HTML_TEMPLATE]
enabled = true                    # HTML templates enabled by default
template_file = templates/template.html     # WhatsApp-style layout
show_stats = true                 # Show message/media statisticsAvailable templates:
templates/template.html- Full WhatsApp-style layout (default)templates/template_minimal.html- Minimal clean layouttemplates/template_simple.html- Simple text-based layout
Language Translation
[LANGUAGE]
code = en                         # en, es, fr, de, it, ptThe program loads language-specific strings from languages/XX.ini files. These control:
- Pattern matching in exported WhatsApp files
- "file attached" (English)
 - "archivo adjunto" (Spanish)
 - "fichier joint" (French)
 
 - PDF labels: "Audio:", "IMAGE", "VIDEO", "DOCUMENT"
 - System messages: "excluded for privacy", "Transcription failed"
 
Note: All language-dependent strings are now in languages/ folder.
The config file no longer contains language strings.
See languages/README.md for how to add new languages.
Audio transcriptions are automatically cached to save time:
# First time: ~10 minutes
python3 main.py chat.zip
# Regeneration: ~3 seconds โก
python3 main.py chat.zip -o chat_v2.pdfTime savings: up to 98%!
The cache is stored in .transcription_cache/ directory and is automatically created when needed.
Whisper AI supports 100+ languages for audio transcription:
en- Englishes- Spanishfr- Frenchde- Germanit- Italianpt- Portugueseru- Russianja- Japanesezh- Chinesear- Arabichi- Hindiko- Korean- And many more...
 
Tip: Specifying the language with -l is faster than auto-detect (up to 50% faster).
Built-in translations for the PDF interface (labels, patterns, messages):
| Language | Code | File | Status | 
|---|---|---|---|
| ๐ฌ๐ง English | en | 
languages/en.ini | 
โ Default | 
| ๐ช๐ธ Spanish | es | 
languages/es.ini | 
โ Complete | 
| ๐ซ๐ท French | fr | 
languages/fr.ini | 
โ Complete | 
| ๐ฉ๐ช German | de | 
languages/de.ini | 
โ Complete | 
| ๐ฎ๐น Italian | it | 
languages/it.ini | 
โ Complete | 
| ๐ต๐น Portuguese | pt | 
languages/pt.ini | 
โ Complete | 
These files control:
- WhatsApp export patterns ("file attached" vs "archivo adjunto")
 - PDF labels ("Audio:", "IMAGE", "VIDEO", etc.)
 - System messages
 
To use a different language:
# Set in config.ini
[LANGUAGE]
code = es
# Or use command line
python3 main.py chat.zip -l esSee languages/README.md to add new translations.
WhatsappTranscriber/
โโโ main.py                 # Main script
โโโ convert.sh              # Wrapper script
โโโ check_setup.sh          # Environment verification script
โโโ config.example.ini      # Example configuration
โโโ requirements.txt        # Python dependencies
โโโ templates/              # HTML templates
โ   โโโ template.html           # Full WhatsApp-style layout (default)
โ   โโโ template_minimal.html   # Minimal clean layout
โ   โโโ template_simple.html    # Simple text-based layout
โโโ languages/              # Language files
โ   โโโ README.md
โ   โโโ en.ini              # English (default)
โ   โโโ es.ini              # Spanish
โ   โโโ fr.ini              # French
โ   โโโ de.ini              # German
โ   โโโ it.ini              # Italian
โ   โโโ pt.ini              # Portuguese
โโโ LICENSE                 # MIT License
โโโ README.md              # This file
Convenience wrapper that handles environment setup automatically:
./convert.sh chat.zip              # Single file
./convert.sh --batch               # All .zip files  
./convert.sh chat.zip -l en        # With language
./convert.sh --help                # Show helpVerifies your environment is correctly configured:
./check_setup.shThis checks:
- โ Python 3 installation
 - โ Virtual environment
 - โ Required dependencies (ReportLab, Pillow, PyDub, Whisper)
 - โ FFmpeg availability
 - โ Project files integrity
 
- Open WhatsApp
 - Open the chat you want to export
 - Tap โฎ (menu) โ More โ Export chat
 - Choose "Include Media"
 - Save the .zip file
 
- Open WhatsApp
 - Open the chat you want to export
 - Tap the contact/group name at the top
 - Scroll down and tap Export Chat
 - Choose "Attach Media"
 - Save the .zip file
 
The exported .zip file contains:
chat.zip
โโโ _chat.txt              # Message history
โโโ IMG-*.jpg              # Images
โโโ PTT-*.opus             # Audio messages
โโโ VID-*.mp4              # Videos
โโโ *.pdf                  # Documents
Generated PDF includes:
- โ Title and metadata
 - โ Formatted messages (sender, date, time)
 - โ Audio transcriptions embedded inline
 - โ Images embedded (optional)
 - โ Links to documents/videos
 - โ System messages (group changes, etc.)
 
Example output: chat_transcript.pdf
python3 main.py "WhatsApp Chat with John.zip" -l enOutput: WhatsApp_Chat_with_John_transcript.pdf
# Process all WhatsApp exports in folder
python3 main.py --batch -l en# Modify config.ini (colors, margins, etc.)
# Regenerate all PDFs (uses cached audio transcriptions)
python3 main.py --batch
# Fast! โก (seconds instead of minutes)# Process only files without existing PDF output
python3 main.py --batch --skip-existingThe project uses HTML templates for PDF generation. You can customize the layout by editing or creating your own template:
Template Variables:
{{chat_title}}- Chat name{{generation_date}}- PDF generation date{{total_messages}}- Message count{{total_media}}- Media files count{{total_transcriptions}}- Transcribed audio count
Message Loop:
{{#each messages}}
  <div class="message {{this.message_class}}">
    <strong>{{this.sender}}</strong>
    <span>{{this.time}}</span>
    <p>{{this.text}}</p>
    {{#if this.transcription}}
      <em>๐๏ธ {{this.transcription}}</em>
    {{/if}}
    {{#if this.media}}
      <!-- Media handling -->
    {{/if}}
  </div>
{{/each}}Conditionals:
{{#if condition}}...{{/if}}- Show if true{{#if condition}}...{{else}}...{{/if}}- If-else{{#each array}}...{{/each}}- Loop through array
Available templates:
templates/template.html- WhatsApp-style with green bubbles and statisticstemplates/template_minimal.html- Clean minimal designtemplates/template_simple.html- Simple text-based layout
To use a different template, edit config.ini:
[HTML_TEMPLATE]
enabled = true
template_file = templates/template_minimal.htmlInterface strings are stored in languages/XX.ini files. Create new translations by copying an existing file:
cp languages/en.ini languages/ja.iniThen edit the strings:
[PATTERNS]
# Must match WhatsApp export format in your language
attached_file = ๆทปไปใใกใคใซ
[LABELS]
# Labels shown in PDF
audio = ใชใผใใฃใช:
image = ็ปๅ
video = ใใใช
[MESSAGES]
# System messages
image_excluded = ใใฉใคใใทใผใฎใใ้คๅค
transcription_failed = ่ปขๅใซๅคฑๆใใพใใSee languages/README.md for detailed instructions.
# Make sure virtual environment is activated
source venv/bin/activate
pip install -r requirements.txtInstall ffmpeg (see Requirements section above).
Cache is stored in .transcription_cache/:
# Verify cache directory exists
ls -la .transcription_cache/
# Clear cache to force re-transcription
rm -rf .transcription_cache/# Check for .zip files
ls *.zip
# Use specific pattern
python3 main.py --batch --pattern "WhatsApp*.zip"- Specify the language explicitly: 
-l en - Use a better model in config.ini: 
model = mediumormodel = large - Check audio quality in original files
 
| Operation | First Time | With Cache | 
|---|---|---|
| 1 chat (10 audio) | ~10 min | ~3 sec โก | 
| 10 chats (100 audio) | ~100 min | ~30 sec โก | 
| PDF regeneration | ~10 min | ~3 sec โก | 
Cache provides up to 98% time savings!
- AI Model: Whisper by OpenAI
 - Default Model: small (466 MB)
 - First Run: Model download (~2-3 min)
 - Accuracy: 85-95% (depends on audio quality)
 - Supported Audio: opus, m4a, mp3, wav, aac
 - Supported Images: jpg, jpeg, png, gif, webp
 - Cache: Automatic, file-based
 
Contributions are welcome! Please feel free to submit a Pull Request.
See CONTRIBUTING.md for detailed guidelines on:
- Reporting bugs
 - Suggesting enhancements
 - Adding language translations
 - Creating templates
 - Code contributions
 
Ways to contribute:
- ๐ Report bugs
 - ๐ก Suggest features
 - ๐ Add language translations
 - ๐จ Create new templates
 - ๐ Improve documentation
 - โญ Star this repository
 
This project is released under the MIT License. See LICENSE file for details.
It uses the following open-source libraries:
- Whisper by OpenAI (MIT License)
 - ReportLab (BSD License)
 - WeasyPrint (BSD License)
 
- OpenAI for the amazing Whisper model
 - The ReportLab team for PDF generation
 - The WeasyPrint team for HTML to PDF conversion
 - Cloudflare for cloudflared tunneling
 
Made with โค๏ธ for preserving your conversations