Unread messages counter problem on all plaforms

Hello,

We noticed during this last couple of days some changes when it comes to the unread messages count functionality on all platforms. More specifically, in the past the missed calls were counted as unread messages (to be exact, each missed call was counted as 2 unread messages) but as of today the missed calls are not added to the unread message count any more.
As an example - up until some days ago: if user 1 sent a text message to user 2 via chat, then attempted to call user 2 but cancelled because no one was picking up, when user 2 entered the app the number of unread messages was 3.

Yesterday we noticed that in the Ionic app (Ionic SDK) the calls were no longer counted as unread messages. So for our specific case: user 1 sent a text message to user 2 via chat, then attempted to call user 2 but cancelled because no one was picking up, when user 2 entered the app the number of unread messages is now 1. (when doing additional test we noticed that the calls were just ignored, so if you had 3 unread messages and 2 missed calls the final number is now 3)

In our Angular 1 app, we use the API to determine the unread message count and in the API yesterday the calls were still counted as unread, as a result we updated the Ionic App to use the API as well. But today the calls are no longer counted in the API either.

In the documentation we could not find any notes on the updates: where can we find notes about changes being done and also a detailed explanation about how the unread message number is being calculated (the last time we figured out through multiple tests that the calls are counted as 2 unread messages)? Also is there a way in which we can correctly retrieve the unread message count: more specifically to count missed messages and missed calls as well?

Best,
Mihaela

Hello @MihaelaCazan,

I will get this checked on our end and get back to you. I have a couple of questions for you.

  • Is the issue specific to any SDK version? Also, can you please let me know which version of the Ionic & JS SDK you are using? ​

In our Angular 1 app, we use the API to determine the unread message count

  • Can you please share the exact API endpoint you are using?

Yesterday we noticed that in the Ionic app (Ionic SDK) the calls were no longer counted as unread messages.

  • Can you please let us know how you are fetching the unread message count?

Warm Regards,

CometChat Pro
Mayur Bhandari

Hello @mayur.bhandari ,

Is the issue specific to any SDK version? Also, can you please let me know which version of the Ionic & JS SDK you are using? ​

We noticed the missing calls issue in the Ionic SDK first (2 days ago) and today we noticed it in the API as well.
For the Ionic app we are using the following:
@cometchat-pro/cordova-ionic-chat”: “^2.1.1”,
@cometchat-pro/ionic-calls”: “0.0.6”,
For the Angular 1 app we are using the following:
https://unpkg.com/@cometchat-pro/chat@2.2.1/CometChat.js

Can you please share the exact API endpoint you are using?

This is the endpoint that we used for both the Web and the Ionic App (after the update):
https://api-us.cometchat.io/v2.0/users/” + CometChatUIdForLoggedInUser + “/messages?unread=true”);

Can you please let us know how you are fetching the unread message count?

For the Ionic SDK we were using the following when we first noted the issue:

getUnreadMessages() {
    CometChat.getUnreadMessageCountForAllUsers().then((array) => {
      const unread = Object.keys(array);
      if (unread.length > 0) {
        unread.map((uid) => {
          const index = this.contactUsers.findIndex((user) => user.uid === uid);
          if (index !== -1) {
            this.contactUsers[index].unreadCount = array[uid];
          }
        });
      }
    });
  }

For the Web App (Angular 1 app that uses the JS SDK) we used the following:

$scope.GetUnreadMessagesApiChat = function (appId, apiKey) {
    try {
        var data = null;
        var xhr = new XMLHttpRequest();
        xhr.addEventListener(“readystatechange”, function () {
            if (this.readyState === this.DONE) {
                var messages = JSON.parse(this.response).data;
                if (messages.length > 0) {
                    for (var i = 0; i < $scope.users.length; i++) {
                        $scope.users[i].numberOfUnreadMessages = $.grep(messages, function (e) {
                            return e.type != “groupMember” &&
                            /e.data.action != “initiated” &&/ e.data.action != “ongoing” &&
                            ((e.receiverType != ‘group’ && e.sender == $scope.users[i].uid) ||
                            (e.receiverType == ‘group’ && $scope.users[i].guid != null && e.receiver == $scope.users[i].guid))
                        }).length;
                        $scope.users[i].numberOfUnreadMessagesWithInitiatedCalls = $.grep(messages, function (e) {
                            return e.type != “groupMember” &&
                            e.data.action != “ongoing” &&
                            ((e.receiverType != ‘group’ && e.sender == $scope.users[i].uid) ||
                            (e.receiverType == ‘group’ && $scope.users[i].guid != null && e.receiver == $scope.users[i].guid))
                        }).length;
                    }
                }
                $scope.dataLoadingStep = 3;
                $scope.dataLoaded = true;
                $scope.removeLoadingIndicator(‘mainElemenet’);
                $scope.$apply(); $scope.$digest();
            }
        });
        xhr.open(“GET”, “https://api-us.cometchat.io/v2.0/users/” + sessvars.CometChatUId + “/messages?unread=true”);
        xhr.setRequestHeader(“appid”, appId);
        xhr.setRequestHeader(“apikey”, apiKey);
        xhr.setRequestHeader(“content-type”, “application/json”);
        xhr.setRequestHeader(“accept”, “application/json”);
        xhr.send(data);
    }
    catch (ex) {
        console.log(ex);
    }
}

Best,
Mihaela

Hello @mayur.bhandari ,

Do you have any updates for us?

Best,
Mihaela

Hello @mayur.bhandari ,

Do you have any updates for us?

Best,
Mihaela

Hello @MihaelaCazan,

Sorry for the delay. I checked with the team internally and it was considered a bug that unread message count included missed calls incorrectly in the count. And thus accordingly this bug was resolved. Unfortunately, this update was missed by our marketing team and no update was sent. However, you can view all future updates here.

Warm Regards,

CometChat Pro
Mayur Bhandari

Hello @mayur.bhandari ,

Thank you for the update, we did some initial testing and indeed the unread message count seems to have reverted to a point that suits our needs.

Thank you,
Mihaela

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.