Chat Room

You can use the methods from the TapCoreChatRoomManager class to manage chat rooms.

Method Name

Description

Create new personal chat room with recipient user, or obtain chat room data if it already exists.

Create new personal chat room with recipient user ID, or obtain chat room data if it already exists.

Create new personal chat room with recipient XC user ID, or obtain chat room data if it already exists.

Create a new group chat room with selected group name.

Create a new group chat room with selected group name and group picture.

Get group room data from selected group room ID.

Update existing group chat room data.

Update group picture with current selected image.

Delete group chat room and clear all chat data and participants.

Leave from selected group chat.

Add selected member(s) to current group chat room.

Remove selected member(s) from current group chat room.

Promote selected member(s) as admin(s) to the current group chat room.

Demote selected admin(s) to member(s) to the current group chat room.

Notify that the active user has started typing in the selected room.

Notify that the active user has stopped typing in the selected room.

Retrieve existing media messages from a chat room

Mark a chat room as unread by the active user.

Get a list of chat rooms marked as unread by the active user.

Clear all existing messages in a selected chat room for the active user.

Get Personal Chat Room with Recipient User Model

Create new personal chat room with recipient user, or obtain chat room data if it already exists.

var roomModel = tapCoreChatRoomManager.createRoomWithOtherUser(RECIPIENT_USER)

Parameters

RECIPIENT_USER: (TAPUserModel) recipient user data

Get Personal Chat Room with Recipient User ID

Create new personal chat room with recipient user ID, or obtain chat room data if it already exists.

tapCoreChatRoomManager.createRoomWithuserID(RECIPIENT_ID, (roomModel) => {
   // do action here
})

Parameters

RECIPIENT_ID: (String) user ID of recipient

Get Personal Chat Room with Recipient XC User ID

Create new personal chat room with recipient user ID, or obtain chat room data if it already exists.

tapCoreChatRoomManager.createRoomWithXCuserID(XC_USER_ID, (roomModel) => {
   // do action here
})

Parameters

XC_USER_ID: (String) XC user ID of recipient

Create Group Chat Room

Create a new group chat room with selected group name.

tapCoreChatRoomManager.createGroupChatRoom(GROUP_NAME, PARTICIPANT_LIST, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_NAME: (String) your group name PARTICIPANT_LIST: (List) list of the group participant's user IDs

Create Group Chat Room With Group Image

Create a new group chat room with selected group name and group picture.

tapCoreChatRoomManager.createGroupChatRoomWithPicture(GROUP_NAME, PARTICIPANT_LIST, IMAGE_FILE, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_NAME: (String) name of the group chat room to create PARTICIPANT_LIST: (List) list of the group participant's user IDs IMAGE_FILE: (File) picture to be uploaded as the group's profile

Get Group Chat Room

Get group room data from selected group room ID.

tapCoreChatRoomManager.getGroupChatRoom(GROUP_ID, {
      onSuccess : (response) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of group

Update Group Chat Room Details

Create a new Update existing group chat room data.

tapCoreChatRoomManager.updateGroupChatRoomDetails(GROUP_ID, GROUP_NAME, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of group GROUP_NAME: (String) name of group

Update Group Image

Update group picture with current selected image.

tapCoreChatRoomManager.updateGroupPicture(GROUP_ID, IMAGE_FILE, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of the selected group IMAGE_FILE: (File) new picture for the group's profile

Delete Group Chat Room

Delete group chat room and clear all chat data and participants.

tapCoreChatRoomManager.deleteGroupChatRoom(ROOM_ID, {
      onSuccess : (response) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters ROOM_ID: (String) a room id of the group to delete

Leave Group Chat

Leave from selected group chat.

tapCoreChatRoomManager.leaveGroupChatRoom(GROUP_ID, {
      onSuccess : (isSuccess, responseMessage) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of the selected group

Add Members to Group Chat

Add selected member(s) to current group chat room.

tapCoreChatRoomManager.addGroupChatMembers(GROUP_ID, USER_IDs, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of the selected group USER_IDs: (List) list of the user IDs to add to the group

Remove Members from Group Chat

Remove selected member(s) from current group chat room.

tapCoreChatRoomManager.removeGroupChatMembers : (GROUP_ID, USER_IDs, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of the selected group USER_IDs: (List) list of the user IDs to add to the group

Promote Group Admin

Promote selected member(s) as admin(s) to the current group chat room.

tapCoreChatRoomManager.promoteGroupAdmins(GROUP_ID, USER_IDs, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of the selected group USER_IDs: (List) list of the user IDs to add to the group

Demote Group Admin

Demote selected admin(s) to member(s) to the current group chat room.

tapCoreChatRoomManager.demoteGroupAdmins(GROUP_ID, USER_IDs, {
      onSuccess : (roomModel) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Parameters GROUP_ID: (String) room ID of the selected group USER_IDs: (List) list of the user IDs to add to the group

Send Start Typing

Notify that the active user has started typing in the selected room.

tapCoreChatRoomManager.sendStartTypingEmit(roomID)

Parameters

ROOM_ID: (String) ID of the room where the user starts typing in

Send Stop Typing

Notify that the active user has stopped typing in the selected room.

tapCoreChatRoomManager.sendStopTypingEmit(roomID)

Get Room Media

tapCoreChatRoomManager.getRoomMedia(ROOM_ID, {
     onSuccess: (response) => {
             //do action here
     },
     onError: (errorCode, errorMessage) => {
            // do action here
     }
 }, minCreated = 0)

Parameters ROOM_ID: (String) Group ID MIN_CREATED: (Long) Minimum Created Time in Millisecond. Leave empty if unnecessary

Mark Chat Room as Unread

You can mark your chat room as unread.

tapCoreChatRoomManager.markChatRoomAsUnread(ROOM_ID, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

ROOM_ID: (Number) room id CALLBACK: (Object) object of callback methods

Get Marked as Unread Chat Room List

You can retrieve unread room list.

tapCoreChatRoomManager.getMarkedAsUnreadChatRoomList({
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

CALLBACK: (Object) object of callback methods

Delete All Chat Room Messages

Use the deleteAllChatRoomMessages: method from the TapCoreChatRoomManager class to clear all existing messages in a selected chat room for the active user. The selected messages will only be deleted for the active user, and will not affect the other participants in the selected room.

tapCoreChatRoomManager.deleteAllChatRoomMessages(ROOM_IDS, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (err) => {
        // do action here
    }
})

ROOM_IDS: (Array<Number>) IDs of the target rooms to delete the messages from

Get Group In Common

You can retrieve group in common list.

tapCoreChatRoomManager.fetchGroupInCommon(USER_ID, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

USER_ID: (Number) user id CALLBACK: (Object) object of callback methods

Last updated

#621:

Change request updated