Conversation (Chat)
A conversation(chat) object lets you have conversations with 1 or more Users.
You can view how a chat object can be created for a one-to-one conversation or a group chat with multiple members.
Event Listeners
Listen for typing started
This is called whenever a participant of the conversation starts typing.
Response
user
the user that started typing
Listen for typing stopped
This is called whenever a participant of the conversation stops typing.
Response
user
the user that stopped typing
Listen for user status changes (online/offline)
This is called whenever the status of a user in a conversation changes from online to offline or vice versa.
Response
memberId
string
the id of the user who's status has changed
status
enum
the status of the user. an enum of either ONLINE
or OFFLINE
Functions
Get ID
Get the id of the conversation, returns a string
Get Title
Get the title of the conversation, returns a string
Get Conversation Avatar
Get the avatar of the chat, returns a string
which is the url to the avatar
Get recent message
Get the most recent message sent in the conversation. Returns a Message
object.
Get Members
Get an array of all the users of this conversation
Get MemberIds
Get an array of ids of all the members of this conversation
Get Metadata
get an optional key value pair for any additional chat information.
Set Metadata
Add any additional chat information.
Parameters
metadata
json object
required
an optional key value pair for any additional chat information. Accepts string, number and boolean values
Add member to group chat
Add a member to a group chat
Add member to group chat by ID
add a member to a group chat using a member ID
Remove member from group chat
Remove a member from a group chat
Remove member from group chat by ID
Remove a member from a group chat using a member ID
Notify everyone typing started
Call this function to notify everyone who is a participant of the conversation that the current user has started typing
Notify everyone typing stopped
Call this function to notify everyone who is a participant of the conversation that the current user has stopped typing
Set Message Seen
Call this function to notify participants of the conversation that a message has been seen. (useful when handling message seen states).
Parameters
messageId
string
optional
the id of the message. If left null or undefined then the last message in the conversation is set as seen by the connected user.
Last updated