Skip to main content
Version: 26.01

AI Assistants - Feedback

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/feedback

Overview​

Sends a thumbs up or thumbs down on an assistant answer, with an optional category and comment.

Feedback is not stored on your Countly server. It is forwarded to Countly to help improve the product. The forwarded data includes threadId, promptId, rating, the optional category and comment text, your server's domain and its Countly version. It does not include the member's identity. If the server has no public domain configured (the API domain setting is empty or localhost), the feedback is not forwarded and the response contains tracked: false.

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.
  • The thread must belong to the authenticated member.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
threadIdStringYesID of the thread the answer belongs to
promptIdStringYesAssistant message _id from the start or done event of the Send Message stream
ratingStringYesthumbs_up or thumbs_down
categoryStringNoFeedback category
commentStringNoFree-text comment

Examples​

Example: Rate an answer​

curl "https://your-server.com/i/ai-assistants/feedback" \
-d "api_key=YOUR_API_KEY" \
-d "threadId=THREAD_ID" \
-d "promptId=PROMPT_ID" \
-d "rating=thumbs_down" \
-d "comment=The answer missed the date range"

Response​

Success Response​

{
"ok": 1,
"tracked": true
}

Response Fields​

FieldTypeDescription
okNumberSuccess flag (1)
trackedBooleantrue when the feedback was forwarded to Countly; false when the server has no public domain configured and the feedback was not forwarded

Error Responses​

  • HTTP 400 - Invalid parameters:
{
"result": "Invalid parameters: <details>"
}
  • HTTP 400 - Invalid rating:
{
"result": "rating must be \"thumbs_up\" or \"thumbs_down\""
}
  • HTTP 403 - Thread belongs to another member:
{
"result": "Not authorized"
}
  • HTTP 404 - Thread does not exist:
{
"result": "Thread not found"
}
  • HTTP 500 - Feedback could not be sent:
{
"result": "Couldn't record feedback"
}

Behavior​

  1. Validates user authentication.
  2. Validates threadId, promptId and rating.
  3. Loads the thread and checks that the authenticated member owns it.
  4. If the server has a public domain configured, forwards the rating, threadId, promptId and the optional category and comment to Countly and returns tracked: true. Nothing is stored on your server.
  5. Otherwise accepts the request without forwarding anything and returns tracked: false.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
ClickHouse thread storeThread storageReads the thread to check ownership.