...

Survey Bot Tutorial: Personalize Questions in Real Time Using AirTable & Formulas

Illustrator: Jana Pérez
advanced survey bot tuturial

Please note that 'Variables' are now called 'Fields' in Landbot's platform.

Please note that 'Variables' are now called 'Fields' in Landbot's platform.

If you have mastered building a basic survey bot or are simply looking for more sophisticated tips and tricks, this is a tutorial for you! You see, just because Landbot, and advanced chatbot platform, is easy to use it doesn’t mean you can only achieve simple things. The variety of no-code features allows for an equal variety of sophisticated and smart solutions.

To give you an example, I will show you how to set up an Airtable webhook in a conversational survey that adjusts the flow to customer responses in real-time.

Check the video for the sneak-peak into the final result:

So, in this survey, we asked our customers which Landbot features they use in their bot building and then rate those features.

I. Set Up Airtable

Create a new sheet in Airtable to store your survey data.

airtable-project-set-up

II. Define Your Questions

In essence, this survey will only contain 4 questions:

  • “Which features have you used to build your bots?” – Buttons (Multiple Choice)
  • “How would you rate the “feature”?” – Scale (1-5)
  • “Would you recommend Landbot to a friend or colleague?” – Scale (1-5)
  • “Please share your feedback about any of the mentioned features:” – Text Block (Free Input)

When setting up your Buttons block, ensure you enable “Multiple Choice” and establish a variable to save the answer.

In fact, make sure each of your questions has a designated variable to save the user’s answer.

survey-bot-questions

The variables we created are:

@features – to represent selected features in the multiple-choice
@feature_rating – to represent user rating of the selected features
@nps – to present the probability of the client recommending our products
@feedback – to represent the free input question

Now we need to ensure that:

  • The bot asks for the rating of the user-selected features before continuing to the next question
  • The collected data updates in Airtable

III. Airtable Webhook Integration

To create the Airtable webhook, draw an arrow from the multiple-choice question block and select “Webhooks” option from the features menu:

airtable-webhook-landbot

You must get the App ID in Airtable to build the Webhook’s URL.

The structure of it should look like the following:

https://api.airtable.com/v0/<app_id>/<nameofthebase>

To obtain this URL, go to Airtable, click Help in the upper right corner and then select API Documentation.

airtable-api-documentation

A new page will load. Select “AUTHENTICATION” and copy the URL under “EXAMPLE USING BEARER TOKEN (RECOMMENDED)”

In our case that would be:

https://api.airtable.com/v0/appwz4ws9b6VDg2sp/Survey%20Data

  • <app_id> equals appwz4ws9b6VDg2sp
  • <nameofthebase> equals Survey%20Data (as based on the name of the Airtable sheet we created)
airtable-api-setup

This is how it will look in the Webhook block:

airtable-webhook-url-setup

Note: Keep the Webhook action on POST in this setup as at this stage we will be sending the user answer to the Airtable.

Next, active the “Customize Headers” section:

webhook-customize-headers

For the webhook to work, you need to obtain an authorization in the form of the API key.

If this is the first time you are setting up an Airtable webhook with your account you will need to generate your API key first:

  • Click “account” in the Authentication documentation
generate-api-key-on-airtable
  • When a new page with your account information opens, click to generate the API Key
airtable-account-api-key-generation

Now, if you reload your API Documentation page you will see a “Show API Key” box in the upper right corner:

airtable-api-setup

Tick the box and the API key will appear in the place of YOUR_API_KEY”

Please copy the Key for from “Bearer” until the end of the text.

In the Webhook block, type “Authorization” in the first field of the header and paste the key in the second section:

webhook-authorization-landbot

Click the + sign to create another header field and fill it in as follows:

send-data-in-json-webhook-setup

This header field lets Airtable know in which format it will receive the data (application/json).

Next, move on to optimize the “Body” section of the webhook.

At this point in our survey example, we want to create a record with one value.

For the field “Customer ID” we want to send the variable @id.

This is how this information will look in JSON:

{"records":[{
"fields":{
"customerid":"@id"
}
}]
}

webhook-request-body

Now it’s time to check if our setup has been correct using the test section.

To do so we need to build a “body” and give a test value to the variable @id.

est-airtable-webhook

Above, you can see I am testing the webhook by giving the @id variable value “12345”

{
"id":12345
}

When all is set up, press the TEST button.

