eSeGeCe
software
The sgcWebSockets WhatsApp component empowers Delphi teams to deliver instant, personalized conversations at scale. Whether you build CRM integrations, help-desk portals or transactional notification services, the component provides a secure, resilient and fully supported bridge to WhatsApp Business messaging. This article combines the commercial value with the technical detail you need to deliver production-ready chat flows quickly.
Business Impact at a Glance
The component encapsulates the WhatsApp Business API REST endpoints and WebSocket callbacks into a Delphi-friendly interface. It manages token refreshes, message formatting (text, templates, media) and asynchronous delivery reports. Internally it relies on sgcWebSockets core transports, so you benefit from the same TLS, reconnection and threading model used throughout the framework.
Drop the TsgcWhatsAppClient component onto your data module or service form. Configure the essential properties inside the Object Inspector or in code during initialization.
Design-Time Settings
procedure TdmMessaging.DataModuleCreate(Sender: TObject);
begin
sgcWhatsAppClient.BaseURL := 'https://graph.facebook.com/v18.0/';
sgcWhatsAppClient.PhoneNumberID := '123456789012345';
sgcWhatsAppClient.AccessToken := TSecretStore.FetchToken('WA_ACCESS');
sgcWhatsAppClient.WebhookVerifyToken := 'MyDelphiWebhook';
sgcWhatsAppClient.AutoReconnect := True;
sgcWhatsAppClient.Connect;
end;
Use the SendText and SendTemplate helper methods for high-level scenarios, or access the Messages collection for advanced payloads.
procedure TdmMessaging.SendWelcomeMessage(const ADestination: string); var LMessage: TsgcWAOutboundMessage; begin LMessage := sgcWhatsAppClient.Messages.Add; LMessage.ToPhone := ADestination; LMessage.TypeMessage := watText; LMessage.Text.Body := 'Welcome to our premium support channel!'; sgcWhatsAppClient.SendMessage(LMessage); end;
The component includes a built-in webhook listener leveraging sgcWebSockets HTTP server features. Map the webhook path to your published endpoint and process replies inside event handlers.
procedure TdmMessaging.sgcWhatsAppClientIncomingMessage(Sender: TObject;
const AMessage: TsgcWAInboundMessage);
begin
if AMessage.Text.Body.ToLower.Contains('pricing') then
sgcWhatsAppClient.SendText(AMessage.FromPhone,
'Ask about our enterprise bundles for priority SLA and analytics dashboards.')
else
QueueForAgent(AMessage);
end;
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.