Skip to main content

Using API node in Chatbot Builder

You can use the Call API to call an api from the chatbot itself. You can even use the response of the API in the chatbot flow.

Configuration of API Node

  • API - You can select or configure the api details from the API section
    • Click on "Show Editor" update the API configuration
    • If you are using a json payload, you can type {{ to show a list of available variable substitutions
    • You will have access to the last chat message text and the data collected via the chatbot API Editor
  • Store response in variable? - Provide a variable name to store the api response in a variable
  • JSON path of value to store? - Provide a json path to extract a certain specifc value from the JSON response and store in the variable
    1. The api response is accessed with the key response.data
    2. so if your api response is { "value": "this is the response" }
    3. then the jsonpath should be response.data.value

Call API Node Configuration

Configure API Output

The API will either result in a success (2xx response) or a failure (non 2xx response). You can link the options to further nodes accordingly.

Call API Node output

API Node Configuration Guide

Below is a step by step guide to building a new chatbot with Call API Node

Create API node in Chatbot

  1. Create a Chatbot using Message Node, Question Node, saving chatbot response using Upsert Node and connecting them in a flow
  2. Drag and drop the Call API node to the right of the question node
  3. Edit the Call Api Node
  4. Click Show Editor next to the selected API
  5. Make necessary changes like providing the api url and selecting the http method
  6. Chose form url encoded or form multipart from the body type
  7. Click Add Another under the key value section
  8. A new entry will be created - under key provide the key name like text, Under value select the query variable
  9. Click Save API to close the editor
  10. Under Store response in variable add a variable name like api_response
  11. Under JSON path of value to store add a json path to select a specific value from the api response to store
    1. The api response is accessed with the key response.data
    2. so if your api response is { "value": "this is the response" }
    3. then the jsonpath should be response.data.value
  12. Click Save to close the api node editor

Add Message Node for API Response

  1. Drag and drop a message node to the right of the api node
  2. Connect the Success option of the api node to the new message node
  3. Edi the message node
  4. Type in a message for the message node. If you want to access the data returned in the api node, type @ and start typing to get a menu of variables available. Choose api\_response variable
  5. Click Save in the message node. Next, click Save from the top right corner to save the chatbot.

This chatbot will ask user a question and then hit your configured api with the user response. If an api response is received then the response is sent back to the user.

Guide