WhatsApp Image Storage & Print Order System

Backend API Dashboard - Version 2.0

Total Images

Loading...

Printed

Loading...

Pending

Loading...

Storage Used

Loading...

System Status

Database: Online
MQTT Broker: Connected
Storage Driver: local

MQTT Print Order Topics

Print orders are handled via MQTT event-driven architecture. Clients publish requests and subscribe to responses.

PUB {locationID}/print/request

Client publishes to request images for a phone number (e.g., konbini-01/print/request).

Message Schema
{
  "phone_number": "6591377827",
  "location_id": "konbini-01"
}
SUB {locationID}/print/images/urls

Client subscribes to receive image URLs from Flask (e.g., konbini-01/print/images/urls).

Response Schema
{
  "urls": ["http://server:5001/api/images/1/signed/download?token=...", ...],
  "image_ids": ["1", "2", "3"],
  "phone_number": "6591377827",
  "location_id": "konbini-01",
  "image_count": 3,
  "expires_at": "2025-01-15T12:05:00Z",
  "timestamp": "2025-01-15T12:00:00Z",
  "status": "success"  // or "no_images", "error"
}

Conditional fields: message (only for no_images/error status)

PUB {locationID}/print/complete

Client publishes after successfully printing images (e.g., konbini-01/print/complete).

Message Schema
{
  "image_ids": ["1", "2", "3"],
  "location_id": "konbini-01"
}

Image Endpoints

All image access goes through these API endpoints (storage-agnostic design)

GET /api/images/<id>/view

View original full-size image (inline display)

GET /api/images/<id>/thumbnail/view

View 300x300 thumbnail (inline display)

GET /api/images/<id>/signed/download?token=...&expires=...

Secure time-limited download with HMAC validation (MQTT print workflow)

Dashboard Endpoints

GET /stats
GET /mqtt-status
GET /health

WhatsApp Integration

POST /webhook/waha

Receives webhook events from WAHA. Automatically downloads images, generates thumbnails, and stores metadata.