WhatsApp Chat Parser

VerifiedSafe

Parse WhatsApp chat export files (.txt) into structured JSON data, extracting participants, timestamps, messages, media placeholders, and system messages. Handles multiple date formats (US, EU, ISO) and edge cases like multi-line messages and encoding issues. Useful when you need to analyze or transform WhatsApp conversation data programmatically.

Sby Skills Guide Bot
Data & AIIntermediate
6/2/2026
Claude Code
#whatsapp#chat-parser#data-extraction#text-processing

Recommended for

Automated summary

This skill parses WhatsApp chat export files (.txt) into structured JSON data including participants, timestamps, and messages.

Strengths

  • Handles multiple date formats (EU, US, ISO)
  • Detects media and system messages
  • Supports multi-line messages
  • Provides metadata like message count and date range

Limitations

  • Relies on UTF-8 encoding (with latin-1 fallback)
  • Does not handle actual media attachments
  • May fail on non-standard formats or regional variations
When to use it

When you need to analyze WhatsApp chat histories and convert them into structured data for processing or analysis.

When not to use it

When dealing with binary files or end-to-end encrypted message exports that are not plain text, or when the export format is not textual.

Security analysis

Safe
Quality score92/100

The skill only reads a specified file and parses its text content, with no destructive operations, network access, or execution of external commands. All code is standard Python, and there is no risk of exfiltration or system compromise.

No concerns found

How this analysis is made

Examples

Parse a WhatsApp chat file
Parse the WhatsApp chat in examples/sample-whatsapp-chat.txt
Extract participants and messages
Extract all participants and messages from this WhatsApp export file: /data/chat.txt. Return JSON.
Count media messages
Parse this WhatsApp chat and tell me how many media messages were sent, and by whom.

Directory: launch-agent-skills/skills/whatsapp-parser/skill.md


name: WhatsApp Chat Parser description: Parse WhatsApp chat exports into structured JSON data with participants, timestamps, and messages triggers:

  • whatsapp
  • chat export
  • parse chat
  • message history
  • chat file

WhatsApp Chat Parser

Purpose

Parse WhatsApp chat export files (.txt) and extract structured data including:

  • Participant list
  • Message count and date range
  • Individual messages with timestamps and senders
  • Media placeholders and system messages

WhatsApp Export Format

WhatsApp exports follow this pattern (may vary by locale):

[DD/MM/YYYY, HH:MM:SS] Sender Name: Message content

Format Variations

| Region | Date Format | Example | |--------|-------------|---------| | US | MM/DD/YY | [01/28/26, 9:15:32 AM] | | EU/UK | DD/MM/YYYY | [28/01/2026, 09:15:32] | | ISO | YYYY-MM-DD | [2026-01-28, 09:15:32] |

Special Message Types

  • Media: <Media omitted> or <image omitted>, <video omitted>
  • System: Messages without sender (e.g., "Alice added Bob to the group")
  • Multi-line: Continuation lines without timestamp prefix
  • Links: URLs embedded in message text
  • Replies: May include quoted text with formatting

Instructions

Step 1: Read the Chat File

with open(chat_file_path, 'r', encoding='utf-8') as f:
    content = f.read()

Step 2: Parse Messages Using Regex

import re
from datetime import datetime

# Pattern for WhatsApp message format (handles multiple date formats)
patterns = [
    # EU format: [DD/MM/YYYY, HH:MM:SS]
    r'\[(\d{2}/\d{2}/\d{4}),\s*(\d{2}:\d{2}:\d{2})\]\s*([^:]+):\s*(.*)',
    # US format: [MM/DD/YY, H:MM:SS AM/PM]
    r'\[(\d{2}/\d{2}/\d{2}),\s*(\d{1,2}:\d{2}:\d{2}\s*[AP]M)\]\s*([^:]+):\s*(.*)',
]

messages = []
current_message = None

for line in content.split('\n'):
    matched = False
    for pattern in patterns:
        match = re.match(pattern, line)
        if match:
            if current_message:
                messages.append(current_message)
            
            date_str, time_str, sender, text = match.groups()
            current_message = {
                'date': date_str,
                'time': time_str,
                'sender': sender.strip(),
                'content': text.strip(),
                'is_media': '<media omitted>' in text.lower() or '<omitted>' in text.lower()
            }
            matched = True
            break
    
    # Handle multi-line messages
    if not matched and current_message and line.strip():
        current_message['content'] += '\n' + line

if current_message:
    messages.append(current_message)

Step 3: Extract Metadata

participants = list(set(msg['sender'] for msg in messages))
date_range = {
    'start': messages[0]['date'] if messages else None,
    'end': messages[-1]['date'] if messages else None
}
message_count = len(messages)
media_count = sum(1 for msg in messages if msg['is_media'])

Step 4: Return Structured Output

{
  "metadata": {
    "participants": ["Alice Developer", "Bob Engineer"],
    "message_count": 42,
    "media_count": 3,
    "date_range": {
      "start": "28/01/2026",
      "end": "28/01/2026"
    }
  },
  "messages": [
    {
      "timestamp": "28/01/2026 09:15:32",
      "sender": "Alice Developer",
      "content": "Hey Bob, did you push the code?",
      "is_media": false
    }
  ]
}

Edge Cases

| Scenario | How to Handle | |----------|---------------| | System messages | Sender = "System" or skip | | Empty lines | Skip or treat as message separator | | Emoji-only messages | Parse normally, emoji preserved | | Very long messages | No truncation, preserve full content | | Non-UTF8 encoding | Try latin-1 fallback |

Example Usage in Claude Code

User: "Parse the WhatsApp chat in examples/sample-whatsapp-chat.txt"

Claude should:

  1. Read the file using the path provided
  2. Apply the parsing logic above
  3. Return structured JSON with metadata and messages
  4. Highlight interesting stats (most active participant, busiest hour, etc.)

Related Skills

  • whatsapp-summarizer - Generate summaries from parsed chats
  • whatsapp-action-extractor - Find TODOs and action items in messages

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/whatsapp-chat-parser-mm5t8bku/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/whatsapp-chat-parser-mm5t8bku' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/whatsapp-chat-parser-mm5t8bku/download' --output '.skill-downloads/whatsapp-chat-parser-mm5t8bku/SKILL.md.part' && mv '.skill-downloads/whatsapp-chat-parser-mm5t8bku/SKILL.md.part' '.skill-downloads/whatsapp-chat-parser-mm5t8bku/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/whatsapp-chat-parser-mm5t8bku/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills