The Assistant channel also comes with a configurable website plugin (called the Widget) that can be added to any website by adding a single line in your source code. The Widget will then appear as a small bubble in the bottom-right corner of your site for every visitor.
Simply add the following line of code in your source code, just before the closing </body>
tag (replace it with the actual line that you can find in your Webapp configuration panel):
Once this is done, a chat bubble will appear as follows on every page where that code is included.
The Widget lets you configure a custom popup message to help you engage more actively with your customers. You can even have default greeting messages depending on the page where the widget is loaded! Here is how it works:
Greetings are matched with their page based on the URI. The first message that matches the URI is the one that will be displayed. We support wildcards *
and **
to make it more versatile!
To display a message on all pages, use /**
as the URI.
If you want to target one specific page, use its URI, i.e /about-us/the-team
You can also target all subpages of a directory with *
: /about-us/*
will match /about-us/the-team
and /about-us/the-company
The **
wildcard will also match any subdirectory: /about-us/**
will match /about-us/team/europe
Several configurations are available as standard HTML data attributes to maximize compatibility across browsers.
By default, the widget will be displayed on the right side of the screen. To display the widget on the left instead, simply add data-position="left"
.
To add custom metadata in a widget (see this page for more information about injecting metadata in the assistant), you need to add a data-metadata
attribute to the widget initialization script tag that contains the encoded (with javascript's encodeURIComponent function) JSON string of the metadata you want to inject.
For example: data-metadata="%7B%22email%22%3A%22jane.doe%40company.com%22%7D"
You can configure a custom image to be used as the widget logo by setting this parameter to the URL of your image. You can use a transparent png or a svg to achieve this effect below, or directly use a square image (it will be rounded automatically) without a transparent background to use as the logo.
For example: data-logo-url="https://cdn.clevy.io/clevy-logo-square-white.png"
These two parameters let you change the fill color of the default icons, as well as the background for the launcher button.
Any valid CSS value for these elements is accepted. The default values are:
Force the widget to open as soon as the script is loaded. Not recommended as it might be a bit agressive for the visitors of the page, but may be useful in some cases!
Set the Assistant's ref param to trigger a specific flow or step.
To make it really easy to publish your chatbot, CSML studio provides a full-featured web-based Conversational Assistant that you can easily integrate into any existing project. This is the simplest way to deploy your chatbot at scale!
The Text
component also supports some basic Markdown:
Display a typing indicator for the requested time expressed in milliseconds. Obviously, Wait
is also supported (it simply does not display a typing indicator or anything for the given duration).
If you need to retrieve a specific data when clicking on either button, use the payload
argument of the Button component:
The Assistant channel also supports single Button
components. However, as cross-channel support for single buttons is not guaranteed, we encourage you to use the standard Question component instead, with a title.
Quick replies are similar to Questions, where the buttons are removed from view once the user has selected one of them. In a majority of scenarios, you should prefer QuickReplies over regular questions, especially when you don't want the user to be able to scroll up and select one of the buttons after they have made a first choice. Questions should be used when a button is used as a trigger to a given flow (as configured in the bot's AI Rules).
The Video component supports links to mp4 files, as well as Youtube, Vimeo and Dailymotion URLs. The Audio component supports links to mp3 files, as well as Spotify, Soundcloud and Deezer URLs.
Standard limitations apply: if the end user is not logged in to a valid spotify/deezer/soundcloud account, only 30s will be playable in the audio component.
For full control over the clip, prefer using a standard mp3 file URL.
The Url
component will automatically retrieve the target's favicon if available. If a text
parameter is present, it will be used as the component's title.
A Carousel
is essentially a collection of Card
elements A single Card
will display as a Carousel
of 1 element. Each Card
can have a maximum of 2 Button
elements.
The cards themselves can be made clickable by adding an optional default_action
Url() parameter:
The carousel can also automatically navigate horizontaly by adding the optional autoplay
parameter (which defaults to false
):
This component will display a rich calendar in the webapp. By default, when passed with no argument, a simple single-date datepicker will appear:
Optional parameters allow to set a min_date
and/or max_date
(by unix timestamp, in milliseconds) or an input_mode
to accept single
(the default) multiple
or range
inputs by the user:
The event
value of a Calendar input will be comma-separated values of all user inputs. Also, event.input_mode
will be set to the mode of the requested calendar, so that you can differenciate between single
, multiple
and range
modes when receiving values.
To gain some control over what a user can enter in a form (for example, if you need to make sure they only enter an email address or a valid number when required), you can also use the Input
component.
There are several variants of input fields: email
, text
, textarea
, number
and password
. By default, inputs are type="text"
. All parameters are optional, and the basic usage is as follows:
You can check this reference about the minlength and maxlength parameters: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text#additional_attributes
A completely bare say Input()
component will result in a simple, empty text input.
Inputs with type="number"
can have some different parameters, just like HTML inputs (all are optional as well):
You can check this reference about the min and max parameters: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/number#additional_attributes.
To learn more about the inputs with type="password", read the documentation about secure inputs (hold_secure
): https://docs.csml.dev/language/standard-library/keywords#hold_secure
Display a radio buttons component:
If you want to let users select multiple options, the Multiselect()
or `Checkbox()` components are a great solution. Users will be able to select any number of options in the given list. You can force a min
and max
number of choices, or if required=true
, it means that at least one option must be selected to continue.
Both the Multiselect and Checkbox components work exactly the same, only the display will be different. Try both to find out which one suits you best!
When several options are selected, you will receive a comma-separated list of the corresponding payloads (not necessarily the button's title!), in the order they were selected by the user.
Like the Radio component, the Dropdown lets users pick an option from a list:
LaTeX is a popular language that lets you write (among other things) complex math formulas. The webapp and chatbox include KaTeX to support this language natively with a custom component:
You can find more examples of supported formats on the KaTeX documentation: https://katex.org/docs/supported.html. Please keep in mind that backslashes (\
) must be escaped properly in your code!
You can also add LaTeX inline in any standard text like by encapsulating it inside {latex}...{/latex}
tags:
You can display a simple signature field i.e to collect user consent and receive it as a png file.
To create a CSML Studio Assistant, click on the channels menu then on create new channel.
Click on Assistant, add a name and a description (you can change it later), then click on Submit.
Your Assistant is now created and ready to use! There are two ways to use your Assistant: either by visiting the link at the top, or by adding the widget link for integrating it into your existing website. It works on mobile too!
You can launch a specific flow (and step) instead of the default Welcome Flow when loading the Assistant by providing a ref
query parameter in its URL.
To force the launch of a specific flow when opening the Assistant URL, use the following special syntax:
By default, the Assistant channel does not include any specific context about the conversation (see the _metadata
object ). In some cases, it can be useful to load the Assistant (or Widget) with pre-existing metadata.
Some common scenarios:
the bot is loaded in a website where the user is already known: in that case, we may be interested in injecting the user's context (name, email...) inside the conversation.
the user is authentified on the parent website: in that case, we may want to inject an authentication token into the user's conversation for subsequent calls.
the same bot is used across several websites and we want to know which website the user is currently visiting: in that case we can inject a unique website identifier into the conversation.
The injected data is available in the _metadata
global variable, available in every flow.
The code of the example above is:
You can change the appearance of the Assistant by visiting the Design tab of the configuration panel. This lets you have even more control over the final experience for your end users, and match your own branding even better!
Many elements are configurable:
Chatbot avatar, header card color and background image
User bubble colors
Hiding the CSML branding
Disabling the speech input
And many others!
To add custom metadata in your Assistant, simply add the encoded (with ) JSON string of the metadata you want to inject to the query parameters of the URL. The URL of the Assistant in the example above would be:
The settings panel has a few options to allow you to configure the Assistant. Each Assistant must have a name, and you can also add an optional description and logo.
When a user arrives on the page, the chatbot welcomes them with a flow. It can be any flow, but by default it is the Default flow.
If you do not want a welcome interaction at all, create an empty flow and use that as the Welcome flow!
The Assistant channels lets you add shortcuts to either flows or external websites:
This will show as a list of searchable shortcuts in the sidebar in full-screen view, or at the top of the input bar in mobile/widget view:
The autocomplete feature helps your chatbot provide a list of up to 5 items that are contextualized to what the user is currently typing. Think of it as quickly hitting one of the first google search results!
To configure Autocomplete, you need to have a backend endpoint that will handle the requests and respond accordingly. You can configure this endpoint in the Assistant's configuration panel:
The request that will be performed by the Assistant will be as follows:
Your endpoint must return results within 5 seconds as an application/json
content-type, formatted as an array of maximum 5 results containing a title, optional highlighting matches, and the corresponding payload.
When a user selects a result, it will behave as a button click where the text is displayed and the payload is sent to the chatbot.
If an autocomplete endpoint is set, it will be enabled by default. However, it can be disabled or reenabled dynamically in your CSML script:
Autocomplete status is not persisted across page reloads. When reloading the page, this will always be set to true
by default!