Table of Contents

Webhook Block for Advanced Users

Abby Updated by Abby

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

What is the Webhook Block?

The Webhook block is Landbot’s interface for making RESTful API calls directly from within your bot. If you require real-time updates or polling, use MessageHooks rather than this block.

1. Webhook Configuration

A. Url & method
Screenshot that shows how to type the URL for a Webhook block

  • Choose the appropriate HTTP method: GET, POST, PUT, PATCH, or DELETE.
    Screenshot that shows how to choose the HTTP method used in the Webhook block
  • Input your API endpoint (must begin with https://).

Important: Only HTTPS endpoints are accepted. You will not be able to save or use HTTP endpoints.

Screenshot that shows how to set up the URL of the external API in the Webhook API
  • Dynamic Paths: Insert Landbot fields directly into the URL path: Example: https://api.domain.com/users/@{user_id} (@{field} for custom fields, ¿·@fields·? for system fields)
    Screenshot that shows how fields are formatted in the Webhook block
  • You cannot use dynamic fields in the domain/subdomain section (@{field}.domain.com is not supported)

B. Query Parameters ("Send Params")

  • Add query parameters via Send Params as key-value pairs (e.g., user=Sam).
  • Params are appended to the endpoint URL and highlighted in green in the preview.
Screenshot that shows how to attach parameters to the request URL in the webhook block

The added parameters will appear in the preview url in green:

Screenshot that shows an example of added parameters in the URL

C. HTTP Headers
  • By default, no headers are sent.
  • Enable and set any required headers, such as:
    • Content-Type — e.g. application/json
    • Authorization — e.g. Bearer YOUR_TOKEN
    • User-Agent — Not sent by default; add if required by your API

Note: The required headers depend on the external service. For JSON requests, ensure all body fields have values or the API may reject your call.

Screenshot that shows how to add headers to the request URL in the webhook block

D. Request Body
Screenshot that shows how to customize the body section of a webhook block
  • Only JSON body payloads are supported.
  • Reference Landbot fields using "@field" format inside your JSON.
{
"email": "@email",
"name": "@name",
"customField": "@customfield"
}
  • All field variables must be quoted strings.
  • Invalid or non-JSON payloads will cause a validation error.
Screenshot of a JSON custom body request in the webhook block
Fields must be wrapped in quotes ⟶ "@fields", however they will keep their original format
Meaning if you send an integer, even though it's wrapped in quotation marks it will remain an integer

E. Testing Your API Call
  • Use the Test Request button to send a real API request.
    Screenshot that shows how to test a request in your webhooks block setup
    • Fill in placeholder values for any dynamic fields.
      Screenshot that shows how to manually set values for test fields in your webhook block
    • After the test, you’ll see the response status and body—use this to determine the structure for field saving and routing.
  • Adjust and retest as needed before saving changes.

2. Saving and Mapping Response Data

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

Screenshot that shows how to save your responses as fields using the webhook block
  • By default, the complete response body is stored.
  • To extract specific data, map JSON fields from the API response to Landbot variables:
    1. First, test your request to view the response structure.
    2. Select the desired keys using the dropdown.
    3. Map multiple keys/fields as needed (date types are not supported).

3. Output

  • The Webhook block exposes two outputs:
    • Green: The request received any HTTP response (including 4xx/5xx status codes).
    • Red: The endpoint was unreachable or network error occurred.

4. Advanced Webhook Configurations

A. Response Routing

This section allows you to split the flow based on the response status code.

  • Add custom paths by HTTP status code (range matching not currently supported).
  • If a status code isn’t explicitly routed, the default path is used.
  • Example: Route 200, 404, and 401 separately for different flows.

Tip: Remember to reconnect each output to your flow after editing routes, otherwise connections may break.

Do you need a more practical description of how to use this feature? Check out our guide on how to POST, GET, and more with your bots.

B. Domain Variables
Screenshot that explains what are domain fields in the webhook block

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:

Screenshot that shows how to select domain fields in the webhook block

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:

Screenshot that shows how to select domain fields in the dropdown menu of the webhook block

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

Screenshot that shows how to remove the domain fields in the webhook block

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.

Screenshot that shows the URL and customize headers in the webhook block

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:

Access the webhook dashboard section
Webhook dashboard section

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). 

Screenshot that shows how to add a new domain field

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

Limitations to keep in mind

  • No SOAP/XML support (REST/JSON only)
  • HTTPS only (non-SSL URLs are not accepted)
  • 30-second timeout per request
  • SSL Errors: Landbot does not display SSL errors. If the webhook silently fails, verify your API’s SSL certificate externally.
  • Date type variables not currently supported in webhook block

FAQs & Troubleshooting

Why am I getting a 500 error?
If your API request is working correctly outside of Landbot, but you are getting a 500 error inside of Landbot it may be because you haven't created a channel yet, for WhatsApp and APIChatbots you need to have a channel to test the webhook block
How do I know if the issue is with Landbot or with my API?
Try testing it Postman, if it works there it should work in Landbot!
Can I extend the webhook timeout?
Unfortunately, not for requests over 30 seconds you will need to execute them in a third party here's an example of how you can do that
Is this compatible with all channels?
Yes! You can use the webhook block in all channels (in WhatsApp you need to have a number integrated to test)
How can I send files?
When a user uploads a file in the flow Landbot stores the file and returns the url where the file is hosted as the variable, unfortunately it's not possible to send the file itself, but you can send the url where the file is hosted
Here's a workaround to download the file
Can I connect to MySQL?
Not inside of Landbot, but you can use this workaround
How do I add a listener?
The webhook block does not have listening capabilities, if you are waiting for an event in a third party you will need to trigger an API call to Landbot when that event occurs, here's an example
What grade SSL certificate do I need?
In order to connect to Landbot you'll need a grade A SSL certificate, you can find the rating here

Was this article helpful?

Webhook Block Dashboard

Contact