You are currently viewing Post feedback for SUSI Skills in SUSI.AI Android App

Post feedback for SUSI Skills in SUSI.AI Android App

Feedback from users is one of the most important aspect of software development. This helps developers collect data about the bugs that need to be fixed and the improvements that need to be done in a software. This also provides them with an insight into what needs to be done for the long term sustainability of the app.

SUSI.AI Android, web and iOS clients allow user to rate the SUSI Skills allow the user to post feedback about a skill. Users can send their invaluable feedback about how helpful a skill is for them and how could it be improved. This blog focuses on the implementation of the feature to post feedback from the SUSI.AI Android client.

Steps to post feedback

  1. Log into the app. You will see the Chat Activity once you are logged into the app.
  2. Tap the FAB on the upper right corner of the Chat Activity.
  3. You will see the list of all skills.
  4. Tap on any skill of your choice.
  5. Write feedback about SUSI skill

Click on POST button to post the skill feedback. A toast, with the message “Skill feedback updated”, will appear at the bottom of the screen.

Note : An anonymous user cannot submit feedback for the skill. You must be logged-in in order to post feedback. If you are not logged-in, the post feedback section would not be visible. Instead you will see a text message saying “Please login to post feedback”.

Implementation of post skill feedback feature

Case 1 : The user is logged in i.e. the access token is not null.

This is how the post feedback UI looks like, when the user is logged in :

Now, add the following code inside a service to make a post request to feedbackSkill.json API.

    * Post feedback given by the user for the skill to the server
    * @param model    Model of the skill (e.g. general)
    * @param group    Group of skill (e.g. Knowledge)
    * @param language Language directory in which the skill resides (e.g. en)
    * @param skill    Skill Tag of object in which the skill data resides
    * @param feedback Feedback to be sent to the server
    * @return the call
   Call<PostSkillFeedbackResponse> postFeedback(
                           @Query("model") String model,
                           @Query("group") String group,
                           @Query("language") String language,
                           @Query("skill") String skill,
                           @Query("feedback") String feedback);


Further, attach an OnClickListener with the POST button and call the postFeedback() present in the presenter layer, as can be seen in the following code :

* Set up the feedback section
* If the user is logged in, show the post feedback section otherwise display an appropriate message
private fun setFeedback() {
   if (PrefManager.getToken() != null) {
       tvPostFeedbackDesc.visibility = View.VISIBLE
       layoutPostFeedback.visibility = View.VISIBLE
       buttonPost.setOnClickListener {
           if (etFeedback.text.toString().isNotEmpty()) {
               skillDetailsPresenter.postFeedback(skillData.model,, skillData.language,
                       skillTag, etFeedback.text.toString())
           } else {
               Toast.makeText(context, getString(R.string.toast_empty_feedback), Toast.LENGTH_SHORT).show()
   } else {
       tvAnonymousPostFeedback.visibility = View.VISIBLE


The postFeedback() in the presenter will now invoke the postFeedback() method present in the model as follows :

skillDetailsModel.postFeedback(model, group, language, skill, feedback, this)


Here is how the postFeedback() method in the model looks like :

override fun postFeedback(model: String, group: String, language: String, skill: String, feedback: String, listener: ISkillDetailsModel.OnUpdateFeedbackFinishedListener) {

       updateFeedbackResponseCall = ClientBuilder().susiApi.postFeedback(model, group, language, skill, feedback)

       updateFeedbackResponseCall.enqueue(object : Callback<PostSkillFeedbackResponse> {
           override fun onResponse(call: Call<PostSkillFeedbackResponse>, response: Response<PostSkillFeedbackResponse>) {

           override fun onFailure(call: Call<PostSkillFeedbackResponse>, t: Throwable) {


Once the call is made successfully to the server, the next step is to update the UI. This is achieved with the help of the onUpdateFeedbackModelSuccess() called above, if the response is received.

override fun onUpdateFeedbackModelSuccess(response: Response<PostSkillFeedbackResponse>) {
       if (response.isSuccessful && response.body() != null) {
       } else {
           Timber.d("Could not update feedback")


Clearly, if the response is successful and the response body is non-null, it implies that the feedback submitted by the user has been successfully updated on the server. Thus, we display a toast to notify the user of the successful submission of the feedback. This is achieved with the help of the updateFeedback() method in the view, as follows :

override fun updateFeedback() {
   Toast.makeText(context, getString(R.string.toast_feedback_updated), Toast.LENGTH_SHORT).show()


Note : The response from the server to the above post request would be similar to the one shown below :

  feedback: "Helpful",
  accepted: true,
  message: "Skill feedback updated"

Case 2 : The user is not logged in.

In this case simply display a text message saying “Please login to post feedback”.

This is how the post feedback feature has been implemented in SUSI.AI Android App.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.