Update a Message

Last Edit: Feb 02 2020

You can edit a message by calling updateMessage and including a message with an ID – the ID field is required when editing a message:


const message = { 
  id: 123, 
  text: 'the edited version of my text' 
};

const update = await client.updateMessage(message);
                    

// update some field of the message
message.setText("my updated text");

// send the message to the channel
client.updateMessage(message, new MessageCallback(){
    @Override
    public void onSuccess(MessageResponse response) {

    }

    @Override
    public void onError(String errMsg, int errCode) {

    }
});
                    

let editedMessage = Message(id: message.id, text: newText)
channel.send(message: editedMessage).subscribe().disposed(by: disposeBag)
                    

// update some field of the message
message.setText("my updated text");

// send the message to the channel
channel.updateMessage(message, object : MessageCallback {
    override fun onSuccess(response: MessageResponse) {}

    override fun onError(errMsg: String, errCode: Int) {}
}