WhatsApp has become the go-to messaging app for businesses worldwide. Whether it’s for customer support, order updates, or appointment reminders, many organizations rely on WhatsApp to communicate quickly and effectively.
But here’s the challenge: if your team uses Oracle APEX for day-to-day operations, constantly switching between APEX and WhatsApp Web isn’t efficient. Messages get lost, records aren’t updated, and there’s no single source of truth for communication.
The solution? Integrate WhatsApp directly into Oracle APEX.
By connecting Oracle APEX, n8n, and WAAPI, you can send and receive WhatsApp messages right inside APEX, fully tracked and linked to your customers, leads, and conversations.
What You’ll Need Before Starting
- Oracle APEX (any version from 20.1+ will work, but 23.x or higher is recommended)
- Oracle Database 19c or above
- n8n (self-hosted or cloud version) – an automation platform to handle incoming messages and workflows
- WAAPI account – for sending and receiving WhatsApp messages programmatically
- Oracle Wallet set up for HTTPS calls
- Basic knowledge of PL/SQL, APEX page design, and REST APIs
Why Integrate WhatsApp Into Oracle APEX?
There are several strong reasons to build this integration:
- Single interface for your team – No switching between apps, WhatsApp chats appear in APEX.
- Full history tracking – Every sent and received message is stored in Oracle Database.
- Automation potential – Use n8n to trigger workflows like appointment reminders, lead follow-ups, or notifications.
- Compliance and auditing – Every message is linked to a conversation, lead, or customer record.
Step 1: Prepare Your Oracle APEX Environment
Our first step is to create the data structure and API layer inside Oracle so APEX knows how to handle WhatsApp conversations.
1. Create the Core Tables
We start with two main tables:
WA_CONVERSATION
— stores each chat session, one row per phone number/customerWA_MESSAGE
— stores every individual message in a conversation
CREATE TABLE WA_CONVERSATION (
WACO_ID NUMBER GENERATED BY DEFAULT AS IDENTITY,
WACO_TEL VARCHAR2(1000) NOT NULL,
WACO_NAME VARCHAR2(1000),
WACO_COMP_FK NUMBER,
WACO_CREATED TIMESTAMP DEFAULT SYSDATE,
WACO_UPDATED TIMESTAMP DEFAULT SYSDATE,
WACO_DELETED_YN VARCHAR2(4) DEFAULT 'NO',
CONSTRAINT WA_CONVERSATION_PK PRIMARY KEY (WACO_ID)
);
CREATE TABLE WA_MESSAGE (
WAME_ID NUMBER GENERATED BY DEFAULT AS IDENTITY,
WAME_WACO_FK NUMBER NOT NULL,
WAME_DIRECTION VARCHAR2(1), -- 'S' for sent, 'R' for received
WAME_TYPE VARCHAR2(50) DEFAULT 'text',
WAME_MSG CLOB,
WAME_SEND_SUCCESS_YN VARCHAR2(4) DEFAULT 'NO',
WAME_IS_READ_YN VARCHAR2(4) DEFAULT 'NO',
WAME_CREATED TIMESTAMP DEFAULT SYSDATE,
WAME_UPDATED TIMESTAMP DEFAULT SYSDATE,
CONSTRAINT WA_MESSAGE_PK PRIMARY KEY (WAME_ID)
);
These tables ensure every chat and every message is logged in Oracle.
2. Build PL/SQL API Packages
Manually writing INSERT
and UPDATE
statements every time we send or receive a message would be messy.
Instead, we generated API packages using OraMUC Table API Generator:
API_WA_CONVERSATION_PKG
– Functions to create, update, or retrieve conversations.API_WA_MESSAGE_PKG
– Functions to create, update, or mark messages as sent/read.
This approach provides clean, reusable PL/SQL procedures like:
API_WA_MESSAGE_PKG.create_row (
p_wame_waco_fk => 101,
p_wame_direction => 'S',
p_wame_msg => 'Hello! Your appointment is confirmed for 3 PM.'
);
By doing this, all APEX processes (and n8n automations) can call the same APIs — ensuring consistency.
3. Build the WhatsApp Inbox in APEX
Next, create a page in APEX that acts like your WhatsApp interface:
- Chat List – shows all numbers and names from
WA_CONVERSATION
. - Message Window – shows messages from
WA_MESSAGE
for the selected chat. - Send Box – a text field and “Send” button that triggers the PL/SQL API call.
Enhance the interface with:
- Icons to show read/unread messages.
- Links to jump to related customer or lead records.
- Interactive grid or cards for a real WhatsApp look.
Step 2: Connect to WAAPI for Messaging
APEX now has the interface and database structure. The next step is to send and receive real WhatsApp messages.
1. Create a WAAPI Account
- Sign up at WAAPI and get your API key.
- Test WAAPI endpoints using Postman to verify your account.
2. Secure the Connection with Oracle Wallet
Oracle won’t allow HTTPS requests unless you set up a wallet:
- Add WAAPI’s root certificate to Oracle Wallet.
- Add the WAAPI endpoint as a trusted target.
3. Write a PL/SQL Function to Send Messages
Using UTL_HTTP
, we send a JSON payload to WAAPI:
DECLARE
l_req UTL_HTTP.req;
l_resp UTL_HTTP.resp;
BEGIN
l_req := UTL_HTTP.begin_request('https://waapi.app/api/sendMessage', 'POST', 'HTTP/1.1');
UTL_HTTP.set_header(l_req, 'Content-Type', 'application/json');
UTL_HTTP.set_header(l_req, 'Authorization', 'Bearer YOUR_TOKEN_HERE');
UTL_HTTP.write_text(l_req, '{"phone": "+49123456789", "message": "Hello from Oracle APEX!"}');
l_resp := UTL_HTTP.get_response(l_req);
UTL_HTTP.end_response(l_resp);
END;
Now, any APEX “Send” button can trigger this procedure — and your message goes straight to WhatsApp.
Step 3: Automate Incoming Messages with n8n
Sending messages is half the job. We also need to catch incoming messages.
1. Set Up a Webhook in n8n
- Create a Webhook node in n8n.
- WAAPI will call this URL whenever a WhatsApp user replies.
2. Process and Save Incoming Messages
Your n8n workflow will:
- Read the sender’s number and message text.
- Check if there’s an existing conversation in Oracle (via REST API or direct DB call).
- Create a new
WA_MESSAGE
row usingAPI_WA_MESSAGE_PKG.create_row
.
3. Optional Automations
- Send an auto-reply (“Thanks for your message — we’ll get back to you soon!”).
- Trigger alerts in APEX (e.g., notify a sales rep).
- Start more complex workflows (e.g., create a lead from an unknown number).
Step 4: End-to-End Testing
Before going live, test the entire loop:
- Send a message from APEX.
- Confirm it arrives on the user’s WhatsApp.
- Reply from WhatsApp.
- Check if n8n catches the message and inserts it into Oracle.
- Refresh APEX — the reply should appear instantly.
This proves you have full two-way communication working.
Step 5: Extra Features to Consider
Once the basics work, here’s how you can level up:
- Media Support: Add WAAPI calls for images, PDFs, or voice notes.
- Read Receipts: Update
WAME_IS_READ_YN
when messages are read. - Bulk Messaging Campaigns: Send one message to hundreds of customers from Oracle.
- Alerts and Reminders: Use PL/SQL jobs to send WhatsApp reminders automatically.
- Lead Qualification: Auto-create leads when new numbers start chatting.
Final Thoughts
By combining Oracle APEX for the interface, WAAPI for the actual WhatsApp delivery, and n8n for automation, you’ve built a complete, modern communication hub.
No switching between apps. No lost messages. Every chat is logged, linked, and available for your team inside APEX.
This integration isn’t just a technical exercise — it’s a step toward centralizing your entire customer communication in one place.