Table of Contents

How to TEST your Http Request (Webhook block)

Pau Sanchez Updated by Pau Sanchez

The Webhook block allows you to trigger an Http Request to external APIs once the visitor "passes through" the block. It is very handy when you are looking to connect with external databases or CRMs, however, as powerful as it is, it needs to be correctly set up and tested before you can use it.

Here we will show how to test the set up of your webhook step by step:

  1. Set up all the parameters needed according to the documentation of the service you want to connect.

In this example we are going to use the OpenWeather API, and get the weather based on the city:

  1. Now instead of using a static value like "London", we want to use a variable that we are going to ask to the user, in this case it will be @city.

So the set up of the Webhook will look like this:

  1. Now the Webhook is set up but we need to test it out to make sure everything is correct, and then be able to Save the Response. But if we press Test the request it will return an error because the variable @city has no value in that test.

  1. To be able to give a value to the variable @city, to test the Webhook block and without the need to change the previous configuration, we will activate the section called Manually set values for test variables.

  1. Once this section is activated, we will see a space where we will add a value for the variable city, that will be used only during the Test.
Landbot variables can be in the URL, in the params, in the Header and in the Body

This example would work if we where testing a webhook with the variables @name and @email:

  1. Now that everything is set, the configuration of our request and the test variables' values, we can press Test the request, and the result will be displayed below.

  1. Now we can configure the Save Responses as Variables section according to our needs by selecting the key of the response.

And assigning in which Landbot variable we want to store the value:

In case you want to store the whole response, do not select any key from the dropdown, just add the name of the variable.

How did we do?

Dynamic Data (Arrays)

Webhook block (External API REST)