Table of Contents

How to extract data from an external source with Make.com and use it in Landbot

Alexander Gao Updated by Alexander Gao

Introduction

On some occasions, we might want to extract information from an external database (like a CRM, Excel, Salesforce...) based on the inputs from the user in the bot, and use that external data inside the bot.

To do that, Integromat can help you to request such information, but we need to push a little bit further, to prepare Integromat to send to Landbot such information, and once it's ready "tell" the bot to resume flow.

To do this in the article we will show how to:

  • 1. Set up the trigger in Integromat to start the scenario automation
  • 2. Prepare the Trigger automation in Landbot that will trigger the scenario with the information needed (user data and the customer id "@id)
  • 3. Set up a scenario to request external information using the information sent from Landbot, we will use Google Spreadsheets in this example, but it can be adapted to other apps
  • 4.Use the data collected from Integromat and using Landbot API, create a variable in Landbot with that values we collected
  • 5. Resume the flow from a specific block using Landbot API
  • 6. Extract the data from that variable we created before to be used after

Below is an example of the flow:

  • a. Collect the data with Question blocks
  • b. Integromat scenario with a Trigger automation block
  • c. Use formulas to extract values from the recently created variable

As you noticed the Trigger automation block is not connected to the next block. That is because, we will use the Landbot API to tell the bot to "jump" to a specific block, once we have the data ready in Landbot. This method is called "Assign bot".

Trigger scenario with Trigger automation block

Prepare Landbot
  1. First, we have to make a small flow to collect information, like email.
The information that we collect, will be stored in variables, that we will send to Integromat. As in the example below, we are storing the name input in the variable @email, that we will use later
  1. To get the variable @id that we need, we have to set up a message block, to get the exact id.

  1. Then let's set a Trigger automation block.
  1. Then set 3 formulas blocks, with
GetValue(@data, "name") 
GetValue(@data, "email")
GetValue(@data, "age") 

inside of each other.

GetValue returns the value atΒ pathΒ in an object or array. Like here, @data is the array, "name", "email" and "age" from Google sheets (where we will extract data) are the paths, the exact name, email and age are the values:
As we didn't set an exact @data variable inside of Landbot when Integromat returns the data, it will be directly sent to the first formulas block, but in JSON format, like the one in the image:Obviously, it is not an appropriate answer format for our clients. Therefore we use GetValue, to extract only the values (ex. alex, fatimimi@gmail.com, 24).

  1. After that, create 3 messages, with the variables @name, @email, and @age inside:

Create Integromat scenario
  1. After set the whole flow, let's open Integromat:
  1. We need to do is click on Create a new scenario at upper right corner:

  1. Then search Webhook, then click on its icon:

  1. Let's press continue button to move on:

  1. Then it will display this page:

  1. What we should do now is click on Webhooks:

  1. Integromat will ask you to select the type of Webhook, chooseΒ Custom Webhook.

  1. After clicking on Custom Webhook, a small window will appear:

  1. Click on Add button:

  1. Let's give this hook a name:

  1. Don't be in a rush to click on OK, we still have to copy the API address:

Prepare Landbot request to Integromat
  1. Let's get back to Landbot and paste the URL to Trigger automation block:
  1. Now we are going to set the variables we want to send to Integromat.
As you can see we added @id. That is because we need to make sure we send the data to the specific customer. Without @id, we won't be able to send any data back to Landbot or resume the flow
  1. Then let's open the chat, go to Share > Share with a link > Open, then complete the chat (you can close the chat after the trigger is determined):

As you can see here, we didn't set value for @id, because it's Landbot's adaptive variables, Landbot will set it for you automatically.
In Integromat check request data
  1. Now we turn back to Integromat:

Now we see a green sentence 'Successfully determined' this means Integromat has received our variables.

  1. And now you can Click on OK,

Run the scenario
  1. Let's press the button Run once, to run the module for test:

  1. Now let's turn back to Landbot, open the chat, go to Share > Share with a link > Open, then complete the chat:
  1. Now we switch back to Integromat:
  2. We have seen that above the icon of Webhooks, there is a 1 in the bubble, let's click on it:
  1. We can see there are variables recorded:
Yes, the @email and @id are the same as we sent to Integromat: This is how the trigger works, we send variables to Integromat, they receive, and when we try to test it as we did in step 23, it will be shown. After we setup all the scenario, the whole progress will be doing it automatically.
Add a new module of Google Sheets
  1. Move the mouse to the bubble of Webhook, and click on the button of Plus at the right side:

  1. Choose Google Sheets:
  1. Then set action event as Search Rows:
  1. It displays this window:
  1. Then we set our test sheet well, (in the imagen is Test inte), the page, and the variables we want to approve. Here before I have put name, email, and age:
  1. Choose the spreadsheet that we want to extract data from:

  1. Scroll down, and set the reference of search:
  2. Press OK:

  1. (If you have disconnected the blocks, you can ignore this step) Now we disconnect Trigger automation and formulas block, because @data will be analyzed by formulas block once Integromat sends data to the bot, which means it will start with the first formulas block when it gets the data:

  1. Let's press the button Run once, to run the module for test:
  2. Now again, let's open the chat to get all the data, go to Share > Share with a link > Open, then complete the chat:

This step is for collect the information from Landbot and Sheet, so we can use it within the following modules.

Set up the actions through Integromat: CustomerFields - Create

Set action event and method
  1. Now let's move the mouse to the bubble of Sheets, and click on the button of Plus at the right side:

  1. Search HTTP, then click on it:
  1. With actions we select Make a request:

  1. In the method, let's select Post:

Get Landbot API URL
  1. Now let's open the documentation of Landbot API:

  1. Copy the URL of API:

  1. Then turn back to Integromat and paste it to the URL:
Insert the customer ID and adapt variable name
  1. Go to Integromat, replace :customer_id with the ID we sent:
  1. And after that, replace :field_name with data:
Set the body type, content type and request content
  1. Inside of body type we choose RAW, appears Content type inside of it we choose JSON(application/json):
  1. Now let's set the Request content with this JSON code:
{ 
"type": "object",
"value": {
"name":"",
"email":"",
"age":""
}
}

  1. Then we complete the code with the data we have sent before:
Get API token and set headers in Integromat
  1. Now let's turn to Landbot to get the token, by clicking on the avatar > account, scroll down, in the API token:

  1. Copy it:
  1. Go to Integromat, scroll up and press Add a header :
  1. Below the name we type in Authorization, and below the value we type in Token XXXXXXXXXXXXXXXXXX
    (You can also check at the top of the Landbot API documentation, at General )

  1. Then click on Add:

  1. Scroll down and press OK:

Set up the actions through Integromat: Customers - Assign bot

Set action event and method
  1. Now let's set another HTTP module:
  1. In the method, we select Put this time:
Get Landbot API URL
  1. Then let's go to the Landbot API documentation, and go to Assign Bot:

  1. Then copy the URL:
  1. Then turn back to Integromat, and paste it:
Set the customer ID and Bot ID in the URL
  1. Then replace :customer_id with the number we got from the first Webhook module:
  1. To get the bot ID let's open Landbot builder, and find its URL:
  1. Copy the number before builder:
  1. Turn back to Integromat, and replace :bot_id with it:

Set the body type, content type and request content
  1. Turn back to API documentation, copy the body (there's a body we actually need below):
{ "launch": true,
"node": "XXXXXXXX"
}
  1. Inside of body type we choose RAW, appears Content type inside of it we choose JSON(application/json):
  1. Then open Integromat, paste it to request content:

  1. To get the node, let's open Landbot, and click the first formulas block with right click, press copy reference:
  1. Then back to Integromat, replace the code after node with it:

Get API token and set headers in Integromat
  1. Now let's turn to Landbot to get the token, by clicking on the avatar > account, scroll down, in the API token:

  1. Copy it:

  1. Go to Integromat, scroll up and press Add a header :

Authorization Token XXXXXXXXXXXXXXXXXX

(You can also check at the top of Landbot API documentation, at General )

  1. Below the name we type in Authorization, and below the value we type in Token XXXXXXXXXXXXXXXXXX
    (You can also check at the top of Landbot API documentation, at General )

  1. Then click on Add:

  1. Scroll down and press OK:

  1. The whole scenario is done, it should be like this:

  1. To make the scenario works automatically, we have to activate it, so let's turn on the scheduling, and select Immediately:
  1. The whole flow should work like this:

Yes, the information we sent before appears, the action is completed!

How did we do?

Get Opt-ins (Subscribers) from Facebook Leads using Make (ex Integromat)

Contact