The following data attributes are used in the examples below:
Example 1: CTA to assign to a bot
Adding the data-web1on1-bot attribute to any button will open the widget and start the Testdrive bot. It takes a bot ID, and assigns the conversation to the corresponding bot.
Example button:
<button data-web1on1-bot="6081529153542604f56acb05">Book a test drive</button>
Example 2: CTA to mention a bot
Some bots interpret bot commands, sent to the bot as a mention
type message. For example, the
ChatScript bot runs a scripted conversation ID if you provide it after the `start` command, like this:
Example buttons:
<button data-web1on1-bot="6248f0083ab5d5001e523146 start 624e0c244be4c2f9db262000">Test Drive bot</button>
Example 3: Quick-start initial agent message
Using the data-web1on1-agent-name
and data-web1on1-agent-text
attributes
to immediately insert an initial agent/bot message when the button is clicked.
We instruct the Chatscript bot to start with the second message (the message ID ending with '2001'):
Example button:
<button data-web1on1-bot="6248f0083ab5d5001e523146 start 624e0c244be4c2f9db262000">Test Drive bot</button>
Example 4: Start a bot when widget is activated
To start a bot when the visitor activates the widget, as well as through a CTA button, first implement the first Autostart example. This will trigger the bot when the widget is opened. For the CTA button we use the data-web1on1-open attribute to just open the widget.
Example button:
<button data-web1on1-open="">Open the widget</button>
Example 5: Open widget on link click
This link will just open the widget and was created with the following code:<a href="index.html" data-web1on1-open="" data-web1on1-preventdefault="true">This link</a>
data-web1on1-preventdefault="true"
is added to stop following the link