JSON API
The JSON API Node is used to send or receive data from external service using REST API and optionally create dynamic nodes based on some logic written in JavaScript, which uses the response of the API.
This is an advanced node. You need to have the knowledge of Javascript to use this node.
To create a JSON API node add the node and following the steps below.
Select appropriate Req Type. Currently GET, POST, PUT, PATCH, and DELETE are supported.
Enter the URL of API. URL can contain dynamic parameters such as {{name}}, {{email}} etc and the system would replace these with actual values for each user. Please check templatization for more details on available variables.
For POST, PUT, PATCH, and DELETE requests, please enter the body of the request. The body can also contain dynamic parameters similar to the above point.
You need to write the body of a function that takes user and response(res) as parameters and returns a list of nodes. Below is the format of the function. Currently, only JSON response is supported.
res
will be the parsed JSON object.You only need to write the body of the function. This function is similar to the one in Dynamic node, except that the function receives the response from the API as an extra parameter
res
Please check docs of Dynamic node for more details.
Examples
1. Fetching data from server to show carousel dynamically
In this example we will be asking whether she wants to see the demos or guide for the chatbot, then get the relevant videos from API and show them in the chatbot in the form of carousal.
Demo API: https://raw.githubusercontent.com/Quick-Reply/test-data/master/demo.json
Video guide API: https://raw.githubusercontent.com/Quick-Reply/test-data/master/guide.json
Please note that the above urls are case-sensitive.
Steps to configure the
Now you can test the playbook. and it would work as expected.
If you are facing any issue, please contact us on support@intelliticks.com
Last updated