Table of Contents

How to Use the Webhook Block in Landbot

Abby Updated by Abby

How to use the webhook block in Landbot

The webhook block is Landbot's REST API block: it sends, receives, updates, or deletes data in a third-party system and returns a response you can use in your flow. Landbot's native integrations; Airtable, Mailchimp, Google Sheets, and others, cover many common use cases. Use the webhook block when you need to connect to a system without a native integration: a CRM, a custom database, or an internal tool.

Tip: Webhooks are powerful for integrating APIs. If you're building a conversational AI bot, the native AI Agent is often the simpler choice, it interprets user intent, keeps context, and responds dynamically without webhook logic. Learn more in the AI Agent Guide.
Already comfortable with REST APIs? Skip ahead to Webhook Block for Advanced Users.

Prefer watching to reading? Watch the webhook walkthrough video below:

This article walks through every part of the webhook block using a real example: the weather API. The weather API is free, but you'll need to sign up for an API key to follow along.

If you need real-time updates or polling instead of a one-off request, use MessageHooks instead.

How do APIs work?

The diagram below shows the request-response cycle. Read "CLIENT" as "webhook block."

What API terms do you need to know?

Term Definition
API key A unique passcode of letters and numbers that grants access to an API
Endpoint The digital location where an API receives requests about its resources (the url)
Request method Uses HTTP methods (GET, POST, PUT, DELETE) to tell the API what you want it to do
Parameters Adds extra information, such as variables to the endpoint and is used to filter the response
Request body Some APIs require data to be in JSON format, in that case we will use the request body
API call Process of a client (the webhook block) making an API request to a server
Status code A number code that appears in the body of an API response that tells you if your request was successful or not
API server Authenticates and processes API requests before delivering an appropriate response
API response A response generated by the API server and returned to the client (the webhook block)

What is an API key?

An API key is a string of letters and numbers that serves as your access code for an API — like a password, but for machines instead of people. Most APIs require one to authenticate requests and track usage, so only authorized users or applications can access the data.

An API key usually goes in the webhook block's Headers section. The exact header key and value format (Bearer vs. Token) depend on the API you're connecting to.

In the weather API example, Customize Headers stays off, because the API key goes in the Parameters section instead. This is uncommon; most APIs expect the key in a header.

What is an endpoint?

An endpoint is the specific URL where an API receives requests and sends responses. It's where your webhook block connects to another application.

The weather API endpoint looks like this:

⚠️ Warning: The webhook block only accepts HTTPS. If you're following along with the weather API and see an HTTP error, add an "S" after "HTTP" in the endpoint and it will usually work.

If you're not a heavy webhook user, you can ignore the Set Domain Fields button. For more on domain variables, see the advanced users guide.

What request methods can you use?

The webhook block supports four HTTP methods to tell the API what you want to do:

● GET — retrieves specific data from the API

● POST — adds new data to the server

● PUT — updates (overwrites) existing resources on the API

● DELETE — deletes existing data from the server

Additional methods appear in the dropdown, but those are for testing purposes and advanced users only.

What are parameters?

Parameters tell the API exactly what data you want or how to handle your request — they act like filters or modifiers on your request. How parameters are set up, and which ones you can use, depends entirely on the API you're connecting to.

In the weather API example, the parameters are key (the API key) and q (the city you want weather for):

When do you need a request body?

You need a request body when the API you're calling requires data in JSON format. For example, if you collected a user's name, email, and phone number and want to send all of it to your CRM, the request body is where that JSON goes:

Add Fields to the request body using the format "@field". Fields keep their original data type when sent — if a Field holds an integer, it's still sent as an integer even though it's wrapped in quotation marks. For example, the @name Field should be added as "@name".

The weather API example doesn't require a request body, so Request Body stays toggled off.

How do you make and test an API call?

An API call is the full cycle: you make a request, the API retrieves the data, and you get a response back. In Landbot, you make this call by clicking Test the request.

If your request uses parameters, add them manually in this section to test. In the weather API example, add the @city variable to test:

What do status codes mean?

A status code is a three-digit number returned with every request that tells you whether it succeeded. The first digit tells you the category: a code starting with 2 means the request succeeded; a code starting with 4 means something went wrong. Use the status code to understand the outcome of your request and decide your next step.

How do you save the API response?

By default, the webhook block saves the entire API response — you'll still need to add a Field to store it. Outside of testing your flow, you rarely want to save the entire response.

After testing the request, click the purple banner to select the specific part of the response you want to save:

In the weather API example, only the current weather gets saved. The extra data isn't needed.

FAQS & Troubleshooting

Is this compatible with all channels?
Yes. The webhook block works on Web, WhatsApp, Facebook Messenger, and APIchat. For WhatsApp and APIchat bots, you need an integrated number or channel to test it.
What if the response takes longer than 60 seconds?
If your API takes longer than 60 The webhook block times out at 60 seconds. If your API takes longer to respond, make the request through a third party instead, see this example. to respond you make need to make the request in a third-party, here's an example of how you can do that
Why am I getting a 500 error?
If your API request works correctly outside Landbot but returns a 500 error inside Landbot, you likely haven't created a channel yet. WhatsApp and APIchat bots need a channel connected before you can test the webhook block
How can I send files?
You can't send the file itself. When a user uploads a file in the flow, Landbot stores the file and returns its hosted URL as a Field; send that URL instead.
How do I add a listener?
The webhook block doesn't support listening for events. If you're waiting for an event in a third party, trigger an API call to Landbot when that event occurs, see this example.
How can I connect to ChatGPT?
Why am I not getting a response from Make/Zapier?
Automations running outside Landbot — through Make, N8N, or Pipedream — usually take longer than 30 seconds to complete. If you need the automation's result to continue the flow, see this article.
How can I display the data from the webhook as buttons?
If you'd like to display the data from the webhook as buttons you'll need the Dynamic Data block
My bot flow is stopping at the webhook block
Do you have a date type variable saved? That may be why! Webhooks don't currently support date type variables
If that's not it, make sure the red output is also connected to the flow!
How can I debug the API response?
Besides checking the logs we've found the easiest way to debug is adding a message block after the webhook containing all of the variables sent in the webhook as well as a second message block containing the entire webhook response, this gives an overall view of what is happening
Why can't I use the Landbot API inside the webhook?
This is a security measure, if you have a specific use-case where you need to use the API in the flow reach out to our support team! There may be other ways to achieve what you want
Why can't I connect to Google Apps Script
Google Apps Scripts performs a redirect, unfortunately, due to security reasons it's not possible to connect to APIs that perform redirects

Was this article helpful?

Webhook Block Dashboard

Contact