Skip to main content

Send DM Request

The sendDMRequest() method is used to send a direct message (DM) request. You can pass parameters such as chatroomId, chatRequestState, and text.

Steps to Send a DM Request

  1. Create a SendDMRequest object with the required parameters: chatroomId, chatRequestState, and text.
  2. Call the sendDMRequest() function using the instance of the LMChatClient class.
  3. Use the response LMResponse<SendDMResponse> to fetch details about the conversation after sending the DM request.
SendDMRequest request = (SendDMRequestBuilder()
..chatroomId("ENTER_CHATROOM_ID") // Provide the chatroom ID
..chatRequestState(1) // Provide the request state (e.g., 1 for sending)
..text("ENTER_TEXT")) // Provide the message text
.build();

final LMResponse<SendDMResponse> response = await lmChatClient.sendDMRequest(request);

if (response.success) {
// Use the returned conversation details
handleConversation(response.data.conversation);
} else {
// Handle error
handleError(response);
}

Models

SendDMRequest

List of parameters for the SendDMRequest class:

VariableTypeDescriptionOptional
chatroomIdintThe ID of the chatroom where the DM request will be sent
chatRequestStateintThe state of the DM request
- 0 is for initiating
- 1 for accepting
- 2 for rejecting
textStringThe message text to be sent in the DM request

SendDMResponse

List of parameters for the SendDMResponse class:

VariableTypeDescriptionOptional
conversationConversationThe updated conversation after sending the DM request✔️