WhatsApp Cloud API

Send template, text, media and interactive messages through the WhatsApp Cloud API from Delphi/C++Builder. Includes a built-in HTTPS Webhook listener for inbound events.

TsgcWhatsApp_Client

Delphi/C++Builder client for the WhatsApp Business Cloud API. Send messages over HTTPS, host a Webhook endpoint for delivery and status events.

Component class

TsgcWhatsApp_Client

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Set token, send messages, host Webhook

Set AccessToken and PhoneNumberId, bind the WebHook server to a TsgcWebSocketHTTPServer, then SendMessage for outbound and OnInboundMessage for replies.

uses
  sgcLibs;

var
  WA: TsgcWhatsApp_Client;
begin
  WA := TsgcWhatsApp_Client.Create(nil);
  WA.CloudOptions.AccessToken     := 'EAAG...';
  WA.CloudOptions.PhoneNumberId   := '123456789012345';
  WA.CloudOptions.VerifyToken     := 'my-webhook-secret';

  WA.OnInboundMessage := procedure(Sender: TObject;
    const aFrom, aText: string)
  begin
    Memo1.Lines.Add(aFrom + ': ' + aText);
  end;

  WA.Active := True;

  WA.SendTextMessage('+34666555444', 'hello from Delphi');
end;
// uses: sgcLibs
TsgcWhatsApp_Client *WA = new TsgcWhatsApp_Client(this);
WA->CloudOptions->AccessToken   = "EAAG...";
WA->CloudOptions->PhoneNumberId = "123456789012345";

WA->Active = true;
WA->SendTextMessage("+34666555444", "hello from Delphi");

What's inside

Combines an HTTPS Cloud API client with a built-in Webhook HTTPS server so a single Delphi process handles outbound and inbound traffic.

Send messages

SendTextMessage, SendTemplateMessage, SendMediaMessage, SendInteractiveMessage, SendLocationMessage and SendContactMessage cover the main Cloud API content types.

Webhook listener

The component embeds a TsgcWebSocketHTTPServer to host the verification + delivery webhook required by Meta. OnInboundMessage and OnStatusUpdate deliver typed events.

Authentication

OAuth Bearer authentication via CloudOptions.AccessToken; verify-token check happens automatically against CloudOptions.VerifyToken on the first webhook GET probe.

Template parameters

SendTemplateMessage accepts named/positional parameters, language code and the component sets the typed structure Meta requires.

Media upload

The component handles the multi-step Cloud API media upload (upload → obtain media-id → reference in send) when you call SendMediaMessage with a local file path.

TLS-secured Webhook

Configure the embedded server's SSLOptions for HTTPS — Meta requires the Webhook to be reachable over TLS. WatchDog handles port re-binding on certificate rotation.

Specifications & references

Authoritative sources for the API this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — API_Whatsapp Full property, method and event reference for this component.
Demo Project — Demos\50.Other\05.WhatsApp Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Send WhatsApp Messages?

Download the free trial and integrate the WhatsApp Cloud API into your Delphi applications.