Personal Chat
If you are using core implementation method, you can use the methods from the TapCoreChatRoomManager and TapCoreMessageManager class to manage personal chat room.
TapTalk Core Personal Chat Method
Description
​Get Personal Chat Room with Recipient User​
Create new personal chat room with recipient user, or obtain chat room data if it already exists.
​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.
​Get Personal Chat Room with Recipient XC User ID​
Create new personal chat room with recipient XC user ID, or obtain chat room data if it already exists.
​Start Typing​
Notify that the active user has started typing in the selected room.
​Stop Typing​
Notify that the active user has stopped typing in the selected room
​Send Text Message​
Send a new text message to the selected room.
​Send Location Message​
Send a new message with location to the selected room.
​Send Image Message​
Send a new image message to the selected room.
​Send Video Message​
Send a new video message to the selected chat room.
​Send File Message​
Send a new file message to the selected chat room.
​Send a Custom Message​
Send a new custom message to the room defined in the message model.
​Download Message File​
Start a file download from the selected file, image, or video message.
​Mark Message as Read​
Mark message as read by the active user.
​Get Older Messages from Chat Room​
Retrieve messages that are older than the provided timestamp from the server to the selected chat room.
​Get Newer Messages from Chat Room​
Retrieve newer messages from the server to the selected chat room.

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.
JavaScript
1
var roomModel = tapCoreChatRoomManager.createRoomWithOtherUser(RECIPIENT_USER)
Copied!
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.
JavaScript
1
tapCoreChatRoomManager.createRoomWithuserID(RECIPIENT_ID, (roomModel) => {
2
// do action here
3
})
Copied!
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.
JavaScript
1
tapCoreChatRoomManager.createRoomWithXCuserID(XC_USER_ID, (roomModel) => {
2
// do action here
3
})
Copied!
Parameters
XC_USER_ID: (String) XC user ID of recipient

Send Start Typing

Notify that the active user has started typing in the selected room.
JavaScript
1
tapCoreChatRoomManager.sendStartTypingEmit(roomID)
Copied!
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.
JavaScript
1
tapCoreChatRoomManager.sendStopTypingEmit(roomID)
Copied!

Send Text Message

To send a text message to a chat room, use the sendTextMessage() method from the TapCoreMessageManager class.
JavaScript
1
tapCoreMessageManager.sendTextMessage(MESSAGE_BODY, ROOM_MODEL, (message) => {
2
// do action here
3
})
Copied!
Parameters MESSAGE_BODY: (String) content of the message ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent

Send Location Message

You can send a location embedded in a chat message using sendLocationMessage(). This method takes latitude, longitude, and address text as parameters.
JavaScript
1
tapCoreMessageManager.sendLocationMessage(LATITUDE, LONGITUDE, ADDRESS, ROOM_MODEL, (message) => {
2
// do action here
3
})
Copied!
Parameters LATITUDE: (Double) latitude of the shared location LONGITUDE: (Double) longitude of the shared location ADDRESS: (String) text data containing the location address ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent

Send Image Message

To send an image to a chat room, you can use sendImageMessage() method by providing either file parameter.
JavaScript
1
tapCoreMessageManager.sendImageMessage(FILE, CAPTION, ROOM_MODEL, {
2
onStart: (messageModel) => {
3
// do action here
4
},
5
6
onProgress: (localID, percentage, bytes) => {
7
// do action here
8
},
9
10
onSuccess: (messageModel) => {
11
// do action here
12
},
13
14
onError: (errorCode, errorMessage) => {
15
// do action here
16
}
17
})
Copied!
Parameters FILE: (Uri) local Uri of the image file CAPTION: (String) caption for the image ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent

Send Video Message

To send a video to a chat room, you can use sendVideoMessage() method by providing the FILE.
JavaScript
1
tapCoreMessageManager.sendVideoMessage(file, caption, ROOM_MODEL, {
2
onStart: (messageModel) => {
3
// do action here
4
},
5
6
onProgress: (localID, percentage, bytes) => {
7
// do action here
8
},
9
10
onSuccess: (messageModel) => {
11
// do action here
12
},
13
14
onError: (errorCode, errorMessage) => {
15
// do action here
16
}
17
})
Copied!
Parameters FILE: (Uri) local Uri of the video file CAPTION: (String) caption for the video ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent

Send File Message

You can also send a file to a chat room using the sendFileMessage() method with a provided FILE.
JavaScript
1
tapCoreMessageManager.sendFileMessage(FILE, ROOM_MODEL, {
2
onStart: (messageModel) => {
3
// do action here
4
},
5
6
onProgress: (localID, percentage, bytes) => {
7
// do action here
8
},
9
10
onSuccess: (messageModel) => {
11
// do action here
12
},
13
14
onError: (errorCode, errorMessage) => {
15
// do action here
16
}
17
})
Copied!
Parameters FILE: (Uri) local Uri of the video file ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent

