Submit message feedback (like/dislike)
curl --request POST \
--url https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rating": 1,
"feedback": "Very helpful and accurate response!"
}
'import requests
url = "https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback"
payload = {
"rating": 1,
"feedback": "Very helpful and accurate response!"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({rating: 1, feedback: 'Very helpful and accurate response!'})
};
fetch('https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rating' => 1,
'feedback' => 'Very helpful and accurate response!'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback"
payload := strings.NewReader("{\n \"rating\": 1,\n \"feedback\": \"Very helpful and accurate response!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rating\": 1,\n \"feedback\": \"Very helpful and accurate response!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rating\": 1,\n \"feedback\": \"Very helpful and accurate response!\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"messageId": "507f1f77bcf86cd799439011",
"rating": 1,
"feedback": "Very helpful and accurate response!",
"updatedAt": "2025-12-10T08:35:00.000Z"
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}Conversations
Submit Message Feedback
Submit user feedback (thumbs up/down and optional text) for a message. Supports both Auth0 JWT and device-based authentication for guest users.
POST
/
api
/
v1
/
user
/
messages
/
{messageId}
/
feedback
Submit message feedback (like/dislike)
curl --request POST \
--url https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rating": 1,
"feedback": "Very helpful and accurate response!"
}
'import requests
url = "https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback"
payload = {
"rating": 1,
"feedback": "Very helpful and accurate response!"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({rating: 1, feedback: 'Very helpful and accurate response!'})
};
fetch('https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rating' => 1,
'feedback' => 'Very helpful and accurate response!'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback"
payload := strings.NewReader("{\n \"rating\": 1,\n \"feedback\": \"Very helpful and accurate response!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rating\": 1,\n \"feedback\": \"Very helpful and accurate response!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://handauncle-backend-prod-205012263523.asia-south1.run.app/api/v1/user/messages/{messageId}/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rating\": 1,\n \"feedback\": \"Very helpful and accurate response!\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"messageId": "507f1f77bcf86cd799439011",
"rating": 1,
"feedback": "Very helpful and accurate response!",
"updatedAt": "2025-12-10T08:35:00.000Z"
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}{
"success": false,
"error": {
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)",
"code": "VALIDATION_ERROR",
"details": [
{
"field": "phone",
"message": "Please enter a valid 10-digit phone number (e.g., 9876543210)"
}
]
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>"
}
}Submit user feedback (like/dislike rating and optional text comments) for a specific message. This endpoint supports both registered users (Auth0 JWT) and guest users (device-based authentication), making it accessible during free trial flows.
Authentication Methods
Unlike other conversation endpoints, this route accepts two authentication methods:-
Auth0 JWT (Registered users)
- Header:
Authorization: Bearer <token> - Standard authenticated flow
- Header:
-
Device-based (Guest users)
- Headers:
x-device-id,x-user-id,x-platform - Same authentication as
/api/v1/ai/chat - Enables feedback during trial/guest sessions
- Headers:
Use Cases
- Thumbs up/down on AI responses
- Report inaccuracies with text feedback
- Track user satisfaction for model improvements
- A/B testing different prompts or models
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
rating | 1 | -1 | β Yes | 1 for like (π), -1 for dislike (π) |
feedback | string | β No | Optional text feedback (max 1000 chars) |
Response
Returns the updated feedback data with a timestamp.{
"success": true,
"data": {
"messageId": "507f1f77bcf86cd799439011",
"rating": 1,
"feedback": "Very helpful explanation!",
"updatedAt": "2025-12-10T08:35:00.000Z"
},
"meta": {
"timestamp": "2025-12-10T08:35:00.000Z",
"requestId": "req_abc123"
}
}
Examples
curl -X POST \
'https://api.handauncle.com/api/v1/user/messages/507f1f77bcf86cd799439011/feedback' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"rating": 1,
"feedback": "Great response!"
}'
curl -X POST \
'https://api.handauncle.com/api/v1/user/messages/507f1f77bcf86cd799439011/feedback' \
-H 'x-device-id: unique-device-id-12345' \
-H 'x-user-id: 507f1f77bcf86cd799439012' \
-H 'x-platform: android' \
-H 'Content-Type: application/json' \
-d '{
"rating": -1,
"feedback": "Not accurate"
}'
async function submitFeedback(
messageId: string,
rating: 1 | -1,
feedback?: string
) {
const response = await fetch(
`/api/v1/user/messages/${messageId}/feedback`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ rating, feedback }),
}
);
return await response.json();
}
// Like a message
await submitFeedback('507f1f77bcf86cd799439011', 1);
// Dislike with feedback
await submitFeedback('507f1f77bcf86cd799439011', -1, 'Incorrect calculation');
import requests
def submit_message_feedback(
message_id: str,
rating: int, # 1 or -1
feedback: str = None,
token: str = None,
device_id: str = None,
user_id: str = None,
platform: str = "web"
):
url = f"https://api.handauncle.com/api/v1/user/messages/{message_id}/feedback"
# Choose authentication method
if token:
headers = {"Authorization": f"Bearer {token}"}
elif device_id:
headers = {
"x-device-id": device_id,
"x-user-id": user_id,
"x-platform": platform
}
else:
raise ValueError("Provide either token or device_id")
headers["Content-Type"] = "application/json"
payload = {"rating": rating}
if feedback:
payload["feedback"] = feedback
response = requests.post(url, json=payload, headers=headers)
return response.json()
# Registered user
submit_message_feedback("507f1f77bcf86cd799439011", 1, "Helpful!", token="...")
# Guest user
submit_message_feedback(
"507f1f77bcf86cd799439011",
-1,
"Wrong answer",
device_id="device-123",
user_id="user-456"
)
Error Responses
400 Bad Request - Invalid Rating
{
"success": false,
"error": {
"message": "rating: Rating must be 1 (like) or -1 (dislike)",
"code": "VALIDATION_ERROR"
}
}
401 Unauthorized - Missing Authentication
{
"success": false,
"error": {
"message": "Missing authentication. Provide either Authorization header or x-device-id header.",
"code": "UNAUTHORIZED"
}
}
403 Forbidden - Wrong User
{
"success": false,
"error": {
"message": "You do not have access to this message",
"code": "FORBIDDEN"
}
}
404 Not Found - Message Doesnβt Exist
{
"success": false,
"error": {
"message": "Message not found",
"code": "NOT_FOUND"
}
}
Validation Rules
ratingmust be exactly1or-1(no other values accepted)feedbackis optional but limited to 1000 charactersmessageIdmust be a valid 24-character MongoDB ObjectId- User must own the conversation containing the message
Notes
- Idempotent: Submitting feedback multiple times overwrites previous feedback
- Guest support: Same authentication pattern as chat API for seamless trial experience
- Privacy: Only the message owner can submit feedback
- Analytics: Feedback data can be used to improve AI model performance
- No removal: Once submitted, feedback can only be updated (not deleted)
Related Endpoints
- List Messages - Get messages to display feedback UI
- Chat - Create messages that can receive feedback
- Get Conversation - View conversation metadata
Authorizations
bearerAuthdeviceAuth
Auth0 access token for registered users.
Path Parameters
MongoDB ObjectId of the message to rate
Pattern:
^[a-f0-9]{24}$Example:
"507f1f77bcf86cd799439011"
Body
application/json