Overview

What is the REST Automation Module?

This module allows you to integrate Zowie with existing RESTful APIs inside your tech stack, with the ability to send and receive requests from existing RESTful infrastructure.

Why use the REST Automation Module?

Using Zowie's REST Automation, you can increase the helpfulness of your chatbot and maximize deflection by providing your users with information about their accounts, orders, or any other details within your external systems that help to resolve user queries.

How to access REST Automation

To access the module, click Modules > REST Automation on Zowie's navigation bar.

REST Automation

Imagine you have a REST endpoint for checking order status. You expect it to be a GET request with the following body:

The chatbot can easily send that request to the endpoint while filling the placeholders with data given by the customer.

Configuring REST Automation

To start, click the "+ Create new" button in the top right corner.

Defining Name

The first section is to populate the Name of your REST Automation scenario.

Configuring Inputs

Next, configure Inputs — the data that the user is expected to provide in order to send it in the request.

It can later be accessed in the body of the request or any of the Creators in this module using the ${variableName} notation.

Sending Auth request

You can also send an Auth request, but it is not mandatory. You need to specify the URL to which the request should be sent and the request method. Headers are optional, but it is the place where you would specify Authorization type and values. Finally, you can create the body of the request.

Creating Request

Finally, you can create your request that will be sent to the server. Provide the URL, the request method, all necessary headers and create your request's body.

Providing messages for Error handling

Here you need to provide a message / a list of messages that will be sent to the user if the chatbot encounters an error while making the request.

Creating Response

Finally, it is time to create a message/list of messages that will be sent to the user using the data from your API.

Mapping status

You can enter the status codes in the Status section. Once entered, you will be able to configure the content depending on the status code returned by the API.

Content options

Content can be defined in three different sections:

  • Start content: allows you to define the first message which will be sent by a chatbot;

  • Repetitive content: allows you to define repetitive content which will be built based on an array of objects in your API response (Zowie will iterate over the array and map each object to the expected response);

  • Finish content: allows you to define the last message which will be sent by a chatbot.

With these three sections, you can build a fully personalized experience.

With Start content, you can provide general insights into customers' orders. Then you can use Repetitive content to list the status for each of the fulfillments/deliveries (if an order is split into multiple parts). Using Finish content you may summarize options for returns based on the current status of an order.

Building a response

In the Variables section, you can map the values from the request to variables that can be used in the Creator.

Creating the Conditional response

You can easily change the title of the Conditional response by clicking on it. Next, click on the arrow on the right to expand this field and select Variable and Comparator.

Click the "AND" button to switch it to the "OR" condition.

Creating the Conditional response (continued)

The last step is as simple as creating the response itself!

For example, let's say you want to create a response for which the API returns the order status and the tracking link.

As you can see, the Rest Automation module is checking whether the API returned anything mapped to the status variable, as well as the trackingUrl variable. If so, then the chatbot will send the content configured under this section.

Creating the Conditional response (continued)

You can create multiple Conditional responses, simply click "Add next" button.

Here we can see the configuration for when the API returns something for the variable mapped to the status, but nothing for the trackingUrl. In that case, the chatbot will send the content configured under this section.

Mapping array within repetitive content

Let's assume that your order doesn't contain single tracking information, but it's split into multiple deliveries. Then we presume that in the API response there is an array of deliveries which contains status and trackingUrl for each of them.

You can use the Repetitive content option to map them into multiple messages.

By providing a JSON path for the array you instruct Zowie where is the array over each it will iterate. Then you can use Variables to map the specific fields of the iterated element - please note that $ refers here to the iterated element within an array, not the root of the whole response. You can also use $index the Variable available in response, which will be replaced with the index of elements in array starting from 1.

If you need access any value from the root of the response, simply use $.root in the Variables section.