Get Messages
Description
Returns the message history of a given room, in a defined number and counted from a certain message within that room.
Params
The argument of the getMessages() function is an object with the following keys:
roomId:
Description
It's a mandatory key with a value of type “string”, that corresponds to the ID of the room from which messages will be fetched. The ID of the current room is a key inside the room object of widgetService, and can be accessed as follows:
widgetService.room.id
Data Type
String
limit
Description
It's an optional key with a value of type “number”, that corresponds to the number of messages to be fetched. If not set, the “getMessages” function will take the default value of 20, and therefore it will bring 20 messages.
Data Type
int
id
Description
It's an optional key with a value of type “string” or “number”, that corresponds to the message ID from which a number of messages determined by the "limit" parameter will be fetched. If not set, the “getMessages” function will take the default value of null, and therefore it will bring the last sent messages, according to the established “limit”.
Data Type
String
Example of use
Example #1
Example #2
Example #3
Last updated