To reply a particular message. You can call message creation method from AmityMessageRepository and inject the parentId.
funcreplyMessageExample() {// Create a reply message.// A `parentId` is the message id you are replying to.let newMessage = messageRepository.createTextMessage(withChannelId:"channel-123", text:"Hello Amity!!", tags:nil, parentId:"message-123") { message, error in// Handle message creation result. }}
When replying to a message, you can observe the message with specific channelId, force the filterByParentId to true, and inject the parentId of the message.
funcqueryReplyMessagesExample(){// A query for children messages belongs to the parentId.// Please note that `parentId` is requred, along with `filterByParentId` must be true.let childrenMessagesCollection = messageRepository.getMessages(channelId:"channel-123", includingTags: [], excludingTags: [], filterByParentId:true, parentId:"message-123", reverse:false) token = childrenMessagesCollection.observe { collection, change, error infor message in collection.allObjects() {// For example, to handle each message in the list. } }}