import wixChatBackend from 'wix-chat-backend';
$w.onReady(function () {
let channelId = "YOUR_CHANNEL_ID"; // Replace with your channel ID
let obj = {
"messageText": "Hello! How can I assist you today?",
"channelId": channelId,
"sendAsVisitor": false
};
wixChatBackend.sendMessage(obj)
.then( () => {
console.log("Chat message sent");
})
.catch( (error) => {
console.log(error);
});
});