HTML & Javascript
Standard
You can get the standard HTML and JavaScript code by clicking on the “HTML & Javascript” button in the “Share” tab of your agent dialog. In this section, you can modify container dimensions.
Below is an example:
This code is creating a container with a 100% width (will match parent width) and 600px height.
Multiple agents
To display multiple agents on the same page, assign unique id
props to each:
Popup
Get the popup HTML and JavaScript code by clicking on the “HTML & Javascript” button in the “Share” tab of your agent dialog.
Here is an example:
This will trigger the popup window automatically after 3 seconds.
Bubble
Click the “HTML & Javascript” button in the “Share” tab of your agent dialog to integrate the bubble.
Here is an example:
This will display a bubble with a preview message after 5 seconds.
Custom button position
You can adjust the position of the button with custom CSS. For example:
If you have a preview message, you’ll also have to manually position it:
Commands
Here are the commands you can use to trigger your embedded agent:
-
Agent.open()
: Open popup or bubble -
Agent.close()
: Close popup or bubble -
Agent.toggle()
: Toggle the bubble or popup open/close state, -
Agent.showPreviewMessage()
: Show preview message from the bubble, -
Agent.hidePreviewMessage()
: Hide preview message from the bubble, -
Agent.setPrefilledVariables(...)
: Set prefilled variables. Example:For more information, check out Additional configuration.
-
Agent.setInputValue(...)
: Set the value in the currently displayed input.
You can bind these commands on a button element, for example:
id
prop to target a specific agent. I.e. Agent.open({ id: 'my-bubble' })
Callbacks
If you need to trigger events on your parent website when the user interact with the agent, you can use the following callbacks:
Additional configuration
You can prefill the agent variable values in your embed code by adding the prefilledVariables
option. Here is an example:
It will prefill the Current URL
variable with “https://release0.com/account” and the User name
variable with “John Doe”. More info about variables: here.
Note that if your site URL contains query params (i.e. https://release0.com?User%20name=John%20Doe), the variables will automatically be injected to the agent. So you don’t need to manually transfer query params to the agent embed configuration.