Edit a Message

Overview#

Edit message is a feature which allows you to edit the content of your previously sent Text messages and Captions associated with Media (Image or Video) in your chat conversation

Note : User can edit only Sent Messages.

Edit Text Message#

To edit your text message, you need to pass the EditMessage object as an argument to the parameter in the editTextMessage() method.

    let editMessageParams = EditMessage()
    editMessageParams.messageId = MESSAGE_ID // which message need to edit
    editMessageParams.editedTextContent = MESSAGE // updated content
    editMessageParams.mentionedUsersIds = MENTION_IDS // optional, sent if mentioned users is edited
    FlyMessenger.editTextMessage(editMessageParams: editMessageParams) { isSuccess, error, textMessage in
    if isSuccess {
    //find the index of message object in list using messageId and update
    }
    }
    ArgumentTypeDescription
    MESSAGE_PARAMSEditMessageObject to hold the parameters of the Edit Message
    CALLBACKFlySendMessageListenercallback to observe the action status
    info

    When a message is being edited, onMessageEdited event will be triggered. Based on this event, update the message and refresh the Ul.

    Edit Media Caption Message#

    To edit your media caption message, you need to pass the EditMessage object as an argument to the parameter in the editMediaCaption() method.

      let editMessageParams = EditMessage()
      editMessageParams.messageId = MESSAGE_ID // which message need to edit
      editMessageParams.editedTextContent = MESSAGE // updated content
      editMessageParams.mentionedUsersIds = MENTION_IDS // optional, sent if mentioned users is edited
      FlyMessenger.editMediaCaption(editMessageParams: editMessageParams) { isSuccess, error, textMessage in
      if isSuccess {
      //find the index of message object in list using messageId and update
      }
      }
      ArgumentTypeDescription
      MESSAGE_PARAMSEditMessageObject to hold the parameters of the Edit Message
      CALLBACKFlySendMessageListenercallback to observe the action status
      info

      When a message is being edited, onMessageEdited event will be triggered. Based on this event, update the message and refresh the Ul.