Send custom event to browser console
# 🤝help
c
How can I print something to the browser console (like the chat summary) -- currently console.log() only prints to the bot logs.
c
@fresh-fireman-491 do I have to pick it up on the other side as well?
f
Then you would add this to the JavaScript part of your website
Copy code
javascript
        window.botpressWebChat.onEvent(event => {
            if (event.type === 'TRIGGER') {
                console.log(event);
            }
        }, ['TRIGGER']);
Then you can check your console to see what it logged
And then you can narrow it down a bit more by maybe
console.log(event.value);
I can't remember the exact path
I keep getting this every time I use the send custom event card
f
Can you send me a screenshot of your card
f
Try this JSON payload:
Copy code
json
{ "chatSummary": "{{conversation.SummaryAgent.summary}}"}
It should give you something like this in the console
c

https://tenor.com/lstV9ZImGS8.gif

f
So if you want to just log the summary to the console you can use this
console.log(event.value.chatSummary)
c
Works like a charm ❤️
f
I am glad to hear that!
c
@fresh-fireman-491 I swear there's a gremlin in my bot
It was working
Now it's not
Nothing changed lol
Wait
Now it's working again?
What in the heckin

https://tenor.com/noTv2zXQan3.gif

^ my bot
f
Maybe the summary was empty🤷‍♀️
Not sure, but glad to hear that it's working
37 Views