POST
/
api
/
messaging
/
sessions
/
{sessionId}
/
messages
Send a message to a session
curl --request POST \
  --url http://localhost:3000/api/messaging/sessions/{sessionId}/messages \
  --header 'Content-Type: application/json' \
  --data '{
  "content": "<string>",
  "attachments": [
    {
      "type": "<string>",
      "url": "<string>",
      "name": "<string>"
    }
  ],
  "metadata": {}
}'
// 404 - Session not found
{
  "error": "Session not found",
  "details": {
    "sessionId": "abc-123"
  }
}

// 410 - Session expired
{
  "error": "Session has expired",
  "details": {
    "sessionId": "abc-123",
    "expiresAt": "2024-01-15T10:30:00Z"
  }
}

// 400 - Invalid content
{
  "error": "Content exceeds maximum length of 4000 characters"
}
Sending a message automatically updates the session’s last activity timestamp. If auto-renewal is enabled, the session will be renewed, extending its expiration time.

Path Parameters

sessionId
string
required
The unique identifier of the session

Request Body

content
string
required
The message content (maximum 4000 characters)
metadata
object
Optional metadata to attach to the message
attachments
array
Optional array of attachments

Response

id
string
Unique identifier of the created message
content
string
The message content
authorId
string
UUID of the message author (user or agent)
createdAt
string
ISO timestamp of message creation
metadata
object
Any metadata attached to the message
sessionStatus
object
Current session status after sending the message

Error Responses

// 404 - Session not found
{
  "error": "Session not found",
  "details": {
    "sessionId": "abc-123"
  }
}

// 410 - Session expired
{
  "error": "Session has expired",
  "details": {
    "sessionId": "abc-123",
    "expiresAt": "2024-01-15T10:30:00Z"
  }
}

// 400 - Invalid content
{
  "error": "Content exceeds maximum length of 4000 characters"
}

Path Parameters

sessionId
string
required

ID of the session

Body

application/json
content
string
required

The message content

attachments
object[]
metadata
object

Additional message metadata

Response

Message sent and processed successfully

id
string

Message ID

content
string

The message content

authorId
string<uuid>
createdAt
string<date-time>
metadata
object
sessionStatus
object

Current session status after sending the message