The Magic
🎯 Just Enable the Buttons
With clientToken mode, simply set showUpvote: true
and showDownvote: true. The SDK handles sending feedback to
your backend automatically!
❌ Without Client Token (Manual)
More Code
messageActions: {
showUpvote: true,
showDownvote: true,
// You must implement this yourself:
onFeedback: async (feedback) => {
await fetch('/api/feedback', {
method: 'POST',
body: JSON.stringify({
type: feedback.type,
messageId: feedback.messageId,
})
});
}
}
✅ With Client Token (Automatic)
That's It!
clientToken: 'ct_live_...',
messageActions: {
showUpvote: true,
showDownvote: true,
// That's it! Feedback is sent automatically.
// onFeedback is optional for extra handling.
}
-
Upvote/Downvote – Automatically POSTs to
/v1/client/feedback - Copy – Copy events are tracked too, helping you understand engagement
-
Optional Override – Add
onFeedbackcallback for additional local handling - Session Aware – Feedback includes session ID for proper attribution
Try It
Enter a client token to begin
API Requests (feedback)
Feedback requests will appear here when you upvote, downvote, or copy messages.