I am calling the following method on endpoint
exports.allConversations = async (req, res) => {
    // The recipient of the call, a phone number or a client
    console.log(req.body);
    let phoneNumber = req.body.phoneNumber;
    let messageSent, messageReceived;
    try {
        let messageSentPromise = client.messages
            .list({
                from: phoneNumber,
                limit: 20
            });
        let messageReceivedPromise = client.messages
            .list({
                to: phoneNumber,
                limit: 20
            });
        [messageSent, messageReceived] = await Promise.all([messageSentPromise, messageReceivedPromise]);
        let conversations = [];
        for (let i = 0; i < messageSent.length; i++) {
            let message = messageSent[i];
            if (conversations.includes(message.to))
                conversations[message.to].push(message);
            else {
                console.log([].push(message));
                conversations[message.to] = [message];
            }
        }
        console.log(conversations);
        return res.status(200).send({
            conversations: conversations
        });
    }
    catch (error) {
        console.log(error);
        return res.status(200).json({
            success: false
        });
    }
}
console.log(conversations); In the response I am always receiving an empty array but the console.log above the following code
return res.status(200).send({
                conversations: conversations
            });
prints the array on console.
 
     
    