Standard
You can get the standard HTML and Javascript code by clicking on the “HTML & Javascript” button in the “Share” tab of your typebot. There, you can change the container dimensions. Here is a code example:See all possible settings
See all possible settings
Multiple bots
If you have different bots on the same page you will have to make them distinct with an additionalid
prop:
Popup
You can get the popup HTML and Javascript code by clicking on the “HTML & Javascript” button in the “Share” tab of your typebot. Here is an example:See all possible settings
See all possible settings
Bubble
You can get the bubble HTML and Javascript code by clicking on the “HTML & Javascript” button in the “Share” tab of your typebot. Here is an example:See all possible settings
See all possible settings
Custom button position
You can move the button with some custom CSS on your website. For example, you can place the bubble button higher with the following CSS:Hide preview message after interaction
You can hide the preview message after the user has interacted with the bot. For example, this code will show the preview message only until the user has either launched the bot or dismissed the preview message:localStorage
API to remember the state of the preview message.
Commands
Here are the commands you can use to trigger your embedded typebot:-
Typebot.open()
: Open popup or bubble -
Typebot.close()
: Close popup or bubble -
Typebot.toggle()
: Toggle the bubble or popup open/close state, -
Typebot.showPreviewMessage()
: Show preview message from the bubble, -
Typebot.hidePreviewMessage()
: Hide preview message from the bubble, -
Typebot.reset()
: Resets remembered state of the bot (only useful ifRemember user
is enabled), -
Typebot.setPrefilledVariables(...)
: Set prefilled variables. Example:For more information, check out Additional configuration. -
Typebot.setInputValue(...)
: Set the value in the currently displayed input. -
Typebot.sendCommand(...)
: Send a command to the bot. -
Typebot.reload()
: Reload the bot.
For each command you can pass an optional
id
prop to target a specific typebot. I.e. Typebot.open({ id: 'my-bubble' })
Callbacks
If you need to trigger events on your parent website when the user interact with the bot, you can use the following callbacks:Additional configuration
You can prefill the bot variable values in your embed code by adding theprefilledVariables
option. Here is an example:
Current URL
variable with “https://my-site/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://typebot.io?User%20name=John%20Doe), the variables will automatically be injected to the typebot. So you don’t need to manually transfer query params to the bot embed configuration.