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
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Yes (or auth_token) | API key authentication |
auth_token | String | Yes (or api_key) | Auth token authentication |
app_id | String | Yes | App ID (required by validation) |
threadId | String | Yes | Thread ID |
messageId | String | Yes | Message ID in thread |
rating | String | Yes | Rating 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
| Field | Type | Description |
|---|---|---|
ok | Number | Request 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
- Validates user authentication and required parameters.
- Loads thread and verifies ownership.
- Validates associated app exists.
- Writes message rating to thread.
- Emits feedback tracking event.
- Returns
{ "ok": 1 }.
Related Endpoints
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly.ai_assistants_threads | Endpoint data source | Stores endpoint-related records this endpoint reads or modifies. |
countly.apps | App configuration and metadata | Stores app-level feature settings and metadata used or modified by this endpoint. |