API Adapter

The API Adapter service simplifies the process of integrating existing REST APIs with Parloa. It converts the data from these APIs to a format Parloa can understand, without requiring the deployment of a custom service, provided no additional processing is needed.

For instance, if you have an existing API that fetches user information, the API Adapter can help bring this data into Parloa effortlessly.

Service Configuration

  • success: Service call was completed successfully.

  • error: Error when calling the external API.

  • error_<whitelistError> (optional): Service call intercepted by an HTTP error that requires different handling. It's activated only when the whitelistError flag is used.

Examples

This example demonstrates calling a JSON GET API and selecting the first data entry as the response:

    "input": {
        "url": "https://reqres.in/api/users",
        "method": "get",
        "bodySelector": "data.0",
        "format": "json"
    }

This generates the following result:

{
    "choice": "success",
    "output": {
        "id": 1,
        "email": "george.bluth@reqres.in",
        "first_name": "George",
        "last_name": "Bluth",
        "avatar": "https://reqres.in/img/faces/1-image.jpg"
    }
}

Using the API Adapter in Parloa Frontend

You can pass input parameters as simple text strings or use storage variables obtained during the conversation.

The output branches help create alternative conversation flows based on the success or failure of the service call:

Sending a SOAP Request

The Parloa API Adapter is primarily designed for handling REST requests. However, it can also be used for SOAP requests with some additional steps.

To send a SOAP request, you may need to create the required XML inputs using text or JavaScript strings. Since Parloa's text fields aren't optimized for parsing XML input directly, pasting XML into a text-string field might lead to unexpected outcomes. Therefore, it's advisable to use the JavaScript option to construct and stringify the request parameter.

Here is an example showcasing what this process could look like:

For a SOAP request, it's important to leave the 'format' field empty. Instead, you should use a properly stringified JSON object for the headers. This object should be placed in the 'headers' field:

Last updated