run-webhook-test

In our case, the test status is 200 and according to the test response, it seems a new record was created successfully. To be sure just check your Airtable sheet.

The test should have created a new row with the test customer ID:

webhook-setup-success

Now that the test was successful move on to the last section of the webhook – Save Response.

This section will capture the values from the response for later use.

POST action in webhook, let’s us create a new row (record) in Airtable. When it’s done, it automatically generates an Aritable ID, this will be the number we will use as a reference to update these rows later.

So, in the “Seve Response” section we will save the records.0.id under a new variable @airtable_id:

airtable-webhook-response-setup

The final set up will look as follows:

airtable-id-webhook-response

Next, continue to create another response. This time select “records” and associate it with a new variable in an array format.

An “array” is a programming term but don’t let that put you off. It describes a data structure, which stores “a collection of elements of the same data type”.

Simply put, it’s a collection of variables of the same type, much like the collection of feature choices our customers will select in the multiple-choice block.

airtable-response-2

Note: “Records” must be in the array format in order for the bot to work (Visit our knowledge base for more information).

Once both your responses are set up, click SAVE to guard the configuration of your webhook:

airtable-webhook-responses

You did it!

IV. Process Selected Features

Now, that we have created a record of a new customer on our Airtable sheet, we need to process their feature selection.

Given the question is a multiple-choice, the user can select all, some or just one of the options.

We want to ensure that the bot asks them to rate only those features they said they had used previously.

For that, we need to use the Landbot feature called “Formulas”.

Formulas in Landbot are much like formulas in an Excel spreadsheet or Google sheets, they allow you to make simple or advanced calculations with the bot without coding.

Draw an arrow from your Webhook block and select Formulas block from the Menu.

The Formulas block has two main sections:

  • Output – the variable under which you want to save the result of the formula
  • Formula – the part where you define the action/calculation to be carried out
landbot-formulas-block

So what do we need to do first?

When a user picks several different options the @feature variable value includes commas. E.g., Google Sheets, Webhook, Jump to, Code Block

Hence, our first point of order will be using the commas as separator indicators and use them to help us separate the individual features under @features variable using formulas.

To achieve this we will use:

  • an output variable in the form of an array
  • the “Split” formula which you can retrieve from a cheatsheet in the bottom section of the Formulas settings bar:
formulas-cheat-sheet

First, create a new variable so save this operation in an array format:

formulas-output-setup

Next, configure the formula.

Example in the cheat sheet shows the following setup with a specific data point (the date)

  • Split(“2019/02/24”, “/”)

In the example, the “/” is the separator indicator and the elements to be separated are the number.

We want to split whatever is stored under the @features variable and our separation indicator is a comma. Hence, our formula will look like this:

Split(@features,", ")

split-formula

Click save and let’s move on.

Now that the features are separated and stored in an array, we need to count how many the customer actually chose.

So we will use the Array Length formula (vid cheat-sheet) to count the number of elements in the previous formula output.

Length(@features_array)

The setup will look as follows:

lenght-formula-setup-survey bot

Make sure you choose the right variable format (NUMBER) for the @number_of_features variable.

Now that we have separated and established a way to determine the number of selected features, we need to create a counter that will calculate if the bot asks the rating about all the features the user picked.

For instance, if the user selects two features the bot will know to ask for the rating two times and then continue to the next question.

V. Set up Index to Enable Counter Function

The first step to take is setting up a new variable that will act as a base value.

Draw an arrow from your last formula and select the “Set a Variable” block. Here, create a new numeric variable called @index and set its value at 0.

set-a-variable-index

Click SAVE and create another Formulas block.

This Formula will tell the bot which of the features under @features_array variable it should ask about.

In an array, each of the features selected by the user has its position, e.g., Google Spreadsheets = 1, etc.

We will use the Array GetValue formula and @index variable to “retrieve” the right feature from the array and ask about it.

GetValue(@features_array, @index)

Set up your block as follows:

get-value-formula

In essence, this formula will retrieve the feature from the array (collection of features) based on the value of the @index.

The starting value of @index is 0 but it will update each time the bot passes through the feature rating question.

VI. Export Rating Data to Airtable

Connect your sequence to the Feature rating question “Scale” block we set up at the start.

Here, instead of including a specific feature in the question, use our last formula output variable @feature_to_ask.

And create a variable to save the user’s response.

question-scale-customer feedback

