[SOLVED] messages.addMessages example please?


#1

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:


#2

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!"}]
);

#3

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