update
This commit is contained in:
@@ -330,3 +330,53 @@ def trigger_crawl():
|
||||
- **[Newsletter Preview](../backend/routes/newsletter_routes.py)**: `/api/newsletter/preview` - Preview newsletter HTML
|
||||
- **[Analytics](API.md)**: `/api/analytics/*` - View engagement metrics
|
||||
- **[RSS Feeds](API.md)**: `/api/rss-feeds` - Manage RSS feeds
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Newsletter API Summary
|
||||
|
||||
### Available Endpoints
|
||||
|
||||
| Endpoint | Purpose | Recipient |
|
||||
|----------|---------|-----------|
|
||||
| `/api/admin/send-test-email` | Test newsletter | Single email (specified) |
|
||||
| `/api/admin/send-newsletter` | Production send | All active subscribers |
|
||||
| `/api/admin/trigger-crawl` | Fetch articles | N/A |
|
||||
| `/api/admin/stats` | System stats | N/A |
|
||||
|
||||
### Subscriber Status
|
||||
|
||||
The system uses a `status` field to determine who receives newsletters:
|
||||
- **`active`** - Receives newsletters ✅
|
||||
- **`inactive`** - Does not receive newsletters ❌
|
||||
|
||||
See [SUBSCRIBER_STATUS.md](SUBSCRIBER_STATUS.md) for details.
|
||||
|
||||
### Quick Examples
|
||||
|
||||
**Send to all subscribers:**
|
||||
```bash
|
||||
curl -X POST http://localhost:5001/api/admin/send-newsletter \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"max_articles": 10}'
|
||||
```
|
||||
|
||||
**Send test email:**
|
||||
```bash
|
||||
curl -X POST http://localhost:5001/api/admin/send-test-email \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"email": "test@example.com"}'
|
||||
```
|
||||
|
||||
**Check stats:**
|
||||
```bash
|
||||
curl http://localhost:5001/api/admin/stats | jq '.subscribers'
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
Use the test script:
|
||||
```bash
|
||||
./test-newsletter-api.sh
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user