# piyushhbhutoria/whatsappwebapi architecture

> Architecture diagram of the GitHub repository piyushhbhutoria/whatsappwebapi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/piyushhbhutoria/whatsappwebapi
- Repository: https://github.com/piyushhbhutoria/whatsappwebapi

## Overview

##### Main Components

a) User Interface Layer:
- Command Line Interface (CLI)
- QR Code Scanner Interface

b) Core Application Layer:
- Message Handler
- Command Processor
- File Processor

c) WhatsApp Integration Layer:
- WhatsApp Web Client
- Authentication Manager

d) Storage Layer:
- File System Storage (for CSV files and images)
- Session Storage (db folder)

##### Component Relationships and Data Flow

- User input → Command Processor → Message Handler → WhatsApp Web Client
- File System → File Processor → Message Handler → WhatsApp Web Client
- WhatsApp Web Client ← → WhatsApp Servers
- Authentication Flow: QR Code → WhatsApp Web Client → Session Storage

##### Specific Implementation Details

- main.go: Entry point and CLI initialization
- handler.go & handlercmd.go: Message and command processing
- image.go: Image processing functionality
- text.go: Text message handling
- checkuser.go: User verification

**[User Interface Layer]**
- ↓
**[Core Application Layer]**
- ↓
**[WhatsApp Integration Layer]**
- ↓
**[Storage Layer]**

##### Important Notes

- Bulk message functionality
- Distinction between single and bulk message paths
- File system interaction points
- Authentication flow separately

##### Technical Details

- Go-WhatsApp library integration
- CSV file processing capabilities
- Image handling support
- Session management

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#85C1E9,stroke:#2E86C1
    classDef core fill:#82E0AA,stroke:#229954
    classDef storage fill:#F8C471,stroke:#D35400
    classDef external fill:#BFC9CA,stroke:#566573
    classDef auth fill:#D7BDE2,stroke:#8E44AD

    %% User Interface Layer
    CLI["Command Line Interface"]:::ui
    QR["QR Code Scanner"]:::ui

    %% Core Application Layer
    MH["Message Handler"]:::core
    CP["Command Processor"]:::core
    subgraph Processors
        TP["Text Processor"]:::core
        IP["Image Processor"]:::core
    end

    %% WhatsApp Integration Layer
    WA["WhatsApp Web Client"]:::external
    AM["Authentication Manager"]:::auth

    %% Storage Layer
    subgraph Storage
        FS["File System Storage"]:::storage
        SS["Session Storage"]:::storage
        TXT["Text Messages CSV"]:::storage
        IMG["Image Messages CSV"]:::storage
    end

    %% External Services
    WAS["WhatsApp Servers"]:::external

    %% Relationships
    CLI --> CP
    CP --> MH
    MH --> TP
    MH --> IP
    TP --> WA
    IP --> WA
    QR --> AM
    AM --> WA
    WA <--> WAS
    FS --> TP
    FS --> IP
    WA --> SS

    %% Click Events
    click CLI "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/main.go"
    click MH "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/handler.go"
    click CP "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/handlercmd.go"
    click TP "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/text.go"
    click IP "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/image.go"
    click AM "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/checkuser.go"
    click FS "https://github.com/Piyushhbhutoria/whatsappWebAPI/tree/master/files"
    click SS "https://github.com/Piyushhbhutoria/whatsappWebAPI/tree/master/db"
    click TXT "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/files/test.csv"
    click IMG "https://github.com/Piyushhbhutoria/whatsappWebAPI/blob/master/files/testImg.csv"

    %% Legend
    subgraph Legend
        UI["User Interface"]:::ui
        CORE["Core Components"]:::core
        STRG["Storage"]:::storage
        EXT["External Services"]:::external
        AUTH["Authentication"]:::auth
    end
```
