Skip to main content

Send DM Request

Sends a direct message request to another user. This function allows users to initiate or continue a direct message conversation by sending a message or updating the chat request state.

Steps to send a DM request

  1. Create a SendDMRequest object using SendDMRequest.builder() class by passing all the required parameters.
  2. Call sendDMRequest() function using the instance of LMChatClient.
  3. Process the response LMResponse<SendDMResponse> as per your requirement.
let request = SendDMRequest.builder()
.chatRequestState(1)
.text("YOUR_TEXT")
.chatroomId("ENTER_CHATROOM_ID")
.build()

LMChatClient.shared.sendDMRequest(request: request) { response in
if let data = response.data {
// Process the send DM response
processSendDMResponse(data)
} else if let error = response.error {
// Handle the error
handleError(error)
}
}

Models

SendDMRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
chatRequestStateInt?The state of the chat request✔️
textString?The message text to be sent✔️
chatroomIdString?ID of the chatroom where the message is to be sent✔️

SendDMResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
conversationConversation?Information about the updated conversation✔️