Skip to main content

Put Reaction

Adds a reaction to a message or conversation based on the specified request. This function handles the process of adding a user’s reaction and provides a response indicating success or failure.

Steps to put a reaction

  1. Create a PutReactionRequest object by using the builder pattern.
  2. Call the putReaction() function using the instance of LMChatClient, passing the request object and an optional response handler.
  3. Process the response LMResponse<NoData> to handle the result of the reaction addition.
let request = PutReactionRequest.builder()
.conversationId("ENTER_CONVERSATION_ID")
.messageId("ENTER_MESSAGE_ID")
.reaction("ENTER_REACTION")
.build()

LMChatClient.shared.putReaction(request: request) { response in
if response?.error == nil {
// Handle success
print("Reaction added successfully.")
} else {
// Handle error
print("Error adding reaction: \(response?.error?.localizedDescription ?? "Unknown error")")
}
}

Models

PutReactionRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
conversationIdStringID of the conversation where the reaction is to be added
messageIdStringID of the message to which the reaction is to be added
reactionIdStringID of the reaction to be added