2 min read 1 wk ago

Quick Actions

Quick Actions are buttons that can be added to the chatbot conversation. They are mostly used as conversation starters. You can choose a predefined message when the button is clicked. You can create Quick Actions sets, which are sets of Quick Actions that are each represented as a button.

Snippet Callback

You can run custom code directly on your live website’s frontend when a Quick Action is clicked.

If you were doing this without the Quick Actions add-on, you’d manually declare your shortcut using the “callback”parameter, and pass your JavaScript code as a string — it would execute as soon as the shortcut is triggered.

With the Quick Actions add-on, the proper way is to use Code Engine:

  1. Create a new snippet in Code Engine.
  2. Set its type to Callable, since it will be executed “when called”.
  3. Set the target to JS — this tells Code Engine to declare the function in the browser.
  4. Make sure the function takes no parameters, since none will be passed when the shortcut is clicked.

The snippet will only appear as selectable in the Quick Actions settings if all of the above is configured correctly.

Now we can save our function and set our Quick Action to “Callback” type. In the Callback section, we are able to choose our snippet.

Go in your browser and open the dev tools; this will let you know if your code is running correctly (assuming you have some console logs) or show you if an error has been found during the execution.