Flagging a message

flag and unflag a message

While having moderators surveying your chats is great, it doesn't scale well. A way to overcome this is to let your users do the work for your moderators. By letting users flag other users or specific messages, the work of moderators is significantly reduced and democratized, thus allowing administrators to only respond to issues when deemed critical or absolutely necessary.

Flag and Unflag Messages

To flag a message, create an instance of AmityMessageFlagger first:

// badMessage is an instance of AmityMessage
let messageFlagger = AmityMessageFlagger(client: client, messageId: idOfMessage)

The AmityMessageFlagger lets you flag and unflag a message, and it also exposes a asynchronous way to check whether the current user has flagged the given message already:

Flag a message

To flag a message, call the following method:

// flag the message
messageFlagger.flag { success, error in
  ...
}

Un-flag a message

To unflag a message, call the following method:

// unflag the message

messageFlagger.unflag { success, error in
  ...
}

The User can also check if they have previously flagged the message before by calling the following asynchronous method:

Check if the message has been flagged

// check whether we already have flagged this message
messageFlagger.isFlaggedByMe { [weak self] isFlaggedByMe in
  if isFlaggedByMe {
    ...
  } else {
    ...
  }
}

Remember that each AmityMessageFlagger is tied to one specific message.

Last updated