4

I want to give user the ability to delete messages.

In the code I am deleting a message using : message.remove(); and the message gets delete all fine.

Now I want to show users in the chat that a message was deleted at that particular place (like in whatsapp). But channel.getMessages() gives only non-deleted messages.

Is there a way to get deleted messages from twilio?

If not possible, I am thinking to update the message when user wants to delete (deleting only the message body). Please suggest if this is the best solution.

tsikka
  • 191
  • 6

1 Answers1

0

Twilio developer evangelist here.

Deleting a message will remove the message. If you want to keep that message history, your best bet would be to add an attribute to the message to indicate that it was deleted.

You can update the attributes of a message with the message.updateAttributes() method and then listen for updates on messages with the messageUpdated event and remove the message from your UI if the attributes indicate it was removed.

philnash
  • 70,667
  • 10
  • 60
  • 88