Developers » API methods » Messages » messages.getLongPollHistory
Returns updates in user's private messages.
To speed up handling of private messages, it can be useful to cache previously loaded messages on a user's mobile device/desktop, to prevent re-receipt at each call. With this method, you can synchronize a local copy of the message list with the actual version.
This method can be called with a user token received in Standalone-app via Implicit Flow. Access rights required: messages.
This method can be called with a community token. Access rights required: messages.
tsLast value of the ts parameter returned from the Long Poll server or by using messages.getLongPollServer method.
positive number
ptsLast value of pts parameter returned from the Long Poll server or by using messages.getLongPollServer method.
positive number
preview_lengthNumber of characters after which to truncate a previewed message. To preview the full message, specify 0.
NOTE: Messages are not truncated by default. Messages are truncated by words.

positive number
onlines1 Ś to return history with online users only.
flag, either 1 or 0
fieldsAdditional profile fileds to return.
list of comma-separated words, default photo,photo_medium_rec,sex,online,screen_name
events_limitMaximum number of events to return.
positive number, default 1000, minimum value 1000
msgs_limitMaximum number of messages to return.
positive number, default 200, minimum value 200
max_msg_idMaximum ID of the message among existing ones in the local copy. Both messages received with API methods (for example, messages.getDialogs, messages.getHistory), and data received from a Long Poll server (events with code 4) are taken into account.
positive number
group_idgroup ID (for community messages with a user access token).
positive number
lp_versionLong Poll version.
positive number
positive number, default 0, maximum value 2000
flag, either 1 or 0
Returns an object that contains the following fields:COMMENT: (6 of 6) The English translation was not very clear. We tried to make it clearer, but please verify that the technical meaning is still correct.
  • history Ś An array similar to updates field returned from the Long Poll server, with these exceptions:
    • For events with code 4 (addition of a new message), there are no fields except the first three.
    • There are no events with codes 8, 9 (friend goes online/offline) or with codes 61, 62 (typing during conversation/chat).
  • messages Ś An array of private message objects that were found among events with code 4 (addition of a new message) from the history field. Each object of message contains a set of fields described here. The first array element is the total number of messages.
36Method execution was interrupted due to timeout
907Value of ts or pts is too old
908Value of ts or pts is too new
Global errors can occur while running. See their descriptions on this page.
Version historyShow all
apps.get Ŕ apps.getCatalog methods returns photo object for screenshots fields. Add in_read, out_read fields in response of messages.getDialogs, messages.getHistory and messages.getLongPollHistory methods. Add peer_id parameter for messages.send, messages.sendSticker, messages.deleteDialog, messages.setActivity and messages.getHistory methods.
messages.getLongPollHistory accepts fields field.
Links attached to messages now represented as attachment objects, not link in message text
Represent gifts as special object, not as attached document anymore
chat_active field returns as array, not string.
First element of result represents total count of elements.
Affects methods photos.get