Table of Contents
Webhook Block: Simplify API Integrations in Landbot
Note: If you already have experience with REST API then this article is for you! If not, we recommend checking out our beginner's guide to the webhook block
Prefer watching to reading? No problem, we've got you covered đ
There may come a time when you need your chatbot to go outside the bot builder's scope and connect it to a third-party service. Maybe you have a CRM you want to synchronize with your chatbot, or you want to pull data from an existing Google Spreadsheet document or update the records on a database.Landbot has a number of native integrations that let you do just that with a number of services such as AirTable, MailChimp, Zapier and many more. For everything else there's Webhooks!
Landbot has several native integrations that allow you to do that with multiple platforms such as AirTable, MailChimp, Zapier, and many more. And for everything else, there are Webhooks!
What is the Webhook Block?
First, we need to understand what webhooks are and how they work. Basically, a webhook is a way for one system to send real-time data to another system when a specific event occurs. Thanks to the Webhook block, we can send data collected in a bot to external apps or servers, or bring data from outside sources (e.g. API, CRM, etc.) to the bot.
Webhooks allow your bots to interact with external services (such as APIs or servers) by performing different actions known as RESTful operations. These operations let you retrieve, update, add, or delete data using specific HTTP methods:
- POST
- GET
- PUT
- PATCH
- DELETE
Accept only HTTPS.
Has 30-second timeout.
Setting Up the Webhook Block
URL & Method

In this section, you can set:
- The HTTP method used (GET, POST, PUT...)

- And the URL (endpoint) of the external API:

If you want some parts of your URL to be dynamic based on user attributes or inputs, you can insert fields from the picker:
- Fields will only work in the URL path, not base URL â¶ domain.com/@{field} â , @{field}.domain.com â
- Custom fields will be formatted as @{field} and system fields as ¿·@fields·?. See below for an example:

If you want to attach parameters to the end of the URL, we recommend setting them up in the Send Params section.
Send Params
If you want to attach parameters (e.g.?user=Elon) to the end of a request URL, you can set them up in this section as Key-Value pairs.

The Added parameters will appear in the Preview URL in green:

Customize Headers
Headers in HTTP requests are commonly used for authorization, specifying the content type, etc.
By default, headers are disabled. If you want to send headers as well, just switch this section on:

You can set headers as key-value pairs too. Once set up, they will be sent in JSON format in an actual request.
The specific headers you need will depend on the API you are connecting. Here are some common examples:
- Specify content type as JSON format â¶ Content-Type: application/json
Bear in mind that for this type, all the fields in the body of the requests must have a value.
- Authenticate API key â¶ Authorization: Bearer 1234567ABC
- Specify user agent â¶ User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1
Customize the body
If you need to send information in the request body instead of the URL, you can add it to the âCustomize Bodyâ section:

Here is an example of a body formatted correctly in JSON:
{
"email": "@email",
"name": "@name",
"custom-field":"@customfield"
}
Test Your Request
You can test if a request works properly in this section:

- Click on Test the request
- It will trigger a real request to your desired API
- Response Status Code and Body will appear below the test button

Manually set values for test variables (OPTIONAL)
If your request contains fields, you might want to manually set their values for testing purposes. You can do so in this section before going through the test request.

Save Response
You might want to save the response of a request as fields every time it's triggered to:
- Split bot flow â¶ For example, check a user's record in your CRM to know if he is an existing customer.
- Display certain data as options in the next step using a Dynamic Data block â¶ For example, Get up-to-date inventory data from the external database and display it as products for purchase.
- Store a record â¶ For example, you can get usersâ data from a third-party API and save it in your own database.
You can do that in the âSave Responses as Fields section:

By default, the entire response body will be saved. If you want to save a specific part of the response, you need to:
- Test Your Request in the previous step first to identify the JSON keys.
- Select the specific value you want to save from the dropdown

- Save it as a field. You can break down the response into however many fields as you want. Keep in mind, though, that itâs not possible to save fields in the Webhook block as Date types because it will break the block.

Advanced Webhook Configurations

As you will see in the builder, the webhook block has a green and red output. The green output is for successful calls and the red output means that the call failed due to an unreachable server.Â
Something to keep in mind is that responses such as 'Forbidden', or 'Not Found' will go through the green output. For these cases, weâll need to use the response routing.
Response Routing
This section allows you to split the flow based on the response status code.

Once you have specified all the paths, go again to the builder and set up the subsequent flows.

Domain Variables

Domain variables allow developers to switch predefined base URLs in a simple manner. Instead of typing a specific URL for each Webhook block in a static manner, Domain Fields can be selected from the Domain Fields button below the URL:

Once a Domain Field is set, you can continue the edit adding the rest of the path, and even add more Landbot Fields by clicking on the Fields button:

Or if needed, you can always delete the current Domain Field and path by clicking on the X next to the URL:

Domain Variables (Headers)
Domain Fields can also be set up with specific Headers. Click on âDomain Fields and select the one you want, and automatically you will see below how the Custom Header changes accordingly.

How to Set Domain Variables
From the Webhook dashboard section, you can add, edit, and delete Domain Fields. Go to the âURL & Methodâ section, click on âSet Domain Fieldsâ and you will be redirected to the Dashboard:


From there, if you want to create a new Domain Field, click on âAdd New Domain Fieldâ and fill out the required information (name, domain URL, and headers, if needed).Â

Change environment (edit a Domain Field)
If at some point you need to change the values of a Domain Field because you are changing from development to production, for example, instead of changing every Webhook, you only need to edit the Domain Field that is being used. The changes will be applied automatically in all your current bots where you are using such Domain Field.
Landbot Public IP
Find here Landbotâs IPs in case you need to whitelist them:
- 34.77.31.159
- 23.251.142.192
Channel Type compatibility
for Web
This feature is fully compatible.
for WhatsApp
This feature is fully compatible with WhatsApp.
for Messenger
This feature is fully compatible with Messenger.