Class WhatsAppChannelFactory

java.lang.Object
com.tnsai.channels.whatsapp.WhatsAppChannelFactory
All Implemented Interfaces:
ChannelAdapterFactory

public final class WhatsAppChannelFactory extends Object implements ChannelAdapterFactory
SPI factory for WhatsAppChannel.

If config is a WhatsAppChannelConfig instance, it's passed straight through. Anything else (including null) yields an environment-bootstrapped channel (see WhatsAppChannelConfig.fromEnvironment()).

isAvailable() probes com.sun.net.httpserver.HttpServer — the embedded JDK HTTP server used as the webhook receiver. Present on every reasonable JDK ≥ 9 module configuration; the probe exists to future-proof against jdeps-stripped runtimes that drop the jdk.httpserver module.

  • Constructor Details

    • WhatsAppChannelFactory

      public WhatsAppChannelFactory()
  • Method Details

    • getType

      public String getType()
      Description copied from interface: ChannelAdapterFactory
      Unique type identifier for this channel (e.g. "telegram", "discord", "slack").
      Specified by:
      getType in interface ChannelAdapterFactory
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ChannelAdapterFactory
      Human-readable display name for UI and logging.
      Specified by:
      getDisplayName in interface ChannelAdapterFactory
    • create

      public ChannelAdapter create(Object config)
      Description copied from interface: ChannelAdapterFactory
      Creates a new adapter instance with the given configuration.
      Specified by:
      create in interface ChannelAdapterFactory
      Parameters:
      config - platform-specific configuration (e.g. bot token, webhook URL)
      Returns:
      a configured but not yet started adapter
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: ChannelAdapterFactory
      Whether the required platform SDK classes are on the classpath.

      This allows consumers to discover which adapters are actually usable at runtime, since platform SDKs are optional dependencies.

      Specified by:
      isAvailable in interface ChannelAdapterFactory
      Returns:
      true if all required dependencies are available