Add Webhook Endpoints for external automation
- Create WebhookController with 4 endpoints:
- POST /api/webhooks/posts - Create a new post
- GET /api/webhooks/posts - List posts with filters
- POST /api/webhooks/posts/{post}/publish - Trigger publishing
- GET /api/webhooks/posts/{post}/status - Get post status
- Add X-Muninn-Token header authentication
- Add MUNINN_WEBHOOK_TOKEN config in services.php
- Add MUNINN_WEBHOOK_TOKEN to .env.example
- Add webhook routes with /webhooks prefix
All endpoints return JSON responses with success/error fields.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use App\Http\Controllers\Api\PostController;
|
||||
use App\Http\Controllers\Api\SiteController;
|
||||
use App\Http\Controllers\Api\SocialAccountController;
|
||||
use App\Http\Controllers\Api\WebhookController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/sites', [SiteController::class, 'index']);
|
||||
@@ -12,3 +13,11 @@ Route::get('/accounts', [SocialAccountController::class, 'index']);
|
||||
Route::get('/accounts/{socialAccount}', [SocialAccountController::class, 'show']);
|
||||
|
||||
Route::apiResource('posts', PostController::class)->names('api.posts');
|
||||
|
||||
// Webhook endpoints (require X-Muninn-Token header)
|
||||
Route::prefix('webhooks')->group(function () {
|
||||
Route::post('/posts', [WebhookController::class, 'createPost']);
|
||||
Route::get('/posts', [WebhookController::class, 'listPosts']);
|
||||
Route::post('/posts/{post}/publish', [WebhookController::class, 'publishPost']);
|
||||
Route::get('/posts/{post}/status', [WebhookController::class, 'getPostStatus']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user