Dev tools provide much more flexibility in customizing your Bot. Let's have a more detailed look at each part.
External request (PRO Feature):
External request is a new action available within builder
This feature allows you to send an HTTP request to your server with different types of data:
- Subscriber status
- First name
- Last name
- Live-chat URL
- Custom fields
External request function supports GET and POST HTTP methods. To create external request node you need to go to Actions -> External request.
Once you click on Add your request button it will open configuration window.
In configuration window you will be able to choose the request type (GET or POST).
After you have set up your request type, you need to set proper request URL and fill in Headers and Body fields.
More info about available headers could be found on the Internet. For example: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
When it is done you can test your request by going to Response tab and click on Test the request
If everything is done correctly you will get HTTP 200 Code like that:
Let’s create a default reply flow for Star Wars fans. There are good free API methods called https://swapi.co/. We want to show the film title and the opening crawls by answering any word to the bot. If the word is contained in the title, then we will show the title and the opening crawl.
Firstly, create two CUFs to save the title and the opening crawl. Then go to the Default reply section, create an Action block, and choose External Request.
We'll use an API search method https://swapi.co/api/films/?search=hope and send the last user input there. Next, we need to match JSON response parameters with our CUFs.
Here is our result in the Facebook Messenger.
Dynamic Block(PRO Feature):
Dynamic block is a new type of message which can get info from an external server and display it.
The configuration of Dynamic block is pretty similar to External request and looks the same.
An important thing to note is a Fallback step. It is needed for a bot to do something if there is an error with the server answer. However, it is not a must so there could be no fallback step at all. But in that case, you will not know if there is something wrong.
For more Dynamic Block commands click here.
We also kindly recommend you to read our article DevTools Quick Start if you don't have server development skills.