70 lines
2.0 KiB
Markdown
70 lines
2.0 KiB
Markdown
# Quick Strapi Webhook Setup
|
|
|
|
## TL;DR - Quick Configuration
|
|
|
|
1. **Access Strapi Admin**: `http://localhost:1337/admin`
|
|
2. **Go to Settings → Webhooks**
|
|
3. **Add New Webhook**:
|
|
- **Name**: `Backend Sync`
|
|
- **URL**: `http://localhost:3000/api/v1/webhooks/strapi`
|
|
- **Events**: Select all for "Article" and "Live Blog" content types
|
|
4. **Save and Test**
|
|
|
|
## Already Configured (What We Fixed)
|
|
|
|
✅ **Backend webhook endpoints** are now public (no auth required)
|
|
✅ **Tested webhooks** manually - they work
|
|
✅ **Articles sync** from Strapi to backend
|
|
✅ **Frontend TypeScript errors** fixed
|
|
✅ **Authentication system** working
|
|
|
|
## Manual Test Commands
|
|
|
|
```bash
|
|
# Test webhook manually
|
|
curl -X POST http://localhost:3000/api/v1/webhooks/strapi \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"event": "entry.publish",
|
|
"model": "article",
|
|
"entry": {"documentId": "r07qatlpgvx82d7337n3nz1l"}
|
|
}'
|
|
|
|
# Check synced articles
|
|
curl http://localhost:3000/api/v1/articles?status=published
|
|
|
|
# Run comprehensive test
|
|
./scripts/test-webhooks.sh
|
|
```
|
|
|
|
## Current Status
|
|
|
|
- **Strapi Articles**: 2
|
|
- **Backend Articles**: 2 (synced)
|
|
- **Webhook Status**: Ready for configuration
|
|
- **Frontend**: Access at `http://localhost:5173/articles`
|
|
|
|
## Immediate Action Required
|
|
|
|
1. **Configure webhooks in Strapi admin** (see detailed guide in `STRAPI_WEBHOOKS_SETUP.md`)
|
|
2. **Test by publishing an article** in Strapi
|
|
3. **Verify automatic sync** works
|
|
|
|
## If Webhooks Don't Work
|
|
|
|
Use manual sync as fallback:
|
|
```bash
|
|
# Get auth token first
|
|
TOKEN=$(curl -s -X POST http://localhost:3000/api/v1/auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"username":"testuser","password":"Test123!"}' | jq -r '.access_token')
|
|
|
|
# Sync all articles
|
|
curl -X POST http://localhost:3000/api/v1/webhooks/strapi/sync/all \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
## Verification
|
|
- Visit `http://localhost:5173/articles` to see synced articles
|
|
- Check backend logs: `docker logs placebo-backend-dev --tail 20`
|
|
- Monitor sync status with test script: `./scripts/test-webhooks.sh` |