Chat APIs and In-app Messaging SDKs for Developers

Applozic provides Chat APIs and In-app Messaging SDKs for Android, iOS and Web apps to power cross-device, multi-platform rich messaging.
Find comprehensive guides and platform-specific Chat API documentation to get started with In-app Messaging.

Guides    API Explorer


Unread count details on iOS

This section would help you in getting the unread count in different scenarios. You can use this count for a lot of use cases like showing total count in the icon's badge and in a lot of different scenarios.

Individual user

To get the user's chat unread count with any user, use the below code:

ALContactService* contactService = [ALContactService new];
 ALContact *contact = [contactService loadContactByKey:@"userId" value:<userID>];
 NSNumber *unreadCount = [contact unreadCount];
let contactService = ALContactService()
let contact = contactService.loadContact(byKey: "userId", value: <userId>)
let unreadCount = contact?.unreadCount

Individual Group

To get the user's chat unread count in any group, use the below code:

ALChannelService *channelService = [ALChannelService new];
  ALChannel *alChannel = [channelService getChannelByKey:<channelKey>];
  NSNumber *unreadCount = [alChannel unreadCount];
let channelService = ALChannelService()
let channel = channelService.getChannelByKey(<channelKey>)
let unreadCount = channel?.unreadCount

Total unread messages

To get the user's total unread count i.e Users + Groups, use the below code:

ALMessageService * service = [[ALMessageService alloc] init];
[service getTotalUnreadMessageCountWithCompletionHandler:^(NSUInteger unreadCount, NSError *error) {

      if (error){
            NSLog(@"ERRROR in fetching count");

     NSLog(@"Current unread message count @ :%lu",(unsigned long)unreadCount);

Total unread conversations

To get the total unread conversations use the below method

ALMessageService * service = [[ALMessageService alloc] init];
[service getTotalUnreadConversationCountWithCompletionHandler:^(NSUInteger unreadCount, NSError *error) {

   if (error){
       NSLog(@"ERRROR in fetching getTotalUnreadConversationCountWithCompletionHandler");

    NSLog(@"Current unread conversation count is  @@ :%lu",(unsigned long)unreadCount);

Real time update of count

  • To update unread message count real time for any incoming messages, you can observe below notification with name:NEW_MESSAGE_NOTIFICATION
[[NSNotificationCenter defaultCenter] addObserver:self
                                          selector:@selector(Your handler method)
  • Stop observing notification (You can add this in -(void)viewWillDisappear)
[[NSNotificationCenter defaultCenter] removeObserver:self name:NEW_MESSAGE_NOTIFICATION object:nil];

Show badge count

To show the badge count on Application icon you need to add the below line in ALDefaultChatViewSettings method in the ALChatManager file

[ALUserDefaultsHandler setUnreadCountType:1];

Updated 13 days ago

What's Next



Unread count details on iOS

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.