Send Message (Store)
Send a message from a store to admins. Creates a session automatically if one doesn't exist.
Endpoint
Authentication
Required: Store authentication token
Request Body
{
"content": "Hello, I need help with my account",
"attachment_url": "https://example.com/file.jpg",
"attachment_type": "image/jpeg"
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
content |
string | Conditional | Message text (required if no attachment) |
attachment_url |
string | Conditional | URL of attachment (required if no content) |
attachment_type |
string | No | MIME type of attachment (auto-detected if not provided) |
Note: Either content or attachment_url must be provided.
Response
Success (200 OK)
Returns the session and created message.
{
"session": {
"id": 1,
"store_id": 5,
"admin_id": null,
"status": "open",
"last_message_at": "2025-12-16T10:30:00Z",
"created": "2025-12-16T10:00:00Z",
"updated": "2025-12-16T10:30:00Z"
},
"message": {
"id": 123,
"session_id": 1,
"sender_type": "store",
"sender_id": 5,
"content": "Hello, I need help with my account",
"attachment_url": "",
"attachment_type": "",
"status": "sent",
"created": "2025-12-16T10:30:00Z",
"updated": "2025-12-16T10:30:00Z"
}
}
Error Responses
Missing Content or Attachment (400)
Could Not Prepare Session (500)
Unauthorized (401)
Example Request
curl -X POST "https://api.luxmart.site/v1/chat/store/message/" \
-H "Authorization: Token your_store_token" \
-H "Content-Type: application/json" \
-d '{
"content": "Hello, I need help with my account"
}'
Notes
- Automatically creates a session if the store doesn't have an active one
- If session is not claimed, message is broadcast to all admins
- If session is claimed, message is sent only to the assigned admin
- Notifications are created for admins (persisted in database)
- WebSocket events are sent in real-time to connected admins
- Message status is set to "delivered" if admin is online, otherwise "sent"
- Use the Upload Attachment endpoint to upload files first