Wix Chat: On message received () Issue

I am using wix editor.

onMessageReceived - Velo API Reference - Wix.com

I just want to use this function in my website. I have opened the dev mode, and in the masterpage, written this code,

$w.onReady(function () {
$w(“#wixChat1”).onMessageReceived((message) => {
const channelId = message.channelId;
const messageText = message.payload.text;
});

});

On the parameter on message, it’s giving me this error:
Parameter ‘message’ implicitly has an ‘any’ type, but a better type may be inferred from usage.

Argument of type ‘(message: any) => void’ is not assignable to parameter of type ‘Message’. Type ‘(message: any) => void’ is missing the following properties from type ‘Message’: channelId, type, summary, participantId, and 2 more.

How can I fix this? Any help would be appreciated.

Could anyone please share a code where this function is working?

The problem seems to be with Message type. I have tried to import this, but it’s not working. I am not sure what’s the correct method to do this.

Thank you again,