Saleh's Fiddle
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- Botpress Embedded code begin -->
<script src="https://cdn.botpress.cloud/webchat/v1/inject.js"></script>
<script src="https://mediafiles.botpress.cloud/c3305ed1-d780-4bbf-bcb6-dc0d32426de5/webchat/config.js" defer></script>
<!-- Botpress Embedded code end -->
</body>
</html>
JavaScript
window.botpressWebChat.onEvent(
function (event) {
if (event.type === 'TRIGGER') {
window.open('https://russellwalsh.myrealtyonegroup.com/newsletter', '_blank'); // Open link in new tab
}
},
['TRIGGER']
);
// Following is the approach i was talking about but couldn't figure out how to use it
/*
window.botpressWebChat.onEvent(
function (event) {
if (event.type === 'open_home_value') {
window.open('https://russellwalsh.myrealtyonegroup.com/my-home-value', '_blank');
} else if (event.type === 'open_market') {
window.open('https://russellwalsh.myrealtyonegroup.com/market-area/46158', '_blank');
}
},
['open_home_value', 'open_market'] // all triggers
);
*/