How to trigger events and/or pass values from Landbot to the container site

Pau Sanchez Updated by Pau Sanchez

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

In some cases we might want to trigger events or pass values from the bot to the parent site where a Landbot is embedded. Maybe we need to change the design of the page, to show the progress, or to trigger other actions.

In this example we will show how to trigger a redirection to a call, but the same principle works for other cases like a progress bar for example

Trigger actions in Container site: example Click-to-Call

This Workaround is suitable for embedded bots. It is not intended to be used with the Share URL option.

The process will be as follows:

  1. In our bot, after a button we will add a Code Block, like in the picture below:

With the following code:

Landbot.send('sendto','tel:+3411223344')

Change the phone number according to your needs.

  1. In the site where the bot is embedded you need to add the following code (it will trigger the redirection):

myLandbot.on('sendto',(data) => { 
window.location.href = data;
})

How did we do?

Contact