Skip to main content
Table of Contents

TMS FNC WhatsApp Server

TTMSFNCWhatsAppServer is a headless component that hosts the callback URL of a WhatsApp Business Platform webhook. It answers Meta's webhook verification with your verify token, receives the JSON payloads WhatsApp posts for incoming messages, lets you inspect and filter them, and forwards them over WebSocket to the connected TTMSFNCWhatsAppReceiver clients. It is built on TTMSFNCWebSocketServer and always runs over TLS, as WhatsApp requires.

Documentation

Start here Use when
Get started Start a WhatsApp webhook server and look at incoming payloads.
Guides Task guides: webhook setup and verification, HTTPS, and forwarding messages.
API reference Full property, method, and event reference.

Supported frameworks

Framework Support
VCL Win32 and Win64.
FMX Windows, macOS, iOS, Android, and Linux; in practice a server with a public HTTPS address.
TMS WEB Core Not available; a browser cannot host a server.

Minimal example

Configure the verify token and certificate, start the server, and look at each payload before it is forwarded:

Start the webhook server and inspect incoming payloadsPascal
procedure TForm1.FormCreate(Sender: TObject);
begin
  // Callback URL in the Meta dashboard: https://<your-domain>/
  TMSFNCWhatsAppServer1.Port := 443;
  TMSFNCWhatsAppServer1.VerifyToken := 'my-verify-token';   // same value as in the dashboard
  TMSFNCWhatsAppServer1.CertificateFile := 'certs\cert.pem';
  TMSFNCWhatsAppServer1.CertificateKeyFile := 'certs\key.pem';
  TMSFNCWhatsAppServer1.RootCertificateFile := 'certs\chain.pem';
  TMSFNCWhatsAppServer1.Active := True;
end;

procedure TForm1.TMSFNCWhatsAppServer1RawMessage(Sender: TObject;
  AMessage: string; var ABroadcast: Boolean);
begin
  // AMessage is the JSON body WhatsApp posted. This event runs on the
  // server's connection thread, so queue user interface updates.
  TThread.Queue(nil,
    procedure
    begin
      Memo1.Lines.Add(AMessage);
    end);
  // Leave ABroadcast True to forward the payload to every connected receiver.
end;

API map

Role Classes
Main component TTMSFNCWhatsAppServer (webhook host), derived from TTMSFNCWebSocketServer
Webhook events OnRawMessage, TTMSFNCWhatsAppServerMessageEvent, VerifyToken
Receiver connections TTMSFNCWebSocketServerConnection, derived from TTMSFNCWebSocketConnection
Sending to receivers BroadcastMessage, SendMessageTo, TTMSFNCWebSocketSendToCallBack
Counterpart TTMSFNCWhatsAppReceiver

Guides

Area Guide
Setup Webhook setup — Meta app, callback URL, verify token, messages subscription, HTTPS, and custom paths.
Message flow Forwarding messages — inspect, filter, and route payloads to receivers.

See Also