Event Listener
- July 23, 2025
- 1 mins read
Table of Content
You can add an event listener to listen for custom events triggered by the REVE Chat iframe. This allows you to handle specific actions or messages sent from the chat widget to your website.
Use the following example to listen for a custom event from the REVE Chat iframe and handle the data.
Example
// Define a handler function for the custom event
function handleCustomMessage(event) {
if (event.type === 'customRevechatMessage') {
const message = event.data;
console.log("Received message from iframe: " + message);
}
}
// Add the event listener
document.addEventListener('customRevechatMessage', handleCustomMessage);
Any questions? Please email us at [email protected]