Hi,
I am trying to implement an event listener to the conversation, so that a certain message is sent at the end of the conversation on web chat (see below code). However the below code is not working. Could anyone help me out with this?
Thanks,
Aline
<script>
window.addEventListener('message', event => {
if (event.state.context.currentNode === 'node-e931') {
setTimeout(function(){ window.botpressWebChat.sendEvent({
type: 'proactive-trigger',
channel: 'web',
payload: {
text: `xy`}
})}
)}
</script>