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
- Create an instance of the CheckDMStatusRequest class using its builder methods.
- Call the
checkDMStatus()
method in theLMChatClient
class, passing the constructed request object. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
requestFrom | String | ID of the sender | |
uuid | String | ID of the receiver | ✔️ |
chatroomId | String | ID of the ChatroomId | ✔️ |
CheckDMStatusResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
showDM | Bool | Indicates whether Direct Messaging (DM) is shown | ✔️ |
cta | String | Call-to-action text associated with the DM status | ✔️ |