How to Get Your Data From Landbot.io

Austin Meyer
2 min readJul 30, 2018

--

Landbot.io is great, but it can be a bit of a process to get that sweet, sweet data back from it. Here’s how to send yourself the values that users enter in your landbot.io chatbot.

Step one. Put an iframe with your landbot url on your page:

<iframe 
name=”my-bot”
width=”100%”
height=”100%”
frameborder=”0"
src=”https://landbot.io/u/YOUR_LANDBOT_URL/index.html"
></iframe>

Step two. Add the following script to your page. This will allow you to create an access point for your chatbot:

<script src=”https://static.landbot.io/umicore/UmiAccessPoint.js"></script>

Step three. Create an access point:

const myBot = new LandbotAP(“my-bot”);

Step four. Add a listener to your access point. color-selected is just an example, call the event whatever ya darn well please.

landbot.on(“color-selected”, (data) => {
console.log(“My data: “, data);
// do whatever you want with this spicy new data
});

Step five. Add this to the text box in the step right after the user inputs the value you want to receive:

{html}<script>
Landbot.send(‘color-selected’, ‘@color’);
</script>{/html}

If you want to sent multiple variables, send an object with your arguments:

{html}<script>
Landbot.send(‘color-selected’, {
color: ‘@color’,
name: ‘@name’
});
</script>{/html}

Done! Happy chatbottin’!

Join my email list with billions of your fellow Chatbot Lords for more insights on hacking into the mainframe.

--

--

Austin Meyer
Austin Meyer

Responses (1)