Skip to main content

Check DM Status

The LikeMinds iOS SDK provides functionality to check the status of a direct message (DM). This guide outlines how to use the CheckDMStatusRequest and CheckDMStatusResponse classes to verify whether a DM is available and retrieve related metadata.

Steps to Check DM Status​

  1. Create an instance of the CheckDMStatusRequest class using its builder methods.
  2. Call the checkDMStatus() method in the LMChatClient class, passing the constructed request object.
  3. Process the LMResponse<CheckDMStatusResponse> response to access the DM status and CTA (Call-To-Action) information.
let request = CheckDMStatusRequest.builder()
.requestFrom("REQUEST_FROM") // Context of the request
.uuid("USER_UUID") // Unique identifier of the user
.chatroomId("CHATROOM_ID") // Optional chatroom ID
.build()

LMChatClient.shared.checkDMStatus(request: request) { response in
if let status = response?.data {
if status.showDM == true {
print("DM is available. CTA: \(status.cta ?? "N/A")")
} else {
print("DM is not available.")
}
} else {
print("Error checking DM status: \(response?.error?.localizedDescription ?? "Unknown error")")
}
}

Models​

CheckDMStatusRequest​

VARIABLETYPEDESCRIPTIONOPTIONAL
requestFromStringID of the sender
uuidStringID of the receiver✔️
chatroomIdStringID of the ChatroomId✔️

CheckDMStatusResponse​

VARIABLETYPEDESCRIPTIONOPTIONAL
showDMBoolIndicates whether Direct Messaging (DM) is shown✔️
ctaStringCall-to-action text associated with the DM status✔️