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

@@ -1,82 +0,0 @@
# Static Files
This directory contains the embedded static files for the WhatsHooked landing page.
## Files
- `index.html` - Landing page with API documentation
- `logo.png` - WhatsHooked logo (from `assets/image/whatshooked_tp.png`)
## How It Works
These files are embedded into the Go binary using `go:embed` directive in `static.go`.
When you build the server:
```bash
go build ./cmd/server/
```
The files in this directory are compiled directly into the binary, so the server can run without any external files.
## Updating the Landing Page
1. **Edit the HTML:**
```bash
vim pkg/handlers/static/index.html
```
2. **Rebuild the server:**
```bash
go build ./cmd/server/
```
3. **Restart the server:**
```bash
./server -config bin/config.json
```
The changes will be embedded in the new binary.
## Updating the Logo
1. **Replace the logo:**
```bash
cp path/to/new-logo.png pkg/handlers/static/logo.png
```
2. **Rebuild:**
```bash
go build ./cmd/server/
```
## Routes
- `GET /` - Serves `index.html`
- `GET /static/logo.png` - Serves `logo.png`
- `GET /static/*` - Serves any file in this directory
## Development Tips
- Files are cached with `Cache-Control: public, max-age=3600` (1 hour)
- Force refresh in browser: `Ctrl+Shift+R` or `Cmd+Shift+R`
- Changes require rebuild - no hot reload
- Keep files small - they're embedded in the binary
## File Structure
```
pkg/handlers/
├── static.go # Handler with go:embed directive
├── static/
│ ├── index.html # Landing page
│ ├── logo.png # Logo image
│ └── README.md # This file
```
## Benefits of Embedded Files
**Single binary deployment** - No external dependencies
**Fast serving** - Files loaded from memory
**No file system access** - Works in restricted environments
**Portable** - Binary includes everything
**Version controlled** - Static assets tracked with code

View File

@@ -384,6 +384,154 @@
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/document</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/audio</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/sticker</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/location</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/contacts</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/interactive</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/template</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/flow</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/reaction</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/messages/read</span>
</div>
</div>
<div class="endpoint-group">
<h3>📄 Templates</h3>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/templates</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/templates/upload</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/templates/delete</span>
</div>
</div>
<div class="endpoint-group">
<h3>🔄 Flows</h3>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/flows</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/flows/create</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/flows/get</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/flows/upload</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/flows/publish</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/flows/deprecate</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/flows/delete</span>
</div>
</div>
<div class="endpoint-group">
<h3>📞 Phone Numbers</h3>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/phone-numbers</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/phone-numbers/request-code</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/phone-numbers/verify-code</span>
</div>
</div>
<div class="endpoint-group">
<h3>🏪 Catalog / Commerce</h3>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/catalogs</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/catalogs/products</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/catalog</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/product</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/send/product-list</span>
</div>
</div>
<div class="endpoint-group">
<h3>🏢 Business Profile</h3>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/business-profile</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/business-profile/update</span>
</div>
</div>
<div class="endpoint-group">
<h3>🗑️ Media Management</h3>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/media/upload</span>
</div>
<div class="endpoint">
<span class="endpoint-method post">POST</span>
<span class="endpoint-path">/api/media-delete</span>
</div>
</div>
<div class="endpoint-group">