Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs: correct response shape (raw payload, not {success,data,meta} envelope), Node 22 LTS, neutral message types

rmyndharis737b83e08e57
diff --git a/.env.example b/.env.example
index fe258c1e7..289dc44a1 100644
--- a/.env.example
+++ b/.env.example
@@ -66,7 +66,8 @@ PUPPETEER_ARGS=--no-sandbox,--disable-setuid-sandbox,--disable-dev-shm-usage,--d
# WWEBJS_WEB_VERSION=2.3000.1023204257
# Baileys engine (used when ENGINE_TYPE=baileys). WebSocket client, no Chromium.
-# NOTE: the Baileys engine dependency is ESM-only; OpenWA therefore requires Node >= 20.19 (require-of-ESM support).
+# NOTE: the Baileys engine is loaded lazily (dynamic import, only when ENGINE_TYPE=baileys), so there is no
+# global Node.js version floor. Node.js 22 LTS is recommended for all deployments.
BAILEYS_AUTH_DIR=./data/baileys
# NOTE: proxy (PROXY_URL/PROXY_TYPE) is not yet supported by the baileys engine; it is ignored.
diff --git a/docs/01-project-overview.md b/docs/01-project-overview.md
index ad57820a1..3742eb212 100644
--- a/docs/01-project-overview.md
+++ b/docs/01-project-overview.md
@@ -220,7 +220,7 @@ quadrantChart
```mermaid
flowchart TB
subgraph Runtime["Runtime & Framework"]
- N[Node.js 20 LTS] --> |"TypeScript support, async/await"| NE[NestJS]
+ N[Node.js 22 LTS] --> |"TypeScript support, async/await"| NE[NestJS]
NE --> |"Modular, scalable, DI"| API[REST API]
end
@@ -247,7 +247,7 @@ flowchart TB
| Layer | Technology | Rationale |
|-------|------------|-----------|
-| Runtime | Node.js 20 LTS | Stable, long-term support |
+| Runtime | Node.js 22 LTS | Stable, long-term support |
| Language | TypeScript | Type safety, better developer experience |
| Framework | NestJS | Enterprise-grade, modular |
| WA Engine | whatsapp-web.js (default) or baileys | Pluggable via `ENGINE_TYPE` env var; wwebjs = Puppeteer/stealth, baileys = browser-free |
diff --git a/docs/02-requirements-specification.md b/docs/02-requirements-specification.md
index cb952d6fa..3620ba30f 100644
--- a/docs/02-requirements-specification.md
+++ b/docs/02-requirements-specification.md
@@ -365,7 +365,7 @@ flowchart TB
| ID | Requirement | Description | Priority |
|----|-------------|-------------|----------|
-| NFR-CP-001 | Node.js version | 18.x, 20.x LTS | High |
+| NFR-CP-001 | Node.js version | 22 LTS | High |
| NFR-CP-002 | Database support | SQLite, PostgreSQL | High |
| NFR-CP-003 | OS support | Linux, macOS, Windows | High |
| NFR-CP-004 | Docker support | Official image | High |
diff --git a/docs/03-system-architecture.md b/docs/03-system-architecture.md
index 5d4fa8e86..0bc233776 100644
--- a/docs/03-system-architecture.md
+++ b/docs/03-system-architecture.md
@@ -747,41 +747,29 @@ flowchart LR
### API Response Structure
+Responses are the **raw handler payload** — there is no `{success, data, meta}` envelope.
+A controller that returns an object sends exactly that object; a list endpoint returns a bare array.
+Errors use the NestJS default shape.
+
```typescript
-// Success Response
+// Success Response — the resource itself
{
- "success": true,
- "data": { ... },
- "meta": {
- "timestamp": "2025-02-02T10:00:00Z",
- "requestId": "uuid"
- }
+ "id": "abc",
+ "name": "my-session",
+ "status": "READY"
}
-// Error Response
-{
- "success": false,
- "error": {
- "code": "SESSION_NOT_FOUND",
- "message": "Session with id 'xxx' not found",
- "details": { ... }
- },
- "meta": {
- "timestamp": "2025-02-02T10:00:00Z",
- "requestId": "uuid"
- }
-}
+// List Response — a bare array
+[
+ { "id": "abc", "name": "my-session", "status": "READY" },
+ { "id": "def", "name": "other-session", "status": "DISCONNECTED" }
+]
-// Paginated Response
+// Error Response — NestJS default shape
{
- "success": true,
- "data": [ ... ],
- "pagination": {
- "page": 1,
- "limit": 20,
- "total": 100,
- "totalPages": 5
- }
+ "statusCode": 404,
+ "message": "Session with id 'xxx' not found",
+ "error": "Not Found"
}
```
diff --git a/docs/04-security-design.md b/docs/04-security-design.md
index ff3c24697..a581fa9d3 100644
--- a/docs/04-security-design.md
+++ b/docs/04-security-design.md
@@ -728,7 +728,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
- node-version: '20'
+ node-version: '22'
- name: Install dependencies
run: npm ci
diff --git a/docs/06-api-specification.md b/docs/06-api-specification.md
index 835411094..4a29f3432 100644
--- a/docs/06-api-specification.md
+++ b/docs/06-api-specification.md
@@ -1843,7 +1843,7 @@ async function sendMessage(sessionId, chatId, text) {
// Usage
sendMessage('sess_abc123', '[email protected]', 'Hello!')
- .then(result => console.log('Sent:', result.data.messageId))
+ .then(result => console.log('Sent:', result.messageId))
.catch(err => console.error('Error:', err.response?.data));
```
@@ -1885,7 +1885,7 @@ class OpenWA:
# Usage
client = OpenWA('http://localhost:2785/api', 'your-api-key')
result = client.send_text('sess_abc123', '[email protected]', 'Hello from Python!')
-print(f"Message ID: {result['data']['messageId']}")
+print(f"Message ID: {result['messageId']}")
```
### WebSocket Client Example (JavaScript)
diff --git a/docs/07-api-collection.md b/docs/07-api-collection.md
index 3d54bef85..82d43e18a 100644
--- a/docs/07-api-collection.md
+++ b/docs/07-api-collection.md
@@ -21,34 +21,22 @@ X-API-Key: your-api-key-here
### Response Format
+Responses are the **raw handler payload** — there is no `{success, data, meta}` envelope.
+A successful response is the resource itself (object) or a bare array for lists.
+
```json
-{
- "success": true,
- "data": { ... },
- "meta": {
- "timestamp": "2026-02-02T10:30:00Z",
- "requestId": "req_abc123"
- }
-}
+{ "id": "abc", "status": "READY" }
```
### Error Format
+Errors use the NestJS default shape:
+
```json
{
- "success": false,
- "error": {
- "code": "VALIDATION_ERROR",
- "message": "Invalid phone number format",
- "details": {
- "field": "phone",
- "expected": "format: [email protected]"
- }
- },
- "meta": {
- "timestamp": "2026-02-02T10:30:00Z",
- "requestId": "req_abc123"
- }
+ "statusCode": 400,
+ "message": "Invalid phone number format",
+ "error": "Bad Request"
}
```
@@ -83,7 +71,7 @@ curl -H "X-API-Key: $API_KEY" \
```json
{
"status": "ok",
- "version": "0.1.0",
+ "version": "0.4.0",
"uptime": 86400,
"timestamp": "2026-02-02T10:30:00Z",
"checks": {
@@ -145,26 +133,18 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
-{
- "success": true,
- "data": [
- {
- "id": "default",
- "name": "Default Session",
- "status": "CONNECTED",
- "phoneNumber": "628123456789",
- "profileName": "John Doe",
- "profilePicture": "https://...",
- "createdAt": "2026-02-01T00:00:00Z",
- "lastSeen": "2026-02-02T10:30:00Z"
- }
- ],
- "meta": {
- "total": 1,
- "limit": 20,
- "offset": 0
+[
+ {
+ "id": "default",
+ "name": "Default Session",
+ "status": "CONNECTED",
+ "phoneNumber": "628123456789",
+ "profileName": "John Doe",
+ "profilePicture": "https://...",
+ "createdAt": "2026-02-01T00:00:00Z",
+ "lastSeen": "2026-02-02T10:30:00Z"
}
-}
+]
```
### POST /api/sessions
@@ -197,14 +177,11 @@ curl -X POST http://localhost:2785/api/sessions \
**Response:**
```json
{
- "success": true,
- "data": {
- "id": "session-1",
- "name": "Customer Support",
- "status": "INITIALIZING",
- "qr": null,
- "createdAt": "2026-02-02T10:30:00Z"
- }
+ "id": "session-1",
+ "name": "Customer Support",
+ "status": "INITIALIZING",
+ "qr": null,
+ "createdAt": "2026-02-02T10:30:00Z"
}
```
@@ -220,28 +197,25 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
{
- "success": true,
- "data": {
- "id": "session-1",
- "name": "Customer Support",
- "status": "CONNECTED",
- "phoneNumber": "628123456789",
- "profileName": "John Doe",
- "profilePicture": "https://...",
- "pushName": "John",
- "platform": "android",
- "config": {
- "autoReconnect": true,
- "webhookUrl": "https://your-server.com/webhook"
- },
- "stats": {
- "messagesReceived": 1234,
- "messagesSent": 567,
- "lastMessageAt": "2026-02-02T10:25:00Z"
- },
- "createdAt": "2026-02-01T00:00:00Z",
- "lastSeen": "2026-02-02T10:30:00Z"
- }
+ "id": "session-1",
+ "name": "Customer Support",
+ "status": "CONNECTED",
+ "phoneNumber": "628123456789",
+ "profileName": "John Doe",
+ "profilePicture": "https://...",
+ "pushName": "John",
+ "platform": "android",
+ "config": {
+ "autoReconnect": true,
+ "webhookUrl": "https://your-server.com/webhook"
+ },
+ "stats": {
+ "messagesReceived": 1234,
+ "messagesSent": 567,
+ "lastMessageAt": "2026-02-02T10:25:00Z"
+ },
+ "createdAt": "2026-02-01T00:00:00Z",
+ "lastSeen": "2026-02-02T10:30:00Z"
}
```
@@ -263,10 +237,7 @@ curl -X DELETE \
**Response:**
```json
{
- "success": true,
- "data": {
- "message": "Session deleted successfully"
- }
+ "message": "Session deleted successfully"
}
```
@@ -287,11 +258,8 @@ curl -H "X-API-Key: $API_KEY" \
**Response (format=base64):**
```json
{
- "success": true,
- "data": {
- "qr": "data:image/png;base64,iVBORw0KGgo...",
- "expiresAt": "2026-02-02T10:31:00Z"
- }
+ "qr": "data:image/png;base64,iVBORw0KGgo...",
+ "expiresAt": "2026-02-02T10:31:00Z"
}
```
@@ -311,11 +279,8 @@ curl -X POST \
**Response:**
```json
{
- "success": true,
- "data": {
- "message": "Session restarting",
- "status": "INITIALIZING"
- }
+ "message": "Session restarting",
+ "status": "INITIALIZING"
}
```
@@ -332,10 +297,7 @@ curl -X POST \
**Response:**
```json
{
- "success": true,
- "data": {
- "message": "Session logged out successfully"
- }
+ "message": "Session logged out successfully"
}
```
@@ -448,15 +410,12 @@ curl -X POST http://localhost:2785/api/sessions/default/messages \
**Response:**
```json
{
- "success": true,
- "data": {
- "id": "MSG_ABC123DEF456",
- "phone": "[email protected]",
- "type": "text",
- "body": "Hello, World!",
- "status": "PENDING",
- "timestamp": "2026-02-02T10:30:00Z"
- }
+ "id": "MSG_ABC123DEF456",
+ "phone": "[email protected]",
+ "type": "text",
+ "body": "Hello, World!",
+ "status": "PENDING",
+ "timestamp": "2026-02-02T10:30:00Z"
}
```
@@ -489,29 +448,22 @@ curl -H "X-API-Key: $API_KEY" \
| limit | number | Max results (default: 50, max: 200) |
| before | string | Messages before this ID |
| after | string | Messages after this ID |
-| type | string | Filter by type: `chat`, `image`, `video`, etc. |
+| type | string | Filter by type: `text`, `image`, `video`, etc. |
**Response:**
```json
-{
- "success": true,
- "data": [
- {
- "id": "MSG_ABC123",
- "from": "[email protected]",
- "body": "Hello!",
- "type": "chat",
- "timestamp": "2026-02-02T10:25:00Z",
- "status": "READ",
- "isFromMe": false
- }
- ],
- "meta": {
- "hasMore": true,
- "nextCursor": "MSG_DEF456"
+[
+ {
+ "id": "MSG_ABC123",
+ "from": "[email protected]",
+ "body": "Hello!",
+ "type": "text",
+ "timestamp": "2026-02-02T10:25:00Z",
+ "status": "READ",
+ "isFromMe": false
}
-}
+]
```
### GET /api/sessions/:id/messages/:messageId
@@ -562,20 +514,17 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
-{
- "success": true,
- "data": [
- {
- "name": "John Doe",
- "pushName": "John",
- "shortName": "John",
- "isMyContact": true,
- "isBlocked": false,
- "profilePicture": "https://..."
- }
- ]
-}
+[
+ {
+ "name": "John Doe",
+ "pushName": "John",
+ "shortName": "John",
+ "isMyContact": true,
+ "isBlocked": false,
+ "profilePicture": "https://..."
+ }
+]
```
### GET /api/sessions/:id/contacts/:phone
@@ -641,20 +590,17 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
-{
- "success": true,
- "data": [
- {
- "name": "Family Group",
- "description": "Family chat",
- "participantsCount": 15,
- "isAdmin": true,
- "profilePicture": "https://...",
- "createdAt": "2025-01-15T00:00:00Z"
- }
- ]
-}
+[
+ {
+ "name": "Family Group",
+ "description": "Family chat",
+ "participantsCount": 15,
+ "isAdmin": true,
+ "profilePicture": "https://...",
+ "createdAt": "2025-01-15T00:00:00Z"
+ }
+]
```
### POST /api/sessions/:id/groups
@@ -677,12 +623,9 @@ curl -X POST http://localhost:2785/api/sessions/default/groups \
**Response:**
```json
{
- "success": true,
- "data": {
- "name": "New Group",
- "inviteCode": "ABC123XYZ"
- }
+ "name": "New Group",
+ "inviteCode": "ABC123XYZ"
}
```
@@ -698,31 +641,28 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
{
- "success": true,
- "data": {
- "name": "Family Group",
- "description": "Family chat",
- "owner": "[email protected]",
- "participants": [
- {
- "isAdmin": true,
- "isSuperAdmin": false
- },
- {
- "isAdmin": false,
- "isSuperAdmin": false
- }
- ],
- "settings": {
- "announce": false,
- "restrict": false
+ "name": "Family Group",
+ "description": "Family chat",
+ "owner": "[email protected]",
+ "participants": [
+ {
+ "isAdmin": true,
+ "isSuperAdmin": false
},
- "inviteCode": "ABC123XYZ",
- "createdAt": "2025-01-15T00:00:00Z"
- }
+ {
+ "isAdmin": false,
+ "isSuperAdmin": false
+ }
+ ],
+ "settings": {
+ "announce": false,
+ "restrict": false
+ },
+ "inviteCode": "ABC123XYZ",
+ "createdAt": "2025-01-15T00:00:00Z"
}
```
@@ -814,11 +754,8 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
{
- "success": true,
- "data": {
- "inviteCode": "ABC123XYZ",
- "inviteUrl": "https://chat.whatsapp.com/ABC123XYZ"
- }
+ "inviteCode": "ABC123XYZ",
+ "inviteUrl": "https://chat.whatsapp.com/ABC123XYZ"
}
```
@@ -845,20 +782,17 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
-{
- "success": true,
- "data": [
- {
- "id": "wh_123",
- "url": "https://your-server.com/webhook",
- "events": ["message.received", "message.ack"],
- "sessionId": "sess_abc123",
- "enabled": true,
- "secret": "whsec_***",
- "createdAt": "2026-02-01T00:00:00Z"
- }
- ]
-}
+[
+ {
+ "id": "wh_123",
+ "url": "https://your-server.com/webhook",
+ "events": ["message.received", "message.ack"],
+ "sessionId": "sess_abc123",
+ "enabled": true,
+ "secret": "whsec_***",
+ "createdAt": "2026-02-01T00:00:00Z"
+ }
+]
```
### POST /api/sessions/:sessionId/webhooks
@@ -904,16 +838,13 @@ group.update - Group settings changed
**Response:**
```json
{
- "success": true,
- "data": {
- "id": "wh_456",
- "url": "https://your-server.com/webhook",
- "events": ["message.received", "message.ack", "session.status"],
- "sessionId": "sess_abc123",
- "enabled": true,
- "secret": "whsec_abc123xyz",
- "createdAt": "2026-02-02T10:30:00Z"
- }
+ "id": "wh_456",
+ "url": "https://your-server.com/webhook",
+ "events": ["message.received", "message.ack", "session.status"],
+ "sessionId": "sess_abc123",
+ "enabled": true,
+ "secret": "whsec_abc123xyz",
+ "createdAt": "2026-02-02T10:30:00Z"
}
```
@@ -961,23 +892,20 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
-{
- "success": true,
- "data": [
- {
- "id": "log_789",
- "webhookId": "wh_456",
- "event": "message.received",
- "status": "success",
- "statusCode": 200,
- "duration": 150,
- "attempt": 1,
- "payload": { ... },
- "response": { ... },
- "createdAt": "2026-02-02T10:30:00Z"
- }
- ]
-}
+[
+ {
+ "id": "log_789",
+ "webhookId": "wh_456",
+ "event": "message.received",
+ "status": "success",
+ "statusCode": 200,
+ "duration": 150,
+ "attempt": 1,
+ "payload": { },
+ "response": { },
+ "createdAt": "2026-02-02T10:30:00Z"
+ }
+]
```
### POST /api/sessions/:sessionId/webhooks/:id/test
@@ -993,14 +921,11 @@ curl -X POST \
**Response:**
```json
{
- "success": true,
- "data": {
- "status": "success",
- "statusCode": 200,
- "duration": 125,
- "response": {
- "received": true
- }
+ "status": "success",
+ "statusCode": 200,
+ "duration": 125,
+ "response": {
+ "received": true
}
}
```
@@ -1025,24 +950,21 @@ curl -H "X-API-Key: $API_KEY" \
**Response:**
```json
-{
- "success": true,
- "data": [
- {
- "id": "2a8f41e3-3b9a-4a1d-b6d0-b9910df8f0be",
- "name": "Production Key",
- "keyPrefix": "owa_k1_abcd",
- "role": "operator",
- "allowedIps": ["192.168.1.10"],
- "allowedSessions": ["session-uuid-1"],
- "isActive": true,
- "lastUsedAt": "2026-02-02T10:30:00Z",
- "usageCount": 12,
- "expiresAt": null,
- "createdAt": "2026-01-01T00:00:00Z"
- }
- ]
-}
+[
+ {
+ "id": "2a8f41e3-3b9a-4a1d-b6d0-b9910df8f0be",
+ "name": "Production Key",
+ "keyPrefix": "owa_k1_abcd",
+ "role": "operator",
+ "allowedIps": ["192.168.1.10"],
+ "allowedSessions": ["session-uuid-1"],
+ "isActive": true,
+ "lastUsedAt": "2026-02-02T10:30:00Z",
+ "usageCount": 12,
+ "expiresAt": null,
+ "createdAt": "2026-01-01T00:00:00Z"
+ }
+]
```
### POST /api/auth/api-keys
@@ -1072,20 +994,17 @@ viewer - Read-only API access where supported
**Response:**
```json
{
- "success": true,
- "data": {
- "id": "4d0564f1-5fb7-4e4a-baae-4cb0d154e861",
- "name": "Integration Key",
- "keyPrefix": "owa_k1_efgh",
- "role": "operator",
- "allowedIps": ["192.168.1.10"],
- "allowedSessions": ["default"],
- "isActive": true,
- "usageCount": 0,
- "expiresAt": "2027-01-01T00:00:00Z",
- "createdAt": "2026-02-02T10:30:00Z",
- "apiKey": "owa_k1_efgh5678..."
- }
+ "id": "4d0564f1-5fb7-4e4a-baae-4cb0d154e861",
+ "name": "Integration Key",
+ "keyPrefix": "owa_k1_efgh",
+ "role": "operator",
+ "allowedIps": ["192.168.1.10"],
+ "allowedSessions": ["default"],
+ "isActive": true,
+ "usageCount": 0,
+ "expiresAt": "2027-01-01T00:00:00Z",
+ "createdAt": "2026-02-02T10:30:00Z",
+ "apiKey": "owa_k1_efgh5678..."
}
```
@@ -1332,7 +1251,7 @@ curl -s -X POST "$BASE_URL/api/sessions" \
# Get QR Code
echo "=== Get QR Code ==="
curl -s "$BASE_URL/api/sessions/$SESSION_ID/qr" \
- -H "X-API-Key: $API_KEY" | jq -r '.data.qr'
+ -H "X-API-Key: $API_KEY" | jq -r '.qr'
# Send Text Message
echo "=== Send Text Message ==="
diff --git a/docs/08-development-guidelines.md b/docs/08-development-guidelines.md
index 7b6bbd781..e8c60d3f1 100644
--- a/docs/08-development-guidelines.md
+++ b/docs/08-development-guidelines.md
@@ -552,9 +552,8 @@ describe('Session (e2e)', () => {
.send({ name: 'e2e-test-session' })
.expect(201)
.expect((res) => {
- expect(res.body.success).toBe(true);
- expect(res.body.data.name).toBe('e2e-test-session');
- expect(res.body.data.status).toBe('created');
+ expect(res.body.name).toBe('e2e-test-session');
+ expect(res.body.status).toBe('created');
});
});
@@ -687,18 +686,14 @@ export class AllExceptionsFilter implements ExceptionFilter {
}
private formatError(exception: unknown, request: Request) {
+ const status = exception instanceof HttpException
+ ? exception.getStatus()
+ : HttpStatus.INTERNAL_SERVER_ERROR;
+ // Return NestJS default error shape: { statusCode, message, error }
return {
- success: false,
- error: {
- code: this.getErrorCode(exception),
- message: this.getErrorMessage(exception),
- details: this.getErrorDetails(exception),
- },
- meta: {
- timestamp: new Date().toISOString(),
- requestId: request.headers['x-request-id'],
- path: request.url,
- },
+ statusCode: status,
+ message: this.getErrorMessage(exception),
+ error: this.getErrorCode(exception),
};
}
}
@@ -712,7 +707,7 @@ export class AllExceptionsFilter implements ExceptionFilter {
```bash
# Required
-- Node.js 20 LTS
+- Node.js 22 LTS
- npm 10+
- Docker & Docker Compose
- Git
diff --git a/docs/09-testing-strategy.md b/docs/09-testing-strategy.md
index fe47b526a..f2a69d4e2 100644
--- a/docs/09-testing-strategy.md
+++ b/docs/09-testing-strategy.md
@@ -240,9 +240,8 @@ describe('Session Integration', () => {
.send({ name: 'integration-test' })
.expect(201);
- expect(response.body.success).toBe(true);
- expect(response.body.data.status).toBe('SCAN_QR');
- expect(response.body.data.qr).toBeDefined();
+ expect(response.body.status).toBe('SCAN_QR');
+ expect(response.body.qr).toBeDefined();
});
it('should reject duplicate session name', async () => {
@@ -260,7 +259,8 @@ describe('Session Integration', () => {
.send({ name: 'duplicate-test' })
.expect(409);
- expect(response.body.error.code).toBe('SESSION_ALREADY_EXISTS');
+ expect(response.body.statusCode).toBe(409);
+ expect(response.body.message).toMatch(/SESSION_ALREADY_EXISTS/i);
});
});
@@ -357,22 +357,22 @@ describe('Session E2E', () => {
});
expect(response.status).toBe(201);
- expect(response.data.data.status).toBe('SCAN_QR');
- sessionId = response.data.data.id;
+ expect(response.data.status).toBe('SCAN_QR');
+ sessionId = response.data.id;
});
it('Step 2: Get QR code', async () => {
const response = await api.get(`/sessions/${sessionId}/qr`);
expect(response.status).toBe(200);
- expect(response.data.data.image).toMatch(/^data:image\/png;base64,/);
+ expect(response.data.image).toMatch(/^data:image\/png;base64,/);
});
it('Step 3: Check session status', async () => {
const response = await api.get(`/sessions/${sessionId}`);
expect(response.status).toBe(200);
- expect(response.data.data.id).toBe(sessionId);
+ expect(response.data.id).toBe(sessionId);
});
it('Step 4: Delete session', async () => {
@@ -437,8 +437,8 @@ export default function () {
sleep(1);
// Test: Send message (if session exists)
- if (sessionsRes.json().data?.length > 0) {
- const sessionId = sessionsRes.json().data[0].id;
+ if (sessionsRes.json()?.length > 0) {
+ const sessionId = sessionsRes.json()[0].id;
const msgRes = http.post(
`${BASE_URL}/sessions/${sessionId}/messages/send-text`,
JSON.stringify({
@@ -520,7 +520,8 @@ describe('Security Tests', () => {
.get('/api/sessions')
.expect(401);
- expect(response.body.error.code).toBe('UNAUTHORIZED');
+ expect(response.body.statusCode).toBe(401);
+ expect(response.body.message).toBeDefined();
});
it('should reject invalid API key', async () => {
@@ -529,7 +530,8 @@ describe('Security Tests', () => {
.set('X-API-Key', 'invalid-key')
.expect(401);
- expect(response.body.error.code).toBe('UNAUTHORIZED');
+ expect(response.body.statusCode).toBe(401);
+ expect(response.body.message).toBeDefined();
});
});
@@ -541,7 +543,8 @@ describe('Security Tests', () => {
.send({ name: "'; DROP TABLE sessions; --" })
.expect(400);
- expect(response.body.error.code).toBe('VALIDATION_ERROR');
+ expect(response.body.statusCode).toBe(400);
+ expect(response.body.message).toBeDefined();
});
it('should reject XSS in webhook URL', async () => {
@@ -554,7 +557,8 @@ describe('Security Tests', () => {
})
.expect(400);
- expect(response.body.error.code).toBe('WEBHOOK_URL_INVALID');
+ expect(response.body.statusCode).toBe(400);
+ expect(response.body.message).toBeDefined();
});
});
@@ -599,7 +603,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version: '20'
+ node-version: '22'
cache: 'npm'
- run: npm ci
@@ -630,7 +634,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version: '20'
+ node-version: '22'
- run: npm ci
- run: npm run test:integration
@@ -645,7 +649,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
- node-version: '20'
+ node-version: '22'
- run: npm ci
- run: npm run build
diff --git a/docs/10-devops-infrastructure.md b/docs/10-devops-infrastructure.md
index 751cb74e4..53a8d3bce 100644
--- a/docs/10-devops-infrastructure.md
+++ b/docs/10-devops-infrastructure.md
@@ -41,7 +41,7 @@ flowchart TB
# Dockerfile (multi-stage build)
# Build stage
-FROM node:20-slim AS build
+FROM node:22-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
@@ -49,7 +49,7 @@ COPY . .
RUN npm run build
# Runtime stage
-FROM node:20-slim
+FROM node:22-slim
# Install Chrome dependencies
RUN apt-get update && apt-get install -y \
@@ -246,7 +246,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
- node-version: '20'
+ node-version: '22'
cache: 'npm'
- name: Install dependencies
diff --git a/docs/15-project-roadmap.md b/docs/15-project-roadmap.md
index 206957c9e..081bf7e89 100644
--- a/docs/15-project-roadmap.md
+++ b/docs/15-project-roadmap.md
@@ -87,7 +87,7 @@ Each phase includes a 2–3 week buffer for:
| Requirement | Details |
| ------------------ | --------------------------------------------------------- |
| **Development** | 1-2 full-time developers (or equivalent part-time) |
-| **Environment** | Node.js 20 LTS, Docker, Git |
+| **Environment** | Node.js 22 LTS, Docker, Git |
| **Testing** | WhatsApp test accounts (2-3 numbers) |
| **Infrastructure** | VPS for staging (2GB RAM minimum) |
| **Accounts** | GitHub organization, npm registry access, Docker Hub/GHCR |
diff --git a/docs/18-sdk-design.md b/docs/18-sdk-design.md
index df12af769..4fb62297b 100644
--- a/docs/18-sdk-design.md
+++ b/docs/18-sdk-design.md
@@ -648,12 +648,12 @@ class OpenWA:
if not response.ok:
raise OpenWAError(
- message=data.get("error", {}).get("message", "Unknown error"),
- code=data.get("error", {}).get("code", "UNKNOWN"),
+ message=data.get("message", "Unknown error"),
+ code=str(response.status),
status=response.status
)
- return data.get("data", data)
+ return data
async def health(self) -> Dict[str, Any]:
return await self._request("GET", "/health")
@@ -932,22 +932,14 @@ class Client
$response = $this->http->request($method, $path, $options);
$data = json_decode($response->getBody()->getContents(), true);
- if (!isset($data['success']) || !$data['success']) {
- throw new OpenWAException(
- $data['error']['message'] ?? 'Unknown error',
- $data['error']['code'] ?? 'UNKNOWN',
- $response->getStatusCode()
- );
- }
-
- return $data['data'] ?? [];
+ return $data ?? [];
} catch (\GuzzleHttp\Exception\RequestException $e) {
$response = $e->getResponse();
- $data = json_decode($response->getBody()->getContents(), true);
+ $data = $response ? json_decode($response->getBody()->getContents(), true) : null;
throw new OpenWAException(
- $data['error']['message'] ?? $e->getMessage(),
- $data['error']['code'] ?? 'REQUEST_ERROR',
+ $data['message'] ?? $e->getMessage(),
+ 'HTTP_ERROR',
$response ? $response->getStatusCode() : 0
);
}
@@ -1314,7 +1306,7 @@ export class OpenWA implements INodeType {
}
}
- returnData.push({ json: response.data });
+ returnData.push({ json: response });
}
return [returnData];
@@ -1403,7 +1395,7 @@ export class OpenWATrigger implements INodeType {
json: true,
});
- return response.data.some((w: any) => w.url === webhookUrl);
+ return response.some((w: any) => w.url === webhookUrl);
},
async create(this: IHookFunctions): Promise<boolean> {
@@ -1439,7 +1431,7 @@ export class OpenWATrigger implements INodeType {
json: true,
});
- const webhook = response.data.find((w: any) => w.url === webhookUrl);
+ const webhook = response.find((w: any) => w.url === webhookUrl);
if (webhook) {
await this.helpers.request({
method: 'DELETE',
diff --git a/docs/19-plugin-architecture.md b/docs/19-plugin-architecture.md
index 25a72726d..e4d40efc6 100644
--- a/docs/19-plugin-architecture.md
+++ b/docs/19-plugin-architecture.md
@@ -117,7 +117,7 @@ plugins/
"types": "dist/index.d.ts",
"openwa": {
- "minVersion": "0.2.0",
+ "minVersion": "0.3.0",
"maxVersion": "2.0.0"
},
diff --git a/docs/21-glossary.md b/docs/21-glossary.md
index f7c117c20..d0f1f2992 100644
--- a/docs/21-glossary.md
+++ b/docs/21-glossary.md
@@ -140,7 +140,7 @@ Ability to run multiple WhatsApp sessions within a single OpenWA instance.
Node.js framework for building server-side applications. The OpenWA backend is built with NestJS.
### Node.js
-JavaScript runtime used to run OpenWA. Supported version: Node.js 20 LTS.
+JavaScript runtime used to run OpenWA. Recommended version: Node.js 22 LTS.
## O
diff --git a/docs/README.md b/docs/README.md
index 38cd898d7..36956a7a6 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -225,6 +225,6 @@ MIT License.
**Start Reading: [01 - Project Overview](./01-project-overview.md)**
-_OpenWA Documentation · Last updated: 2026-02-05_
+_OpenWA Documentation · Last updated: 2026-06-18_
</div>