Get all messages¶
This function return all messages from live. There's a default limit that cloud be changed of 100 messages.
import { Metalives } from "metalives-sdk"
import dotenv from 'dotenv'
dotenv.config();
const client = new Metalives(process.env.SDK_TOKEN);
// the second parameter is the limit of messages that will be request
const allMessages = await client.chat.getAllMessages(liveId, 100);
Will be returned in the below format:
[
{
"id": "Id of the message",
"createdAt": "Timestamp { seconds: int, nanoseconds: int }",
"name": "name of message sender, configured by application",
"text": "Text content of the message"
},
]