After the customer submits their rating, you need to get this data to the Airtable sheet.

But before you send them there through the webhook, we need to transfer the format from array to JSON (once again using a formula).

Remember, when we were setting up the webhook, we defined that our data will be sent in “application/JSON” – well, that’s why we need to get this done.

Luckily there is a dedicated formula that takes care of putting data into JSON format – human-readable text to store and transmit data objects.

So, the data we want to send into the Airtable spreadsheet is the feature for which the bot requested rating and the rating itself. This translates into two variables:

  • @feature_to_ask
    @feature_rating

Draw a green arrow from the rating block and create a Formulas block and check the cheat sheet for the formula:

ToJSON-cheat-sheet

Our formula, since we are using variables and not hard data, will look as follows:

ToJSON('{"@{feature_to_ask}":"@{feature_rating}"}')

It basically pairs the feature with the selected rating.

to-json-formula-setup

Before moving on, set up the output variable in the array format. I decided to call it @fields since this information will be updating the Airtable fields.

Now it’s time for another Airtable webhook. But don’t worry, you don’t have to go through the whole thing again. Just create a copy of the webhook you already set up and let’s make some adjustments to it.

copy-webhook

The first adjustment to make is changing the webhook action from POST to PATCH.

It’s because this time we will not be POSTING new information to create a new row but PATCHING information into an existing row.

airtable-webhook-PATCH

Next, you need to update the webhook URL with the @airtable_id variable so the webhook knows which row to update. Simply add your variable to the existing webhook URL:

https://api.airtable.com/v0/appwz4ws9b6VDg2sp/Survey%20Data/@aritable_id

Since this time we are updating the fields, not the customer ID, scroll down and update your “Request Body” to:

{"fields":"@fields"}

webhook-request-body

To run a test, you need an actual Airtable ID.

There is a simple trick to obtaining it. Go back to your first Airtable webhook, delete the existing flow for a moment and link the webhook to a message block with @airtable_id variable

retrieve-airtable-id

Go to preview and follow the bot flow. When the bot gets to the webhook, it will give you back the ID you need test your PATCH webhook:

retrieve-airtable-id

Now if you check your Airtable, these will be a new row but the ID will have transformed into a numerical form – hence the reason you can’t just copy the ID from Airtable directly:

airtable-id

So copy the ID from the chat and let’s go!

ATTENTION: Do not forget to delete the message block and connect the webhook back to the original flow!

Go back to your second webhook and enter the ID – recNFd5JXPpaObZwW – into the sequence to test variable values:

{
"airtable_id":"recNFd5JXPpaObZwW",
"fields":{
"Google Spreadsheets":"66"
}
}

Click TEST!

We can see that our set up was successful as we got 200 status and the customer record has been updated:

test-airtable-patch-webhook

Once again, if you check the spreadsheet, you will see the row updated with the correct information.

webhook-patch-test-successful

Now all is left is setting up the “Save Response” section. This time, quite simply, reuse the @response variable in an array format.

save-webhook-response

VII. Enable Counter

Drawing an arrow from your newly setup PATCH webhook, create a “Set a Variable” block. We are going to modify our @index variable by performing a calculation.

perform-calulcations-index-variable

So, @index will start with a 0 value, but every time it passes through the feature rating block its value will increase by 1.

This will allow us to match the number of times the bot asks the user to rate a feature with the number of features the user selected.

Hence, now that we have a counter in place, we need a conditional block!

Our condition will be:

IF @index IS LESS THAN @number_of_features THEN

set-up-conditional-logic-block

Now if it’s TRUE and @index really is LESS then @number_of_features the user selected, draw an arrow from the green output, and connect it with the “GetValue” formula that precedes the rating question.

This time, since the value of @index has changed, the formula will retrieve the feature from the array that corresponds to the index number.

For instance, imagine a feature array with these selections:

[‘Google Spreadsheets’, ‘ Jump to’, ‘ Dynamic Data’, ‘ Code Block’, ‘ Custom CSS’]

After having the “length” variable to count the number of features, each of them corresponds to a number:

  • Google Spreadsheets – 0
  • Jump to – 1
  • Dynamic Data – 2
  • Code Block – 3
  • Custom CSS – 4

The GetValue formula tells us which of the values to retrieve as with each passing loop the value of @index increases… until it reaches the number when @index WILL NOT BE LESS THAN @number_of_features.

