chat class deleteMessages and postNewMessage functions