Links
Comment on page

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.
chat.onTypingStarted((user) => {
//do something when a user starts typing
})
Response
Field
Type
Description
user
User
the user that started typing

Listen for typing stopped

This is called whenever a participant of the conversation stops typing.
chat.onTypingStopped((user) => {
//do something when a user stops typing
})
Response
Field
Type
Description
user
User
the user that stopped typing

Functions

Get ID

Get the id of the conversation, returns a string
const id = chat.getId()

Get Title

Get the title of the conversation, returns a string
const title = chat.getTitle()

Get Conversation Avatar

Get the avatar of the chat, returns a string which is the url to the avatar
const avatar = chat.getChatAvatar()

Get recent message

Get the most recent message sent in the conversation. Returns a Message object.
const message = chat.getLastMessage()

Get Members

Get an array of all the users of this conversation
const users = await chat.getMembers()

Get MemberIds

Get an array of ids of all the members of this conversation
const userIds = await chat.getMemberIds()

Notify everyone typing started

Call this function to notify everyone who is a participant of the conversation that the current user has started typing
chat.startTyping()

Notify everyone typing stopped

Call this function to notify everyone who is a participant of the conversation that the current user has stopped typing
chat.stopTyping()
Last modified 2mo ago