Table of Contents

How to TEST your Http Request (Webhook block)

Marco de Vita Updated by Marco de Vita

The Webhook block is an incredibly powerful tool - it lets you connect your chatbot to a third party, such as an external database, a spreadsheet or your CRM. Best of all, once you learn how it works it's quite easy to use too (don't let the technical jargon put you off πŸ€“).

It allows you to trigger an Http Request to external APIs once the visitor "passes through" the block. This means that your chatbot makes a request to your external source (Google Sheet document, CRM, etc.) to send it the data you are looking for.

However, as easy as it may be to connect the two, you want to be absolutely sure that the connection works and the data reaches your chatbot and your users. To do this you will have to test your Http Requests before implementing them in your bots.

Below we will show you how to do just that, by using a handy and practical example:

  1. Set up all the parameters needed according to the documentation of the service you want to connect.
If you are not sure how or where to find this information, get in touch with your service's customer support for help on how to connect a third party tool via a Webhook.

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 now 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 having 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 have the option to add a value for the variable city, which 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 were 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 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.

And that's it! Make sure that you test your Http Request properly and that you are getting the results you are expecting.

How did we do?

Webhook block (External API REST)