[SOLVED] messages.addMessages example please?

Hello,

I’m trying to load previous messages into a chat page, and I believe messages.addMessages is the method for it, however I can’t seem to make it work… Perhaps my syntax is wrong? It says the first parameter is an array with messages to add. Each message in array should be presented as an object with [message parameters]. Required. I’m not sure how to properly structure that array.

messages.addMessages(
{  text: "hello!"},{text:"hey!"}
);

Can someone please give me a simple example for it?

Thanks! :slight_smile:

Each message in array should be presented as an object with [message parameters]

So f7 expects an array of objects. But from your code i see that you pass objects, not an array. so try like this:

messages.addMessages(
[{  text: "hello!"},{text:"hey!"}]
);
2 Likes

Sorry for the late reply but thanks so much for the help! :slight_smile: