TTMSFNCWhatsAppReceiver is a headless component that receives the messages sent to a WhatsApp Business number. It connects securely to a TTMSFNCWhatsAppServer, which hosts the WhatsApp webhook, and parses each forwarded message — text, images, documents, audio, video, stickers, locations, and contacts — into structured Delphi objects. It is built on TTMSFNCWebsocketClient and is the one component of this product that also runs in TMS WEB Core browser applications.
Chrome, Edge, Firefox, Safari, and other modern browsers, through WEBLib.TMSFNCWhatsAppReceiver.
Minimal example
Connect to the server and show every incoming message:
Connect and handle incoming messagesPascal
procedure TForm1.FormCreate(Sender: TObject);
begin
// wss://hooks.example.com:443/ - the host running TTMSFNCWhatsAppServer
TMSFNCWhatsAppReceiver1.HostName := 'hooks.example.com';
TMSFNCWhatsAppReceiver1.Port := 443;
TMSFNCWhatsAppReceiver1.Active := True;
end;
procedure TForm1.TMSFNCWhatsAppReceiver1WhatsAppMessageReceived(Sender: TObject;
AMessage: TTMSFNCWhatsAppReceiverMessage);
var
Line: string;
begin
// Read what you need now: AMessage is freed when the handler returns.
Line := AMessage.From.Name + ' (' + AMessage.From.Phone + '): ' + AMessage.Text.Body;
// In VCL and FMX applications this event runs on a background thread.
TThread.Queue(nil,
procedure
begin
Memo1.Lines.Add(Line);
end);
end;