Example
WhatsApp Business trigger example
What you'll build
This integration reacts to WhatsApp Business Cloud webhook events. When a customer sends a WhatsApp message, the business:Listener receives the webhook and routes it to the onMessages handler in your business:WhatsAppService. The handler logs each inbound message or status update.
Architecture
Prerequisites
- A Meta app with the WhatsApp product added, and a webhook configured to point at your listener's public URL. See the Setup Guide.
Setting up the WhatsApp Business integration
New to WSO2 Integrator? Follow the Create a New Integration guide to set up your integration first, then return here to add the trigger.
Adding the WhatsApp Business trigger
Add a WhatsApp Business event integration and implement the listener and service as described in the WhatsApp Business event integration guide. WSO2 Integrator renders the listener and service on the design canvas, with all available handlers listed under Event Handlers.

Select business:WhatsAppService in the design canvas to open the Service Designer, which lists every pre-registered event handler bound to the whatsappListener.

Handling WhatsApp Business events
Select the onMessages row to open its flow canvas, then narrow the notification with an If step (notification is business:Messages) and add a Foreach step over the inbound messages or status updates to log each one:
remote function onMessages(business:MessagesNotification notification) returns error? {
if notification is business:Messages {
foreach business:InboundMessage message in notification.messages {
log:printInfo("Inbound WhatsApp message received", sender = message.'from, messageId = message.messageId);
}
} else {
foreach business:MessageStatusUpdate statusUpdate in notification.statuses {
log:printInfo("WhatsApp message status update", messageId = statusUpdate.messageId, status = statusUpdate.status);
}
}
}
Running the integration
Run the integration from WSO2 Integrator, then send a test message to your WhatsApp Business number. Meta delivers the webhook to your listener, which invokes onMessages and logs the inbound message. Verify the log entry in the WSO2 Integrator console output.
What's next
- Action Reference: send messages, templates, and manage media using the
Client. - Trigger Reference: full listener configuration and service callback reference.
- Setup Guide: create a Meta app and configure the webhook.