Bulk Import
Allows users to import multiple posts via CSV file upload.
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/bulk/template | Download CSV template |
| POST | /api/bulk/import | Process CSV file |
| GET | /api/bulk/import/:id/status | Check import status |
CSV Format
csv
content,platform,scheduledDate,scheduledTime,hashtags,imageUrl
"Post content here",twitter,2024-12-25,09:00,"#hashtag1 #hashtag2",https://...Import Flow
- User downloads template
- User fills template with content
- User uploads CSV
- Backend validates rows
- Creates posts in draft status
- Returns summary: created, failed, errors
Validation
- Content length per platform limits
- Date/time format validation
- Platform must be connected
- Image URLs must be valid (optional check)
Error Handling
Returns array of errors with row numbers:
json
{
"created": 45,
"failed": 5,
"errors": [
{ "row": 3, "field": "platform", "message": "Invalid platform" }
]
}Database
Uses existing CompanyPost model with batch insert.