@typebot.io/js
Javascript library to display typebots on your website
- Static
- Latest Patch
- Latest Minor
- Latest Major
- 0.8.8
- 0.8.7
- 0.8.6
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.92
- 0.3.91
- 0.3.90
- 0.3.89
- 0.3.88
- 0.3.87
- 0.3.86
- 0.3.85
- 0.3.80
- 0.3.79
- 0.3.78
- 0.3.77
- 0.3.76
- 0.3.75
- 0.3.74
- 0.3.73
- 0.3.72
- 0.3.71
- 0.3.70
- 0.3.69
- 0.3.67
- 0.3.66
- 0.3.65
- 0.3.64
- 0.3.63
- 0.3.62
- 0.3.61
- 0.3.60
- 0.3.59
- 0.3.58
- 0.3.57
- 0.3.56
- 0.3.55
- 0.3.54
- 0.3.53
- 0.3.52
- 0.3.51
- 0.3.50
- 0.3.49
- 0.3.48
- 0.3.47
- 0.3.46
- 0.3.45
- 0.3.44
- 0.3.43
- 0.3.42
- 0.3.41
- 0.3.40
- 0.3.38
- 0.3.37
- 0.3.36
- 0.3.35
- 0.3.34
- 0.3.33
- 0.3.32
- 0.3.31
- 0.3.30
- 0.3.29
- 0.3.28
- 0.3.27
- 0.3.26
- 0.3.25
- 0.3.24
- 0.3.23
- 0.3.22
- 0.3.21
- 0.3.20
- 0.3.19
- 0.3.18
- 0.3.17
- 0.3.16
- 0.3.15
- 0.3.14
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.92
- 0.2.91
- 0.2.90
- 0.2.89
- 0.2.88
- 0.2.87
- 0.2.86
- 0.2.85
- 0.2.84
- 0.2.83
- 0.2.82
- 0.2.81
- 0.2.80
- 0.2.79
- 0.2.78
- 0.2.77
- 0.2.76
- 0.2.75
- 0.2.74
- 0.2.73
- 0.2.72
- 0.2.71
- 0.2.70
- 0.2.69
- 0.2.68
- 0.2.67
- 0.2.66
- 0.2.65
- 0.2.64
- 0.2.63
- 0.2.62
- 0.2.61
- 0.2.60
- 0.2.59
- 0.2.58
- 0.2.57
- 0.2.56
- 0.2.55
- 0.2.54
- 0.2.53
- 0.2.52
- 0.2.51
- 0.2.50
- 0.2.49
- 0.2.48
- 0.2.47
- 0.2.46
- 0.2.45
- 0.2.44
- 0.2.43
- 0.2.42
- 0.2.41
- 0.2.40
- 0.2.39
- 0.2.38
- 0.2.37
- 0.2.36
- 0.2.35
- 0.2.34
- 0.2.33
- 0.2.32
- 0.2.31
- 0.2.30
- 0.2.29
- 0.2.28
- 0.2.27
- 0.2.26
- 0.2.25
- 0.2.24
- 0.2.23
- 0.2.22
- 0.2.21
- 0.2.20
- 0.2.19
- 0.2.17
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.80
- 0.0.79
- 0.0.78
- 0.0.77
- 0.0.76
- 0.0.75
- 0.0.74
- 0.0.73
- 0.0.72
- 0.0.71
- 0.0.70
- 0.0.69
- 0.0.68
- 0.0.67
- 0.0.66
- 0.0.65
- 0.0.64
- 0.0.63
- 0.0.62
- 0.0.61
- 0.0.60
- 0.0.59
- 0.0.57
- 0.0.56
- 0.0.55
- 0.0.54
- 0.0.53
- 0.0.52
- 0.0.51
- 0.0.50
- 0.0.49
- 0.0.48
- 0.0.47
- 0.0.46
- 0.0.45
- 0.0.44
- 0.0.43
- 0.0.42
- 0.0.41
- 0.0.40
- 0.0.39
- 0.0.38
- 0.0.37
- 0.0.36
- 0.0.35
- 0.0.34
- 0.0.33
- 0.0.32
- 0.0.31
- 0.0.30
- 0.0.29
- 0.0.28
- 0.0.27
- 0.0.26
- 0.0.25
- 0.0.24
- 0.0.23
- 0.0.22
- 0.0.21
- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
Typebot JS library
Frontend library to embed typebots from Typebot.
Installation
Using npm
To install, simply run:
npm install @typebot.io/js
Directly in your HTML
<script type="module">
import Typebot from 'https://cdn.jsdelivr.net/npm/@typebot.io/js@0/dist/web.js'
Typebot.initStandard({
typebot: 'my-typebot',
})
</script>
<typebot-standard style="width: 100%; height: 600px; "></typebot-standard>
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:
<script type="module">
import Typebot from "https://cdn.jsdelivr.net/npm/@typebot.io/js@0/dist/web.js";
Typebot.initStandard({
typebot: "my-typebot",
});
</script>
<typebot-standard style="width: 100%; height: 600px; "></typebot-standard>
This code is creating a container with a 100% width (will match parent width) and 600px height.
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:
<script type="module">
import Typebot from "https://cdn.jsdelivr.net/npm/@typebot.io/js@0/dist/web.js";
Typebot.initPopup({
typebot: "my-typebot",
apiHost: "http://localhost:3001",
autoShowDelay: 3000,
});
</script>
This code will automatically trigger the popup window after 3 seconds.
Open or Close a popup
You can use these commands:
Typebot.open();
Typebot.close();
Typebot.toggle();
You can bind these commands on a button element, for example:
<button onclick="Typebot.open()">Contact us</button>
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:
<script type="module">
import Typebot from "https://cdn.jsdelivr.net/npm/@typebot.io/js@0/dist/web.js";
Typebot.initBubble({
typebot: "my-typebot",
previewMessage: {
message: "I have a question for you!",
autoShowDelay: 5000,
avatarUrl: "https://avatars.githubusercontent.com/u/16015833?v=4",
},
theme: {
button: { backgroundColor: "#0042DA", iconColor: "#FFFFFF" },
previewMessage: { backgroundColor: "#ffffff", textColor: "black" },
chatWindow: { backgroundColor: "#ffffff" },
},
});
</script>
This code will show the bubble and let a preview message appear after 5 seconds.
Open or close the preview message
You can use these commands:
Typebot.showPreviewMessage();
Typebot.hidePreviewMessage();
Open or close the typebot
You can use these commands:
Typebot.open();
Typebot.close();
Typebot.toggle();
You can bind these commands on a button element, for example:
<button onclick="Typebot.open()">Contact us</button>
Additional configuration
You can prefill the bot variable values in your embed code by adding the prefilledVariables
option. Here is an example:
Typebot.initStandard({
typebot: "my-typebot",
prefilledVariables: {
"Current URL": "https://my-site/account",
"User name": "John Doe",
},
});
It will prefill the 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.