Table of Contents

Send variables from your page (the container site) to your embedded Landbot

Pau Sanchez Updated by Pau Sanchez

This article is for Landbot v2 in case you want for Landbot v3 please check this article

We might want to send variables from our site to the bot to continue the conversation, or keep track of a special token.

In this example we will use LiveChat embed and we will have a couple of values like name and email

  1. In the code we use to embed the bot in the container site we will add the following code, as in the picture below:

In this case nameVar and emailVar are the values that will be ready in the site before the bot is loaded, and will be in the same scope as in the following script:

<script> myLandbot.on('landbot-load', () => { 
myLandbot.send('containerVariables', {

Please, bear in mind that in this case we added 'name' and 'email' that will be the names of the variables inside the bot

  1. Inside the bot, we will add a listener that will pass the variables. So we go to the Design / Advanced / Add JS section like in the picture below and add the following code:

Landbot.on('containerVariables', (data) => {
Landbot.exec('landbot-custom-data', data)

  1. Now, if we want to display such variables, we will be able to do it. Only after the Welcome Message!


How did we do?

How to add a Click-to-Call/Email/WhatsApp button

How to build an event registration Landbot (to be used in one screen by many attendees) (web only)