How to use the Flow Action </> Code in our flows

(Janmajay Adhikari) #1

Hi Team,
I want to close the Web Bot chat window after a complete interaction (when the flow reaches last flow action). I tired using FxoMessenger.destroy(); but I get an error that FxoMessenger messenger object in undefined. Is there a different way of doing it?

What all Javascript API’s/frameworks we could execute? Any examples?

Thanks,
Janmajay

(John Jackson) #2

Hey! Where did you call destroy from? This needs to be called in the page that the web messenger is hosted in.

To do this I recommend you listen for messages and detect when the last message has been sent (based on content), then call the destroy method then. Please see the docs for how to do that.

Note these API methods won’t work in the code service, that only allows you to run code on the server.

(Janmajay Adhikari) #3

Hi John,
Thanks, I could understand what you are referring to.

If I need to execute a piece of Javascript code. Are there any JS frameworks that are supported?

Also is there a way to resize the Web Bot chat window?

Thanks,
Janmajay

(John Jackson) #4

The API is raw JS, so you can call the code in any JS framework. In fact any HTML page inside a browser.

The options we have for size are either sidebar (default) or full screen.

Good luck with it!

1 Like