@square-king-46874 Currently working on pretty much exactly the same thing myself for my own bot.
Just like you, I have buttons on a page, that when clicked, pull info from the page and send it to Botpress via sendEvent().
The issue here is that I there is no way to show the typing indicator client-side, this is the same as sending a message as the Bot instead of the User. Both Bot messages and the typing indicator happen server-side.
The delay between sending the event and the bot replying will likely be due to network and processing delays, so showing any feedback whatsoever would have to be client-side.
The best way I can think of achieving this is forcing CSS changes to webchat as soon as the button is clicked/sentEvent() invoked. Those changes should then revert as soon as the bot replies, this will likely require sending an event back to the website/webchat on the Botpress side.
The way i'm thinking of doing it, is by applying these CSS changes with JS on button click or sendEvent()
.bpModalContainer {
background: rgba(0,0,0,0.7);
}
.bpContainer {
filter: blur(1.5px);
}
And injecting a loading spinner in the centre of the .bpModalContainer div. The loading spinner will be an animated GIF from
https://loading.io however there are other spinner alternatives.
This should cause the webchat to turn a little blurry, with a dark overlay and spinner while the event is "processing".
On the Botpress side, the first card in the first node that reacts to your sent event would be a Send Custom Event card to send an event back to your website/webchat to inform your code that the event has finished processing and the bot is about to reply.
I would then use JS to unset/remove all styles/elements that were changed/added when the event was sent.
This seems like the most simple way to implement this event UI feedback to me.