AI Chatbot Guide v1
AI Chatbot
Version 1

Feedback

Copy link

The feedback feature enables users to rate the quality of the bot's responses using a simple UI, which includes a thumbs up for positive feedback and a thumbs down for negative feedback. Users also have the option to provide written comments, offering more context or specific insights about their feedback. This feature is crucial in enhancing the bot's performance, as it relies on user input to refine and improve future interactions. It's important to note that only the user who provided feedback can see it. Additionally, feedback can be submitted for the bot's responses, but not for the welcome message.


Draw the feedback UI

Copy link

You can draw and adjust the UI based on feedback status by following the code below.

  • Not applicable: This message is not eligible for feedback, possibly because it's not a bot response or it's the welcome message.
  • No feedback: The user has the option to provide feedback but hasn't done so yet.
  • Submitted: Feedback has already been submitted for this message.
AndroidiOSJavaScript
val feedback = message.myFeedback
when (message.myFeedbackStatus) {
    FeedbackStatus.NOT_APPLICABLE -> {
        // Users can't give feedback on this message (e.g., welcome message or not a bot response).
        // Make thumbs-up/down UI invisible or disable here.
        // `feedback` should be null.
    }

    FeedbackStatus.NO_FEEDBACK -> {
        // Users can submit a feedback but has not submitted one yet.
        // Make thumbs-up/down UI visible or enable without being selected.
        // `feedback` should be null.
    }
    FeedbackStatus.SUBMITTED -> {
        // User submitted a feedback.
        // Make thumbs-up/down UI visible or enable as selected.
        // `feedback` should not be null.
    }
}

Submit a feedback

Copy link

You can submit a feedback by following the code below.

AndroidiOSJavaScript
message.submitFeedback(FeedbackRating.Good) { feedback, e ->
    when {
        feedback != null -> {
            // Update feedback UI.
        }
        e != null -> {
            // Handle error.
        }
    }
}

Update a feedback

Copy link

You can update the feedback or comment by following the code below.

AndroidiOSJavaScript
message.updateFeedback(FeedbackRating.Good, "Very good response") { feedback, e ->
    when {
        feedback != null -> {
            // update feedback UI
        }
        e != null -> {
            // Handle error.
        }
    }
}

Delete a feedback

Copy link

You can delete any feedback that has been submitted. However, if no feedback has been submitted, an error is returned.

AndroidiOSJavaScript
message.deleteFeedback { e ->
    // Handle error.
}