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.
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.
Delphi/C++Builder client for the WhatsApp Business Cloud API. Send messages over HTTPS, host a Webhook endpoint for delivery and status events.
TsgcWhatsApp_Client
Windows, macOS, Linux, iOS, Android
Standard / Professional / Enterprise
Set WhatsAppOptions.Token and PhoneNumberId, call a SendMessage... method to send, then StartServer and hook OnMessageReceived to receive replies.
uses
sgcLibs;
var
WhatsApp: TsgcWhatsApp_Client;
begin
WhatsApp := TsgcWhatsApp_Client.Create(nil);
WhatsApp.WhatsAppOptions.PhoneNumberId := '123456789012345';
WhatsApp.WhatsAppOptions.Token := 'EAAG...';
WhatsApp.SendMessageText('+34666555444', 'hello from Delphi');
WhatsApp.OnMessageReceived := WhatsAppMessageReceived;
WhatsApp.StartServer;
end;
procedure TForm1.WhatsAppMessageReceived(Sender: TObject;
const aMessage: TsgcWhatsApp_Receive_Message;
var aMarkAsRead: Boolean);
begin
Memo1.Lines.Add(aMessage.RawMessage);
aMarkAsRead := True;
end;
// include: sgcLibs.hpp
TsgcWhatsApp_Client *WhatsApp = new TsgcWhatsApp_Client(this);
WhatsApp->WhatsAppOptions->PhoneNumberId = "123456789012345";
WhatsApp->WhatsAppOptions->Token = "EAAG...";
WhatsApp->SendMessageText("+34666555444", "hello from Delphi");
WhatsApp->OnMessageReceived = WhatsAppMessageReceived;
WhatsApp->StartServer();
void __fastcall TForm1::WhatsAppMessageReceived(TObject *Sender,
TsgcWhatsApp_Receive_Message * const aMessage, bool &aMarkAsRead)
{
Memo1->Lines->Add(aMessage->RawMessage);
aMarkAsRead = true;
}
Combines an HTTPS Cloud API client with a built-in Webhook HTTPS server so a single Delphi process handles outbound and inbound traffic.
SendMessageText, SendMessageTemplate, SendMessageImage/Document/Audio/Video, SendMessageInteractiveList, SendMessageInteractiveButtons, SendMessageLocation and SendMessageContact cover the main Cloud API content types.
The component starts its own embedded HTTPS server (StartServer/StopServer, configured through ServerOptions) to host the verification and delivery webhook Meta requires. OnMessageReceived and OnMessageSent deliver typed events, OnRawMessage exposes the untouched JSON.
OAuth Bearer authentication via WhatsAppOptions.Token; the webhook verification handshake is checked automatically against ServerOptions.WebhookOptions.Token, and OnBeforeSubscribe gives your app one more chance to accept or reject the subscription.
SendMessageTemplate accepts named/positional parameters, a language code and the component builds the typed structure Meta requires.
Call SendFileImage, SendFileDocument, SendFileAudio, SendFileVideo or SendFileSticker with a local file path, the component uploads it through UploadMedia and references the returned media id automatically. DownloadMedia and DeleteMedia manage assets already on Meta's servers.
Configure ServerOptions.SSLOptions for the inbound webhook — Meta requires it to be reachable over TLS. The top-level TLSOptions covers the outbound HTTPS calls to the Graph API separately.
Authoritative sources for the API this component implements.
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. | Open | |
| Demo Project — Demos\50.Other\05.WhatsApp Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |