function handleMessage()

in webview/app.js [134:157]


function handleMessage(sender_psid, received_message) {
    let response;

    // Checks if the message contains text
    if (received_message.text) {
        switch (received_message.text.replace(/[^\w\s]/gi, '').trim().toLowerCase()) {
            case "room preferences":
                response = setRoomPreferences(sender_psid);
                break;
            default:
                response = {
                    "text": `You sent the message: "${received_message.text}".`
                };
                break;
        }
    } else {
        response = {
            "text": `Sorry, I don't understand what you mean.`
        }
    }

    // Send the response message
    callSendAPI(sender_psid, response);
}