APIs

One of the many abilities of the chatbot is to make API calls to external servers.

Let's say you need to resend an OTP to your customer. You can use the chatbot to make an API call to an external server by adding an API node to your Workflow.

To use an API in the Workflow, you first need to define various API parameters and add them to the list of APIs.

Adding API

  1. Navigate to Settings -> Chatbot settings -> APIs.

  2. Click the Add new API button. This will open up a pane on the right side of the screen.

APIs page
  1. Fill in the details and click the Save changes button to make the changes permanent.

    Add new API side pane

Update/Delete APIs

  1. Navigate to Settings -> Chatbot settings -> APIs page.

  2. Click on the three-dot button next to the name of the Workflow. This will open a dropdown menu.

  3. Click the appropriate option from the dropdown to perform your desired operation.

Edit/Delete APIs

Using user input values in API calls

Before you proceed, please go through the Mapped fields article if you haven't done so already.

As mentioned in the Mapped Fields article, values input by the user while chatting with the chatbot are mapped to one of the fields defined on the Mapped Fields page. These values can be used in the URL and the body of the HTTP request.

  1. Navigate to Settings -> Chatbot settings -> APIs page.

  2. Edit an existing API or click the Add new API button to open the side pane.

  3. Click on the {} button at the end of the URL or Body input fields, as needed. This will open a small section with all the Mapped Fields.

  4. Select your desired Mapped Field. This will insert a placeholder for the Mapped Field value at the text cursor position; it will look something like {Field label}.

Before making the API call, the chatbot will replace the {Field label} placeholder with the user input value associated with the Mapped Field.

Using user input values in API

Using APIs in Workflow

Once you've created an API. Follow the steps to add it to your Workflow.

  1. Navigate to Settings -> Chatbot settings -> Workflows page.

  2. Open your desired Workflow in the Workflow Builder by clicking the Workflow name colored in blue.

  3. Click the Edit workflow button on the top right, between the Set as active workflow button and the Save changes button.

  4. Click the Add new node button on the top left side, right below the name of the Workflow. This will open a dropdown.

  5. Click the API button to add the API node to your Workflow. This will add a new API node to the Workflow Builder.

  6. Select your desired API from the dropdown on the API node.

  7. Make the required Connections and click the Save changes button on the top right corner of the Workflow Builder to make the changes permanent.

    Using created APIs in the Workflow