messageHistory
When new user joins the chat this event is triggered that contains previous 18 historical messages
JavaScript
frame1.on("messageHistory", (messageHistory) => {
console.log("history", messageHistory);
});
Properties
Properties | Description | Type |
---|---|---|
_id | id of the message | String |
likes | array of likes | Array |
created | when the chat message was created | String |
chatRoom | chat room id | String |
message | message that was sent | String |
user | user object | Object |
Customer | customer id | String |
User
Properties | Description | Type |
---|---|---|
_id | id of the user | String |
username | username of the user | String |
JSON Sample Response
[
{
"_id": "63289b48f0357f1c648791e7",
"likes": [],
"created": "2022-09-19T16:39:36.456Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "hi",
"user": {
"_id": "63289b35f0357f1c648791e5",
"username": "user 1"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "63289b39f0357f1c648791e6",
"likes": [],
"created": "2022-09-19T16:39:21.449Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "hi",
"user": {
"_id": "63289b35f0357f1c648791e5",
"username": "user 1"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "63288903f0357f1c648791d5",
"likes": [],
"created": "2022-09-19T15:21:39.756Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "asdasdasdasdasdasdas",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "63287666f0357f1c648791b5",
"likes": [],
"created": "2022-09-19T14:02:14.803Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "hello I am a bad person",
"user": {
"_id": "6328765af0357f1c648791b4",
"username": "bad person"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "6323a577f0357f1c6487919a",
"likes": [],
"created": "2022-09-15T22:21:43.525Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "Hello world0.3288053438729137",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "6323a564f0357f1c64879199",
"likes": [],
"created": "2022-09-15T22:21:24.895Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "Hello world0.7636631194393506",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "6323922af0357f1c64879197",
"likes": [
{
"_id": "6325c301f0357f1c6487919c",
"username": "support",
"userId": "63233015c3aa3508a4c8fc34",
"reaction": "wave"
},
{
"_id": "6325c347f0357f1c6487919f",
"username": "support",
"userId": "63233015c3aa3508a4c8fc34",
"reaction": "thumbs_up"
}
],
"created": "2022-09-15T20:59:22.593Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "how are you?",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"repliedTo": {
"_id": "6323922af0357f1c64879198",
"message": "ghfhf",
"username": "bobob",
"messageCreatedAt": "2022-09-15T19:39:58.157Z",
"userId": "63233015c3aa3508a4c8fc34",
"messageId": "63237f8ef0357f1c64879194"
},
"__v": 0
},
{
"_id": "632391e5f0357f1c64879195",
"likes": [],
"created": "2022-09-15T20:58:13.362Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "hello",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"repliedTo": {
"_id": "632391e5f0357f1c64879196",
"message": "ghfhf",
"username": "bobob",
"messageCreatedAt": "2022-09-15T19:39:58.157Z",
"userId": "63233015c3aa3508a4c8fc34",
"messageId": "63237f8ef0357f1c64879194"
},
"__v": 0
},
{
"_id": "63237f8ef0357f1c64879194",
"likes": [],
"created": "2022-09-15T19:39:58.157Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "ghfhf",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "63237f54f0357f1c64879193",
"likes": [],
"created": "2022-09-15T19:39:00.413Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "sdfsd",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "63237f53f0357f1c64879192",
"likes": [],
"created": "2022-09-15T19:38:59.703Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "fsdf",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "63237f52f0357f1c64879191",
"likes": [],
"created": "2022-09-15T19:38:58.919Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "dfsfsd",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
},
{
"_id": "6323301cc3aa3508a4c8fc35",
"likes": [],
"created": "2022-09-15T14:01:00.801Z",
"chatRoom": "631794a83671700c713b1ce6",
"message": "Hello world0.9368298953351251",
"user": {
"_id": "63233015c3aa3508a4c8fc34",
"username": "support"
},
"customer": "631794a83671700c713b1ce5",
"__v": 0
}
]