Skip to main content

Create DM Chatroom

Creates a new direct message chatroom between two users. This function allows the initiation of a private conversation space for direct messaging.

Steps to create a DM chatroom

  1. Create a CreateDMChatroomRequest object using CreateDMChatroomRequest.builder() class by passing all the required parameters.
  2. Call createDMChatroom() function using the instance of LMChatClient.
  3. Process the response LMResponse<CheckDMChatroomResponse> as per your requirement.
let request = CreateDMChatroomRequest.builder()
.uuid("ENTER_UUID")
.memberId("ENTER_MEMBER_ID")
.build()

LMChatClient.shared.createDMChatroom(request: request) { response in
if let data = response.data {
// Process the created DM chatroom data
processCreatedDMChatroom(data)
} else if let error = response.error {
// Handle the error
handleError(error)
}
}

Models

CreateDMChatroomRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
uuidString?Unique identifier for the chatroom✔️
memberIdInt?ID of the member to create the chatroom with✔️

CheckDMChatroomResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
chatroomDataChatroom?created chatroom data✔️