Send a Forward Message without MessageBody

To send a forward message without messageBody, call the checkAndSendForwardedMessage() method with the forward message object as a parameter
JavaScript
1
tapCoreMessageManager.checkAndSendForwardedMessage(ROOM_MODEL, CALLBACK, FORWARD_MESSAGE) {
2
// do action here
3
})
Copied!
Parameters ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent CALLBACK: (Function) callback method after sending message FORWARD_MESSAGE: (HashMap<String, Object>) custom data for the forward message

Send a Custom Message

To send a custom message that you just created above, call the sendCustomMessage() method with the custom message as a parameter.
JavaScript
1
tapCoreMessageManager.sendCustomMessage(MESSAGE_BODY, MESSAGE_DATA, MESSAGE_TYPE, ROOM_MODEL, (message) => {
2
// do action here
3
})
Copied!
Parameters MESSAGE_BODY: (String) content of the message ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent MESSAGE_TYPE: (Integer) type of your custom message, check the Message Type page for more information MESSAGE_DATA: (HashMap<String, Object>) custom data for the message (optional)

Download Message File

To start a file download from a File, Image, or Video message, you can use the downloadMessageFile() method.
JavaScript
1
tapCoreChatRoomManager.downloadMessageFile(messageModel, {
2
onSuccess : (response) => {
3
// do action here
4
},
5
onError: (errorCode, errorMessage) => {
6
// do action here
7
}
8
})
Copied!
Parameters
MESSAGE: (TAPMessageModel) pending message with ongoing file upload

Mark Message as Read

To manually mark a message as read, call the markMessageAsRead() method.
JavaScript
1
tapCoreMessageManager.markMessageAsRead(ARRAY_OF_MESSAGE_ID)
Copied!
Parameters
ARRAY_OF_MESSAGE_ID: (TAPMessageModel) existing message to be marked as read

Mark Message as Delivered

To manually mark a message as delivered, call the markMessageAsDelivered() method.
JavaScript
1
tapCoreMessageManager.markMessageAsDelivered(ARRAY_OF_MESSAGE_ID)
Copied!
Parameters
ARRAY_OF_MESSAGE_ID: (TAPMessageModel) existing message to be marked as read

Get Older Messages from Chat Room

To retrieve older messages in a chat room from the server, use the getOlderMessagesBeforeTimestamp() method.
JavaScript
1
tapCoreMessageManager.getOlderMessagesBeforeTimestamp(ROOM_ID, NUMBER_OF_ITEMS, {
2
onSuccess: (messages, hasMore) => {
3
// do action here
4
},
5
onError: (errorCode, errorMessage) => {
6
// do action here
7
}
8
})
Copied!

Get Newer Messages from Chat Room

To retrieve newer messages in a chat room from the server, use the getNewerMessagesAfterTimestamp() method.
JavaScript
1
tapCoreMessageManager.getNewerMessagesAfterTimestamp(ROOM_ID, {
2
onSuccess: (messages) => {
3
// do action here
4
},
5
onError: (errorCode, errorMessage) => {
6
// do action here
7
}
8
})
Copied!

Get Current Chat in Room

To retrieve chat in current room, use getCurrentChatInRoom
JavaScript
1
tapCoreChatRoomManager.getCurrentChatInRoom(roomID)
Copied!

Get Room Media

JavaScript
1
tapCoreChatRoomManager.getRoomMedia(ROOM_ID, {
2
onSuccess: (response) => {
3
//do action here
4
},
5
onError: (errorCode, errorMessage) => {
6
// do action here
7
}
8
}, minCreated = 0)
Copied!
Parameters ROOM_ID: (String) Room ID MIN_CREATED: (Long) Minimum Created Time in Millisecond. Leave empty if unnecessary

Send Voice Message

To send a voice message to a chat room, use the sendVoiceMessage() method from the TapCoreMessageManager class.
JavaScript
1
tapCoreMessageManager.sendVoiceMessage(FILE, DURATION, ROOM_MODEL, (message) => {
2
// do action here
3
}, QUOTED_MESSAGE, FORWARD_MESSAGE)
Copied!
Parameters FILE: (Object) audio file object DURATION: (Number) audio file duration in millisecond ROOM_MODEL: (Object) the destination room where the message will be sent CALLBACK: (Method) callback method QUOTED_MESSAGE: (Object) message model of reply message FORWARD_MESSAGE: (Object) message model of forward message
ROOM_MODEL: (TAPRoomModel) the destination room where the message will be sent
Last modified 1mo ago