Skip to main content

Overview

Call track_feedback when a user reacts to an agent response. The messageId / message_id links the feedback directly to the agent_responses row, so you can correlate user sentiment with the model, prompt version, and cost of each specific turn. At least one of satisfaction / rating / feedback must be provided. You can pass any combination of the three in a single call.

Required fields

Node.js / Python SDK: distinctId / distinct_id is also required. Browser SDK: optional if the user has already called Trodo.identify() in the session.
Field (Node / Browser)Field (Python)TypeDescription
agentIdagent_idstringThe registered agent ID — e.g. 'agt_abc12345'
conversationIdconversation_idstringStable ID for the conversation thread
messageIdmessage_idstringID of the message turn the user is reacting to
distinctIddistinct_idstringLinks the event to a Trodo user (required in Node/Python; optional in Browser if identify() was called)

Feedback fields

Pass at least one of the following:
Field (Node / Browser)Field (Python)TypeDescription
satisfactionsatisfaction'positive' | 'negative'Thumbs up / thumbs down reaction
ratingratingnumberNumeric score — the scale is yours (1–5, 1–10, NPS 0–10, etc.)
feedbackfeedbackstringFree-text comment from the user
timestamptimestampISO 8601 stringOverride event time

Examples

// 1. Thumbs up only
Trodo.track_feedback({
  agentId: 'agt_abc12345',
  conversationId: 'conv_9kx2m7pq',
  messageId: 'msg_01jf3t8r',
  satisfaction: 'positive',
});

// 2. Star rating only
Trodo.track_feedback({
  agentId: 'agt_abc12345',
  conversationId: 'conv_9kx2m7pq',
  messageId: 'msg_01jf3t8r',
  rating: 4,
});

// 3. Text feedback only
Trodo.track_feedback({
  agentId: 'agt_abc12345',
  conversationId: 'conv_9kx2m7pq',
  messageId: 'msg_01jf3t8r',
  feedback: 'The answer was correct but a bit hard to follow.',
});

// 4. Combined — thumbs up, 5-star rating, and a comment
Trodo.track_feedback({
  agentId: 'agt_abc12345',
  conversationId: 'conv_9kx2m7pq',
  messageId: 'msg_01jf3t8r',
  satisfaction: 'positive',
  rating: 5,
  feedback: 'Exactly what I needed — found my invoice in seconds.',
});