Table of Contents

Webhook

Austin Yang Updated by Austin Yang

For Web Bot

Sometimes we need to 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 — we can achieve this with the Webhook block.

Webhook lets your bot perform RESTful operations with external webhooks, APIs, or servers using the following HTTP Methods:

  • POST
  • GET
  • PUT
  • PATCH
  • DELETE
  • HEAD
  • CONNECT
  • OPTIONS
  • TRACE

Landbot Webhook blocks do not accept XML, only JSON

URL & Method

In this section, you can set:

  1. HTTP method used (GET, POST, PUT...)
  2. URL (endpoint) of the external API

If you want to make parts of the URL dynamic based on user attributes or inputs, you can insert variables from the picker:

  • Variables will only work in the URL path, not base URL ⟶ domain.com/@{variable} ✅ , @{variable}.domain.com
  • Custom variables will be formatted as @{variable}, and system variables as ¿·@variable·?. See below for an example:

If you want to attach parameters to the end of URL, it's best to set them up in Send Params section.

It's important that the service that your are working with uses proper SSL Certifications, otherwise the Webhook won't work and no error is displayed. If you have your doubts you can check it in this site

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.

Added parameters will appear in Preview URL in green (NOTE: they won't appear in the URL field where you type)

Customize Headers?

Headers in HTTP requests are commonly used for authorization, specifying content type...etc

By default, headers are disabled. If you want to send headers, just switch this section on:

You can set headers as key-value pairs. Once set up, they will be sent in JSON format in an actual request.

  • For example, if key = Accept, value = text/html{"Accept": "text/html"}

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
Content-Type depend on the external service you are doing your request. Sometimes, the most common error is that the Content-Type is a different one: { "Content-Type" : "application/x-www-form-urlencoded" } Bear in mind that for this type, all the variables 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
Landbot doesn't send User-Agent as header by default. Please add it if needed.

Customize body?

If you need to send information in the request body instead of the URL, you can add it in this section.

IMPORTANT: Request body must be written in JSON format, or you'll see validation errors.

Here is an example of a body formatted correctly in JSON:

{
"email": "@email",
"name": "@name",
"custom-variable":"@customvariable"
}
Variables must be wrapped in quotes ⟶ "@variable"

Test Your Request

You can test whether a request can work properly in this section.

  1. Click on Test the request
  2. It will trigger a real request to your desired API
  3. Response Status Code & Body will appear below the test button
Manually set values for test variables (OPTIONAL)

If your request contains variables, you may want to manually set their values for testing purpose. You can do so in this section before making a test request.

Save Response?

You might want to save the response of a request as variables every time it's triggered to:

  • Split bot flow ⟶ E.g. Check a user's record in CRM to check if he is an existing customer.
  • Display data as options in the next step using Dynamic Data block ⟶ E.g. Get up-to-date inventory data from external database and display them as products for purchase.
  • Store a record ⟶ E.g. Get a user's data from 3rd-party API, and save it in your own database.

This is the section to do so.

By default, the entire response body will be saved. If you want to save a specific part of the response, you need to

  1. Test Your Request in the previous step first to identify JSON keys.
  2. Select the value you want to save from the dropdown
  1. Save it as a variable. You can break down the response into however many variables as you want.

Response Routing

If you want to split the flow based on the response status code, you can do so in this section.

Once you've specified all the paths, go to your canvas to set up their subsequent flows.

We currently don't support range routing (feature coming soon). You can only trigger a path by having the exact same status code instead of an entire range, such as 4XX. Responses with no specified path will follow the Default flow.
Every time you change options in the block editor, you will have to re-connect them on canvas.

Landbot Public IP

In case you need to whitelist Landbot’s IPs, they are:

  • 34.77.31.159
  • 23.251.142.192

For Whatsapp

For a list of all the blocks and current functionalities with Whatsapp bots, please check here

This block behaves exactly the same way as in the landbot (web) version.

For Messenger

This block behaves exactly the same way as in the landbot (web) version.

Need a more practical description of how to use this feature? Check our guide on How to POST, GET and more with your bots.

How did we do?

Stripe integration (v2)

Contact