Skip to content

Send a message in a conversation

POST
/conversations/{conversationId}/messages
curl --request POST \
--url https://api.siteassist.io/v2/conversations/123e4567-e89b-12d3-a456-426614174000/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "content": "Hello! Can you help me understand how to use this feature?", "stream": false, "pageContext": { "url": "https://example.com/help", "title": "Help Center - Getting Started", "content": "Welcome to our help center. Here you can find answers to common questions..." } }'

Send a message to an AI assistant in a conversation. Supports both streaming and non-streaming responses. Rate limiting and usage quotas are enforced per project.

conversationId
required

The unique identifier of the conversation to send the message to

string format: uuid
Example
123e4567-e89b-12d3-a456-426614174000
Media typeapplication/json

Request body for sending a message to an AI assistant in a conversation

object
stream

If set to true, the model response data will be streamed to the client as it is generated using server-sent events. When streaming is enabled, the response will be sent as text/event-stream with incremental updates. When disabled, the complete response will be returned as application/json.

boolean
Example
false
content
required

The message content to send to the assistant. This is the user’s input that will be processed by the AI.

string
>= 1 characters <= 10000 characters
Example
Hello! Can you help me understand how to use this feature?
pageContext

Optional context information about the user’s current page and interaction. This helps the assistant provide more relevant responses.

object
url

The URL of the page where the message was sent from. Used to provide context to the assistant about the user’s current location.

string
nullable
Example
https://example.com/help
title

The title of the page where the message was sent from. Provides additional context about the user’s current page.

string
nullable
Example
Help Center - Getting Started
content

The content of the page where the message was sent from. Can be used to provide the assistant with relevant page information.

string
nullable
Example
Welcome to our help center. Here you can find answers to common questions...
textSelection

Any text that was selected by the user on the page before sending the message. This can provide specific context about what the user is asking about.

string
nullable
Example
How do I reset my password?
Example
{
"content": "Hello! Can you help me understand how to use this feature?",
"stream": false,
"pageContext": {
"url": "https://example.com/help",
"title": "Help Center - Getting Started",
"content": "Welcome to our help center. Here you can find answers to common questions..."
}
}

Successfully processed the message and generated a response from the AI assistant

Server-sent events stream containing incremental updates of the AI assistant’s response. Each event contains a JSON object with type and relevant data. The stream includes start/end markers, text deltas, and completion information.

string
Example
data: {"type":"start"}
data: {"type":"start-step"}
data: {"type":"text-start","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","providerMetadata":{"openai":{"itemId":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18"}}}
data: {"type":"text-delta","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","delta":"Hello! "}
data: {"type":"text-delta","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","delta":"How "}
data: {"type":"text-delta","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","delta":"can "}
data: {"type":"text-delta","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","delta":"I "}
data: {"type":"text-delta","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","delta":"assist "}
data: {"type":"text-delta","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","delta":"you "}
data: {"type":"text-delta","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18","delta":"today?"}
data: {"type":"text-end","id":"msg_68c276dd2b3481a2bb6da153039cf9cd093857e78e8e8f18"}
data: {"type":"finish-step"}
data: {"type":"finish"}
data: [DONE]

Message successfully received and queued for human agent handling. This response is returned when the conversation is marked for human intervention rather than AI processing.

Media typetext/plain

Simple text confirmation that the message was received and queued for human agent handling

string
Example
Message sent

Bad Request - The request body or parameters are invalid

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Invalid request body. Content is required.",
"code": "INVALID_REQUEST_BODY",
"details": {
"field": "content"
}
}
}

Unauthorized - Authentication token is missing or invalid

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Authentication required",
"code": "UNAUTHORIZED"
}
}

Payment Required - A higher pricing plan is required to access the resource

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "A higher pricing plan is required to access this feature",
"code": "PAYMENT_REQUIRED",
"details": {
"currentPlan": "free",
"requiredPlan": "pro",
"feature": "advanced_ai_models"
}
}
}

Forbidden - Access denied to the requested resource

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Access denied to this conversation",
"code": "FORBIDDEN"
}
}

Not Found - The requested resource was not found

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Conversation not found!",
"code": "CONVERSATION_NOT_FOUND",
"details": {
"conversationId": "123e4567-e89b-12d3-a456-426614174000"
}
}
}

Conflict - The request could not be completed due to a conflict

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Resource already exists",
"code": "CONFLICT",
"details": {
"resource": "conversation",
"conflictingField": "id"
}
}
}

Unprocessable Entity - The request was well-formed but contains semantic errors

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Validation failed",
"code": "VALIDATION_ERROR",
"details": {
"field": "content",
"reason": "Content exceeds maximum length of 10000 characters"
}
}
}

Too Many Requests - Rate limit exceeded or quota reached

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Rate limit exceeded. Please try again later.",
"code": "RATE_LIMIT_EXCEEDED",
"details": {
"retryAfter": 60
}
}
}

Internal Server Error - An unexpected error occurred

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "An internal server error occurred",
"code": "INTERNAL_SERVER_ERROR"
}
}

Bad Gateway - The server received an invalid response from an upstream server

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Service temporarily unavailable",
"code": "BAD_GATEWAY",
"details": {
"service": "ai_model_service"
}
}
}

Service Unavailable - The server is temporarily unable to handle the request

Media typeapplication/json
object
error
required
object
message
required

Human-readable error message describing what went wrong

string
code

Machine-readable error code for programmatic handling

string
details

Additional error details and context

object
key
additional properties
nullable
Example
{
"error": {
"message": "Service temporarily unavailable",
"code": "SERVICE_UNAVAILABLE",
"details": {
"retryAfter": 30
}
}
}