Link Search Menu Expand Document

View

/api/v2/message/view

Post

rooms

jwt


Purpose

To allow a user to mark a sent message as being seen in a chat room that he/she is a member of.

Body Content [input]

{
    uid: string,
    roomID: string,
    messagesID: string[]
}

Returns if valid [output]

{
    message: string,
    error: 0
}

What the API does

  • Finds the record from the rooms collection corresponding to the roomID passed [404].
  • Ensures that uid corresponds to a record in the members field of that record with a status of accepted [403].
  • Loop through all messages and threads in the room and appends uid to their views field if their messageID or threadID is among the values of the messagesID field passed and if uid is not already appended and if uid does not have the same value as that of the senderID field of that object.