feat(api): 🎉 Add business profile and catalog management
Some checks failed
CI / Lint (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Test (1.23) (push) Has been cancelled
CI / Test (1.22) (push) Has been cancelled

* Implement endpoints for managing business profiles:
  - Get business profile
  - Update business profile

* Add catalog management features:
  - List catalogs
  - List products in a catalog
  - Send catalog messages
  - Send single product messages
  - Send product list messages

* Introduce media upload functionality for sending media files.

* Add flow management capabilities:
  - Deprecate flows

* Update API documentation to reflect new endpoints and features.
This commit is contained in:
Hein
2026-02-04 11:17:40 +02:00
parent a7a5831911
commit ecd5525430
13 changed files with 906 additions and 84 deletions

View File

@@ -769,7 +769,16 @@ Send a test message:
- ✅ Send/receive images with captions
- ✅ Send/receive videos with captions
- ✅ Send/receive documents with filenames
- ✅ Media upload via Meta CDN
- ✅ Send audio, stickers, locations, and contact cards
- ✅ Interactive messages (buttons and lists)
- ✅ Template messages and template management (list, upload, delete)
- ✅ Flows — create, upload, publish, deprecate, delete, and send flow messages
- ✅ Commerce — catalog messages, single product, multi-product list, catalog and product listing
- ✅ Business profile management (get and update)
- ✅ Reactions (emoji) on messages
- ✅ Mark messages as read
- ✅ Phone number management and verification
- ✅ Media upload and delete via Meta CDN
- ✅ Delivery and read receipts
- ✅ Event publishing to webhooks (same format as whatsmeow)
@@ -995,16 +1004,76 @@ The server exposes the following HTTP endpoints:
- `GET/POST /webhooks/whatsapp/{accountID}` - Business API webhook verification and events (no authentication, validated by Meta's verify_token)
**Protected Endpoints (require authentication if enabled):**
*Hooks & Accounts:*
- `GET /api/hooks` - List all hooks
- `POST /api/hooks/add` - Add a new hook
- `POST /api/hooks/remove` - Remove a hook
- `GET /api/accounts` - List all WhatsApp accounts
- `POST /api/accounts/add` - Add a new WhatsApp account
- `POST /api/send` - Send a message
- `POST /api/accounts/update` - Update a WhatsApp account
- `POST /api/accounts/remove` - Remove a WhatsApp account
- `POST /api/accounts/disable` - Disable a WhatsApp account
- `POST /api/accounts/enable` - Enable a WhatsApp account
*Send Messages:*
- `POST /api/send` - Send a text message
- `POST /api/send/image` - Send an image
- `POST /api/send/video` - Send a video
- `POST /api/send/document` - Send a document
- `POST /api/send/audio` - Send an audio message (Business API, base64-encoded)
- `POST /api/send/sticker` - Send a sticker (Business API, base64-encoded)
- `POST /api/send/location` - Send a location (Business API)
- `POST /api/send/contacts` - Send contact card(s) (Business API)
- `POST /api/send/interactive` - Send an interactive message — buttons or list (Business API)
- `POST /api/send/template` - Send a template message (Business API)
- `POST /api/send/flow` - Send an interactive flow message (Business API)
- `POST /api/send/reaction` - React to a message with an emoji (Business API)
- `POST /api/messages/read` - Mark a message as read (Business API)
*Templates (Business API):*
- `POST /api/templates` - List all message templates for an account
- `POST /api/templates/upload` - Create a new message template
- `POST /api/templates/delete` - Delete a template by name and language
*Flows (Business API):*
- `POST /api/flows` - List all flows for an account
- `POST /api/flows/create` - Create a new flow
- `POST /api/flows/get` - Get details of a specific flow
- `POST /api/flows/upload` - Upload screens JSON to a draft flow
- `POST /api/flows/publish` - Publish a draft flow
- `POST /api/flows/deprecate` - Deprecate a flow (blocks new sessions; existing sessions continue)
- `POST /api/flows/delete` - Permanently delete a flow
*Phone Numbers (Business API):*
- `POST /api/phone-numbers` - List phone numbers for an account
- `POST /api/phone-numbers/request-code` - Request a verification code (SMS or VOICE)
- `POST /api/phone-numbers/verify-code` - Verify a phone number with the received code
*Business Profile (Business API):*
- `POST /api/business-profile` - Retrieve the business profile for an account
- `POST /api/business-profile/update` - Update business profile fields (about, address, description, email, websites, vertical)
*Catalog / Commerce (Business API):*
- `POST /api/catalogs` - List product catalogs linked to an account
- `POST /api/catalogs/products` - List products in a specific catalog
- `POST /api/send/catalog` - Send a catalog message (shares full product catalog)
- `POST /api/send/product` - Send a single-product interactive message
- `POST /api/send/product-list` - Send a multi-product list message (up to 30 products across 10 sections)
*Media:*
- `GET /api/media/{accountID}/{filename}` - Serve media files
- `POST /api/media/upload` - Upload a media file to Meta and return its media_id (Business API)
- `POST /api/media-delete` - Delete a previously uploaded media file from Meta (Business API)
*Message Cache:*
- `GET /api/cache` - List cached events
- `GET /api/cache/stats` - Cache statistics
- `POST /api/cache/replay` - Replay all cached events
- `GET /api/cache/event?id=` - Get a single cached event
- `POST /api/cache/event/replay?id=` - Replay a single cached event
- `DELETE /api/cache/event/delete?id=` - Delete a single cached event
- `DELETE /api/cache/clear?confirm=true` - Clear all cached events
## WhatsApp JID Format