Skip to content

Add WhatsApp adapter with proper architectural foundation #195

@KlementMultiverse

Description

@KlementMultiverse

Problem

The Chat SDK supports 7 platforms (Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear) but WhatsApp is missing despite clear demand—a WhatsApp adapter PR was previously rejected, and WhatsApp is now a critical business messaging platform.

More fundamentally, there's no clear architectural pattern for adding new adapters. Issue #178 identifies this as a gap: the Gateway/Transport Listener Adapter Interface needs definition before scaling to more platforms.

Why this matters

  1. Business case: WhatsApp has 500M+ active business accounts and is the primary messaging platform in many regions. Users building bots for these markets need WhatsApp support.

  2. Architecture clarity: Each new adapter follows ad-hoc patterns. Without a formal interface, maintainers must review each adapter's design individually. This slows contribution velocity and creates inconsistent behavior across platforms.

  3. Test coverage gap: The test matrix in the README shows feature parity by platform, but there's no validation that new adapters actually implement the promised interface. A WhatsApp adapter currently has no specification to conform to.

What good looks like

Part 1: Define the Adapter Interface

Create docs/ADAPTER_INTERFACE.md that specifies:

  • Required event handlers: onNewMention(), onSubscribedMessage(), onReaction(), etc. with TypeScript signatures
  • Platform capability flags: Each adapter declares what it supports (e.g., supportsModals: false for WhatsApp)
  • Message formatting rules: How JSX cards map to platform-specific formats (Block Kit vs Adaptive Cards vs WhatsApp templates)
  • State management contract: How adapters interact with state parameter from Chat constructor
  • Error handling expectations: Required vs optional error types

Part 2: WhatsApp Adapter Implementation

With the interface defined, implement @chat-adapter/whatsapp that:

  • Uses the official WhatsApp Business API (Cloud API)
  • Implements core handlers: mentions, messages, reactions, media uploads
  • Explicitly marks unsupported features in docs (no modals, no native emoji reactions)
  • Includes adapter tests validating conformance to ADAPTER_INTERFACE.md
  • Updates the platform matrix in README with accurate feature support

Acceptance criteria

  • ADAPTER_INTERFACE.md exists with formal TypeScript interface definitions
  • Existing adapters (Slack, Teams, Discord) are audited against the interface and any gaps documented
  • @chat-adapter/whatsapp implements the interface with passing tests
  • README platform matrix updated with WhatsApp feature support
  • New adapters can follow the documented pattern without design review overhead

Reference

Related: #178 (architecture), #147 (messenger adapter pattern)


Contributed by Klement Gunndu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions