Airgram

Guides
/
/
Methods

api.viewMessages()

Informs TDLib that messages are being viewed by the user. Sponsored messages must be marked as viewed only when the entire text of the message is shown on the screen (excluding the button). Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels)

Parameters ViewMessagesParams:

NameTypeDescription
chatIdnumber Chat identifier
messageThreadIdnumber If not 0, a message thread identifier in which the messages are being viewed
messageIdsnumber[] The identifiers of the messages being viewed
forceReadboolean True, if messages in closed chats must be marked as read by the request
Returns ApiResponse interface:
interface ApiResponse {
  _: 'viewMessages' | 'error'
  airgram: Airgram
  request: {
    method: 'viewMessages'
    params: ViewMessagesParams
  }
  response:  | 
  setState: (nextState: Record<string, unknown>) => void
  getState: () => Record<string, unknown>
}