Then the bot will follow the PINK output to the next question:

chatbot-survey

VIII. Set up the Rest of the Questions

Now the hardest part is behind you… All you need to do is repeat this for every following question:

  • Use to ToJSON formula to convert the data into the right format
  • Copy the Airtable “PATCH” webhook to upload the data (no changes necessary)

For instance, for the question about recommending Landbot to a friend our set up would look like this:

upload-data-to-airtable

The Formula set up will be the same and the output variable will be once again @fields. So, all you need to do is update the data inside the JSON to the variable you used to save the user’s answer.

As for the “Airtable” PATCH webhook, just copy the last one you set up and connect it to the flow. Still, always TEST the webhook to ensure everything is working correctly

The last of our four question blocks was a simple TEXT block asking for free user input. Since the answer is just plain text, you don’t need to use the “ToJSON” formula to format it and just go ahead straight to the webhook.

However! Make sure to update the “REQUEST BODY” of your copy of the PATCH webhook. We saved our free answer under @feedback instead of @fields.

airtable-webhook-advice

And there you have it!

A clever chatbot survey:

customer feedback survey-chatbot

Yes, the process is a bit longer and more complex but once you get a hang of it, it really isn’t much harder than setting up the simple flow.

IX. Troubleshooting

Setting up a number of format-sensitive fields does increase the margin for error.

If your bot is not working, and you are not sure why there is a simple way to find the culprit that’s causing the problem.

With formulas, you are dealing with a lot of “operational” @variables which content you don’t get to see in your spreadsheet or CRM. Visualizing them helps to catch the inconsistencies or errors. To see the contents of one of these “hidden” variables interrupt your flow just for a moment.

Draw a green arrow from the formulas, webhooks, or another block which variable you want to examine and select the “Send a Message” block. Inside, insert the variable in question.

See example below:

troubleshooting

Click SAVE and complete a test conversation.

Next, go to SHARE ➡ Share with a Link ➡ Click to open the bot link in a new tab and go through the conversation. You will see the variable appear in the message and so be able to spot wrong formatting or error reports.

feedback chatbot troubleshooting

Good luck!

Frequently Asked Questions about Landbot Pricing

What’s a Landbot chatbot template?

There are three ways to go about building a conversational app with Landbot:

1 - Do it all from scratch but still without coding

2 - Use only a few pre-made elements (bricks)

3 - Pick and customize a pre-designed template


There’s no need to reinvent a flow if our conversational experience designers already built a chatbot template for your use case. Before committing to a free sign up or a specific template, you can always use the preview function to try out the end-user experience. When you do load your chosen template, you’ll see the conversational flow all set up for you with guiding notes when needed.

All you have to do is customize the content inside the flow that’s already there. Edit the text, images, gifs, and links in the blocks so they fit your brand and product!

What’s the difference between a chat, a WhatsApp chat, and an AI chat?
  • A chat in Landbot represents a structured conversation between your bot and an end user, following a rule-based flow for web chatbots. It guides the user through specific tasks using buttons, keyword triggers, and decision trees with predetermined responses.

  • A WhatsApp chat in Landbot is a conversation between your bot and an end user on WhatsApp, following Meta’s messaging rules. When an end user messages your bot, a 24-hour window opens, allowing free responses, and the interaction counts as a WhatsApp chat in your Landbot plan. After 24 hours of inactivity, only pre-approved Message Templates can be sent, which you can manage directly in the Landbot platform.

  • AI chats incorporate AI functionalities, leveraging Landbot’s AI feature blocks or AI Assistants for lead generation, FAQs, or appointment booking. This enables the bot to understand intent and provide personalized, real-time responses instead of relying solely on predefined flows. AI chats are tracked and billed separately from regular chats and WhatsApp chats.

What is considered a “seat” in a Landbot plan?

A seat refers to a user license that grants an individual access to the Landbot platform under a specific account. Each seat allows one team member to log in, build, manage, and collaborate on chatbots. The number of seats included depends on your subscription plan, and additional seats can be purchased on all paid plans.

What subscription plans does Landbot offer?
  • Starter: Ideal for individuals and small businesses looking to create website chatbots effortlessly.

  • WhatsApp Starter: Perfect for small teams and businesses automating conversations across websites, Messenger, and WhatsApp.

  • Pro: Great for growing teams that need advanced features, automation, and integrations for website chatbots.

  • WhatsApp Pro: Best for businesses looking to scale customer interactions on WhatsApp with automation and rich messaging capabilities.

  • Business: Tailored for enterprises that require a fully customized chatbot solution with premium support and integrations for all channels.

