Bulk Messaging System

Documentation

Message composition and templates

Introduction#

This page explains the message composition and templating functionality for WhatsApp bulk messaging. It covers the editing interface, personalization using {{name}} placeholders, validation and limits, dynamic content generation, preview and character counting, and best practices for crafting engaging messages while complying with platform guidelines.

Project structure#

The message composition and templating features span the Electron front-end (React components and IPC), the Electron main process (WhatsApp client orchestration), and optional Python utilities for contact parsing and validation.

Core components#

  • Message editor UI with character counter and personalization hint
  • Template engine: placeholder replacement with contact data
  • Validation and limits: message length and contact parsing
  • Preview and feedback: real-time status and logs
  • Optional Python utilities for manual number parsing and validation

Key capabilities:

  • Personalization using {{name}} placeholders
  • Character limit display (4096 characters)
  • Dynamic content generation per contact
  • Real-time status updates and logs

Architecture overview#

The message composition flow integrates UI input, state management, IPC to the main process, and the WhatsApp client. The main process performs personalization and sends messages, reporting status back to the UI.

Detailed component analysis#

Message editor UI#

  • Text area for composing messages with a placeholder indicating {{name}} personalization
  • Character counter showing current length vs. the 4096-character limit
  • Disabled state during sending to prevent concurrent edits
  • Send button triggers the bulk send action

Template engine and personalization#

  • The main process replaces {{name}} with either the contact’s name or a default fallback (“Friend”) before sending
  • Chat ID construction uses the contact number with WhatsApp’s c.us format
  • Unregistered numbers are detected and reported as failures

Message validation and limits#

  • Character limit: 4096 characters shown in the editor
  • Message presence: send is disabled if the message is empty
  • Contact presence: send is disabled if no contacts are loaded
  • During sending, the UI disables controls to prevent interruptions

Contact data and manual parsing#

  • Manual number parsing supports formats with optional names and multiple separators
  • The Electron main process can import CSV/Text files for contacts
  • Optional Python utilities provide additional parsing and validation logic

Message preview and feedback#

  • Real-time status updates (connecting, ready, authenticated, errors)
  • Activity log displays send results with color-coded indicators
  • QR code display and retry mechanism for connection issues

Dependency analysis#

  • UI depends on BulkMailer for state and actions
  • BulkMailer bridges UI to Electron IPC exposed in preload.js
  • Preload.js invokes main.js handlers for WhatsApp operations
  • Manual number parsing uses pyodide.js to run Python code in the renderer
  • Optional Python backend routes support file uploads and validation

Performance considerations#

  • Rate limiting: The main process waits between sending messages to avoid rate limits and reduce spam risk
  • Batch size: Consider splitting large contact lists into smaller batches
  • Network stability: Ensure reliable connectivity; QR loading and authentication retries are handled
  • UI responsiveness: Disable send controls during operations to prevent duplicate submissions

[No sources needed since this section provides general guidance]

Troubleshooting guide#

Common issues and resolutions:

  • QR code not loading: Retry connection or check console for errors
  • Authentication failures: Re-scan QR and ensure device permissions
  • Send failures: Check registration status; unregistered numbers will fail
  • Empty message or no contacts: Ensure message is present and contacts are imported
  • Exceeding character limit: Trim message to under 4096 characters

Conclusion#

The message composition and templating system provides a reliable, user-friendly interface for creating personalized WhatsApp messages at scale. With {{name}} placeholders, a clear character counter, and real-time feedback, users can craft engaging messages while respecting platform limits and best practices. The integration with Electron IPC and optional Python utilities ensures flexible contact processing and validation.