Skip to main content

AI Assistants - Rate Message

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/i/ai-assistants/rate-message

Overview

Rates one assistant message in a thread and records feedback telemetry.

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

  • Requires an authenticated Countly user.
  • Thread rating is owner-restricted.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApp ID (required by validation)
threadIdStringYesThread ID
messageIdStringYesMessage ID in thread
ratingStringYesRating value (typically thumbs_up or thumbs_down)

Examples

Example: Rate a message

curl "https://your-server.com/i/ai-assistants/rate-message?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&threadId=THREAD_ID&messageId=MESSAGE_ID&rating=thumbs_up"

Response

Success Response

{
"ok": 1
}

Response Fields

FieldTypeDescription
okNumberRequest processed successfully

Error Responses

  • HTTP 400 - Invalid parameters:
{
"result": "Invalid parameters: <details>"
}
  • HTTP 400 - Missing auth parameters:
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
  • HTTP 401 - User/auth validation failed:
{
"result": "User does not exist"
}
  • HTTP 403 - Not authorized for thread:
{
"result": "Not authorized"
}
  • HTTP 404 - Thread not found:
{
"result": "Thread not found"
}
  • HTTP 404 - App not found:
{
"result": "App not found"
}
  • HTTP 500 - Rating failed:
{
"result": "Couldn't rate the message"
}

Behavior

  1. Validates user authentication and required parameters.
  2. Loads thread and verifies ownership.
  3. Validates associated app exists.
  4. Writes message rating to thread.
  5. Emits feedback tracking event.
  6. Returns { "ok": 1 }.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.ai_assistants_threadsEndpoint data sourceStores endpoint-related records this endpoint reads or modifies.
countly.appsApp configuration and metadataStores app-level feature settings and metadata used or modified by this endpoint.