External request (Pro feature) allows you to establish a connection with any integration via HTTP request in case our native integrations don't support your particular case. In this article, we will cover:
Supported data types and methods
This feature allows to send to an external server different types of data including contact data such as:
- Contact status
- First name
- Last name
- Name
- Gender
- Language
- Timezone
- Live Chat URL
- Custom user fields
The supported HTTP methods are POST, GET, PUT, and DELETE.
How to set up an external request
To create an external request, add an action block to your automation:
Next, go to Automation → Make External Request:
Once you click on Add your request, it will open the configuration window:
In the configuration window, you will be able to choose a request type (POST, GET, PUT, DELETE):
After you have specified your request type, you will need to enter the request URL and fill in the headers if necessary.
⚠️ Note: only HTTPS links are allowed.
If you are sending a POST or PUT request, the next step is to fill in the request body in JSON format. Here’s an example:
{
"id": 123456,
"first_name": "John",
"last_name": "Doe",
"email": "me@mail.com"
}
Once it’s done, you can test your request by selecting a contact for testing, then switching to the Response tab, and clicking the Test Request button:
If everything is set up correctly, you will get an HTTP 200 code like this:
Example of a use case
There is a good free API test service called SWAPI, so let’s create a default reply automation for Star Wars fans. We want to get the film title and the opening crawl by sending any word in a message to the Facebook page. If the word is in the title, then the page will respond with the mentioned information.
Firstly, create two custom user fields of text type for the title and the opening crawl. Then, go to the default reply automation, create an action block, and choose an external request.
We will be making a GET request to https://swapi.co/api/films/?search= to search for a film with a contact’s last text input appended to the end of the link. Lastly, we need to specify JSON Paths in the response mapping tab to save the film title and opening crawl values from the response to the corresponding custom user fields.
After saving the changes and setting the automation live, this is what we will see in Facebook Messenger: