Skip to content

Submit feedback for a message

POST
/messages/{messageId}/feedback
curl --request POST \
--url https://api.siteassist.io/v2/messages/123e4567-e89b-12d3-a456-426614174000/feedback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "feedback": "like" }'

Submit feedback (like/dislike) for a specific message in a conversation. This endpoint allows users to rate the quality and helpfulness of AI assistant responses.

Use Cases:

  • Rate the helpfulness of AI responses
  • Provide training data for model improvement
  • Track user satisfaction with AI interactions
  • Remove existing feedback by setting feedback to null
  • Update existing feedback by submitting a new value

Authentication Required: This endpoint requires a valid Bearer token in the Authorization header. The user must have access to the conversation containing the message.

Feedback Types:

  • like: Positive feedback indicating the response was helpful and accurate
  • dislike: Negative feedback indicating the response was unhelpful or incorrect
  • null: Remove existing feedback

Behavior:

  • Feedback is stored with a timestamp (feedbackAt)
  • Submitting new feedback overwrites any existing feedback
  • Setting feedback to null removes the existing feedback
  • Feedback submissions are published as events for analytics
  • Only the message owner (visitor) can submit feedback

Event Publishing: Feedback submissions are automatically published as events for analytics and monitoring purposes.

messageId
required

The unique identifier of the message to provide feedback for

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

Request body containing the feedback to submit for the specified message

object
feedback
required

The feedback type for the message. Use ‘like’ to indicate the response was helpful and accurate, ‘dislike’ to indicate it was unhelpful or incorrect, or null to remove any existing feedback. This feedback is used for analytics and model improvement.

string
nullable
Allowed values: like dislike
Examples

Positive feedback example

Example of submitting positive feedback for a helpful response

{
"feedback": "like"
}

Feedback successfully submitted and recorded for the message. The feedback has been stored in the database and published as an event for analytics.

Media typeapplication/json

Response confirming the feedback was successfully submitted and recorded

object
feedback
required

The feedback that was successfully submitted for the message. This confirms the feedback was recorded in the database and published as an event.

string
nullable
Allowed values: like dislike
Examples

Positive feedback response

Response when positive feedback is successfully submitted

{
"feedback": "like"
}

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
}
}
}