Submit feedback for a message
const url = 'https://api.siteassist.io/v2/messages/123e4567-e89b-12d3-a456-426614174000/feedback';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"feedback":"like"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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 accuratedislike: Negative feedback indicating the response was unhelpful or incorrectnull: Remove existing feedback
Behavior:
- Feedback is stored with a timestamp (
feedbackAt) - Submitting new feedback overwrites any existing feedback
- Setting feedback to
nullremoves 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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The unique identifier of the message to provide feedback for
Example
123e4567-e89b-12d3-a456-426614174000Request Body
Section titled “Request Body”Request body containing the feedback to submit for the specified message
object
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.
Examples
Positive feedback example
Example of submitting positive feedback for a helpful response
{ "feedback": "like"}Negative feedback example
Example of submitting negative feedback for an unhelpful response
{ "feedback": "dislike"}Remove feedback example
Example of removing existing feedback by setting it to null
{ "feedback": null}Responses
Section titled “Responses”Feedback successfully submitted and recorded for the message. The feedback has been stored in the database and published as an event for analytics.
Response confirming the feedback was successfully submitted and recorded
object
The feedback that was successfully submitted for the message. This confirms the feedback was recorded in the database and published as an event.
Examples
Positive feedback response
Response when positive feedback is successfully submitted
{ "feedback": "like"}Negative feedback response
Response when negative feedback is successfully submitted
{ "feedback": "dislike"}Feedback removed response
Response when existing feedback is successfully removed
{ "feedback": null}Bad Request - The request body or parameters are invalid
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
Example
{ "error": { "message": "Invalid request body. Content is required.", "code": "INVALID_REQUEST_BODY", "details": { "field": "content" } }}Unauthorized - Authentication token is missing or invalid
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
Example
{ "error": { "message": "Authentication required", "code": "UNAUTHORIZED" }}Payment Required - A higher pricing plan is required to access the resource
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
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
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
Example
{ "error": { "message": "Access denied to this conversation", "code": "FORBIDDEN" }}Not Found - The requested resource was not found
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
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
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
Example
{ "error": { "message": "Resource already exists", "code": "CONFLICT", "details": { "resource": "conversation", "conflictingField": "id" } }}Unprocessable Entity - The request was well-formed but contains semantic errors
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
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
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
Example
{ "error": { "message": "Rate limit exceeded. Please try again later.", "code": "RATE_LIMIT_EXCEEDED", "details": { "retryAfter": 60 } }}Internal Server Error - An unexpected error occurred
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
Example
{ "error": { "message": "An internal server error occurred", "code": "INTERNAL_SERVER_ERROR" }}Bad Gateway - The server received an invalid response from an upstream server
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
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
object
object
Human-readable error message describing what went wrong
Machine-readable error code for programmatic handling
Additional error details and context
object
Example
{ "error": { "message": "Service temporarily unavailable", "code": "SERVICE_UNAVAILABLE", "details": { "retryAfter": 30 } }}