Send Message (Admin)
Send a message from an admin to a store in a claimed session.
Endpoint
Authentication
Required: Admin authentication token
Request Body
{
"session_id": 1,
"content": "Hello, how can I help you?",
"attachment_url": "https://example.com/file.pdf",
"attachment_type": "application/pdf"
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
session_id |
integer | Yes | ID of the session to send message to |
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": 2,
"status": "claimed",
"last_message_at": "2025-12-16T10:35:00Z",
"created": "2025-12-16T10:00:00Z",
"updated": "2025-12-16T10:35:00Z"
},
"message": {
"id": 124,
"session_id": 1,
"sender_type": "admin",
"sender_id": 2,
"content": "Hello, how can I help you?",
"attachment_url": "",
"attachment_type": "",
"status": "sent",
"created": "2025-12-16T10:35:00Z",
"updated": "2025-12-16T10:35:00Z"
}
}
Error Responses
Missing Session ID (400)
Missing Content or Attachment (400)
Session Not Found or Not Assigned (403)
Session Is Closed (400)
Unauthorized (401)
Example Request
curl -X POST "https://api.luxmart.site/v1/chat/admin/message/" \
-H "Authorization: Token your_admin_token" \
-H "Content-Type: application/json" \
-d '{
"session_id": 1,
"content": "Hello, how can I help you?"
}'
Notes
- Admin must have claimed the session (session must be assigned to them)
- Cannot send messages to closed sessions
- Message is sent via WebSocket to the store if they are online
- Message status is set to "delivered" if store is online, otherwise "sent"
- Use the Upload Attachment endpoint to upload files first
- Session's
last_message_atis updated when message is sent