Start chatbot on a button click

You can link any playbook with a button on your website, so that when a user clicks on a button on your website, particular playbook is launched.

For this you will have to update certain code in your website, so that a Javascript code runs on a button click. Below are the steps for the same.

Login: Login to admin panel and go to AI builder from the left menu. (To access AI builder, you must have Owner role. You can check your role from Team menu on left sidebar)

Get Playbook Id: Select any of the web playbook you would like to run on a button click. Hover to playbook name on left sidebar, click on 3 dots to open Menu and click on "Copy Id". Copy the playbook Id and note it down somewhere, it will be needed in the following steps.

Update code on your website: Below is the code you need to run to start the playbook. It will trigger the playbook, the message will be shown to user as a popup next to chat icon. User can click on that to open chat widget.

iticks.call('playbook', '<playbook id>');

Below is the code which will trigger the playbook and open the chat widget as well.

iticks.call('playbook', '<playbook id>');
iticks.call('show', 'maximize');

In above codes you need to replace the <playbook id> with the id copied in the 2nd step.

Different ways to place the code in your website.

Once you have picked the code and replaced playbook id, below are some of the ways you can use to run the code on button click. You can have your own way of handling click events to run the code.

  1. HTML markup onclick

<button onclick="iticks.call('playbook', '<playbook id>');iticks.call('show', 'maximize');">click me</button>
OR
<div onclick="iticks.call('playbook', '<playbook id>');iticks.call('show', 'maximize');">click me</div>

2. Using jQuery to add click event on the button(Assuming id of the button is demo, but you can use any other selector as well)

$('#demo').click(function() {
iticks.call('playbook', '<playbook id>');
iticks.call('show', 'maximize');
});