How does the 14-day free trial work?

New sign-ups to the Landbot platform receive a 14-day free trial with access to all Landbot features and channels. After this period, the account is automatically downgraded to the Sandbox (Free) plan, which has certain limitations. You can upgrade to a paid plan should you wish to continue using Landbot’s premium features.

How is my subscription charged?

Your credit card is automatically charged at the start of each billing period. For monthly plans, the charge is processed on the first day of each new monthly cycle, while for annual plans, it occurs on the first day of the new yearly cycle.

Can I change my subscription plan later?

Yes, you can upgrade or downgrade your subscription plan anytime within the Landbot platform. Changes will be applied according to Landbot's billing policies.

How many chats are included in the Business Plan?

Our Business Plan is fully customizable to suit your needs, including the number of chats, seats, and WhatsApp Business Account numbers. Please reach out to our Sales team for a personalized quote tailored to your requirements.

What happens when I reach my plan's chats limit?

If you go over your paid plan’s chat limit, extra chats will be charged based on the chat type. Regular chats cost €0.05 per extra chat, while WhatsApp chats also cost €0.05 per chat plus Meta’s additional fee. AI chats are €0.10 per extra chat. Business plans have custom pricing for extra chats.

Are there any plans that only include WhatsApp?

No, all of our plans that include WhatsApp (WhatsApp Starter, WhatsApp Pro, and Business) also grant access to other channels, such as web, API, and Facebook Messenger. These additional channels are included in all WhatsApp plans.

Can I add more than one WhatsApp number to my account?

Yes, you can link multiple WhatsApp Business Account numbers to your Landbot account, but the number of WhatsApp Business Account numbers allowed depends on your plan.

What payment methods does Landbot accept?

We accept Visa, MasterCard, and American Express. Bank transfers are only available for Business plans.

What currency will I be billed in?

Subscriptions are billed in Euros (€) for most customers. However, customers in the following countries will be billed in US Dollars ($): Argentina, Bolivia, Brazil, Chile, Colombia, Costa Rica, Cuba, Ecuador, El Salvador, French Guiana, Grenada, Guatemala, Guyana, Haiti, Honduras, Jamaica, Mexico, Nicaragua, Paraguay, Panama, Peru, Puerto Rico, the Dominican Republic, Suriname, Uruguay, the USA, and Venezuela.

Does Landbot use the official WhatsApp Business API? How does the application process work?

Yes! Landbot uses WhatsApp’s official API to integrate the most popular instant messaging app. The API offered by Facebook(Meta) is under constant improvement, the reliability is fantastic and generates a frictionless experience for your users and for your team. To review which type of enterprises, businesses and brands WhatsApp accepts at the moment, please read our WhatsApp API application guide.

Landbot’s onboarding team helps you in the application process. Once you sign up for Landbot’s WhatsApp solution, our team will ask you to submit the required information and initiate the application process on your behalf. The entire process usually lasts around 1-2 weeks, regardless of which provider you work with. We take utmost care to ensure each business we collaborate with has their application approved, managing the application process at every step of the way. However, ultimately, the final approval decision rests with WhatsApp.

Can I start building my bot before my WhatsApp API access is approved?

Landbot’s special WhatsApp Test environment feature allows you to build and test your WhatsApp bot before your API application gets approved.

This is possible because the testing channel is a closed one, and only allows communication between the Landbot interface and the phone number you associated with the test account. So you can already test your WhatsApp bot with your own phone, and have it ready to be published live to your users when the access is approved by WhatsApp.

Do you offer support resources on WhatsApp bot creation?

Yes, you have access to a large collection of support resources including WhatsApp guides, documentation and academy videos to help you get the most out of the WhatsApp chatbot builder and campaign manager. Listed below are some of the resources:

- How to Create a WhatsApp Bot: Step By Step Guide
- How to Create & Test your WhatsApp Chatbot: Video Guide
- Landbot Academy: WhatsApp

What is the WhatsApp opt-in and how does it work?

WhatsApp opt-in is the active consent users have to give you before you can contact them via WhatsApp. Opt-ins need to be done via a third-party channel. You can learn more about WhatsApp opt-ins and how they work here.