LogoLogo
  • 👋START HERE
    • Welcome!
  • â„šī¸General
    • Release Notes
      • Full Feature Base Template
      • Services
      • Rule-based Automation
        • February 2025
        • January 2025
        • December 2024
        • November 2024
        • October 2024
        • September 2024
        • August 2024
        • July 2024
        • June 2024
        • May 2024
        • April 2024
        • March 2024
        • February 2024
        • January 2024
        • 2023
        • 2022
        • 2021
        • Dialog Design Update
    • Glossary of Terms
    • Authentication Methods
      • SSO (Single Sign-On)
      • Built-In User Management
    • Acceptable Use Policy
  • âš™ī¸Rule-based Automation
    • Overview
      • Account Settings
        • Profile
        • Team
        • Roles and Permissions
          • User Management
          • Project Permissions
      • Basic Concepts
        • Project Management
        • Version Management
        • Multi-Lingual Bots
          • Supported Languages
        • Managing User Interactions
          • Unexpected User Input
          • No User Input
    • Dialog Interface
      • Blocks
        • Conversation Logic
          • Start Conversation
          • Global
          • State
          • Intermediate Response
          • To Previous State
          • End Conversation
        • Subdialog
          • Reusable Subdialogs
        • Phone
          • Continue Listening
          • Call Control
        • Technical Logic
          • Service
          • Condition
          • Storage
        • Other
          • Note
      • Speech Assets
        • Intents
          • Utterances
          • Descriptions
        • Slots
          • Custom Slots
            • List Slots
            • Machine Learning Slots
            • Regex Slots
            • LLM Slots
          • Prebuilt Slots
            • DTMF Slot
        • Text Snippets
        • Dictionary
      • Variables
        • Intents
        • Slots
        • Storage
        • Text Snippets
        • Environments
        • Platform
        • Context
      • Services
        • Service Integration Guide
        • Service Development
        • Service Branches and Error Handling
        • Public Services
          • Date and Birthdate Recognition
          • Spelling Post-Processing for Phone
          • IBAN Validation
          • License Plate Validation
          • Address Search
          • Street Names per Postal Code
          • Email Service
          • SMS Service
          • API Adapter
          • Salesforce-Flow Connector
          • Opening Hours
          • Speech-to-Text Hints
          • Fuzzy Match Names
          • Delay Service
      • Debugger
        • Phone 2
        • WhatsApp
        • Textchat 2
    • Environments Interface
      • Service Keys
    • Deployments Interface
      • Creating a Release
      • Editing a Release
    • Text-to-Speech
      • Azure
      • ElevenLabs
      • OpenAI via Azure (Preview)
      • SSML
        • Audio
        • Break
        • Emphasis
        • Prosody
        • Say-as
        • Substitute
        • Paragraph and Sentence
        • Voice
    • Autocomplete
    • Parloa APIs
      • CallData Service and API
      • Conversation History API
      • Textchat V2 API
    • Phone Integrations
      • Genesys Cloud
        • Setting up the SIP Trunk
        • Sending/Receiving UUI Data
        • Creating a Script to Display UUI
      • SIP
      • Tenios
        • Setting Up an Inbound Connection
        • Setting Up an Outbound Connection
        • Transferring a Call
      • Twilio
      • Public IPs and Port Information
    • AI Integration Overview
      • Dual Intent Recognizer (DIR)
      • Dual Tone Multifrequency (DTMF) Intent
    • Analytics and Debugging
      • Understanding Conversations and Transactions
      • Managing Caller ID Data
      • Hangup Events and Triggered Analytics
      • Analytics Transactions: Data Structure and Insights
      • Dialog Analytics
      • Audit Logs
      • Parloa-hosted Analytics
    • Data Privacy
      • Anonymizing Personally Identifiable Information
    • NLU Training
      • NLU Training Best Practices
    • How To
      • Create a Scalable and Maintainable Bot Architecture
      • Implement OnError Loop Handling
      • Resolve the 'Service Unavailable' Error
    • Reference
      • Parloa Keyboard Shortcuts
      • Frequently Asked Questions (FAQ)
      • JavaScript Cheat Sheet
        • Using Regular Expressions (Regex)
  • 🧠Knowledge Skill
    • Introduction
    • Knowledge Collections
    • Knowledge Sources
    • Knowledge Skill Setup
      • Step 1 – Create a Knowledge Skill Agent
      • Step 2 – Configure a Knowledge Skill Agent
      • Step 3 – Configure a Knowledge Skill Agent
Powered by GitBook
On this page
  • Service Configuration
  • Examples
  • Using the API Adapter in Parloa Frontend
  • Sending a SOAP Request

Was this helpful?

Export as PDF
  1. Rule-based Automation
  2. Dialog Interface
  3. Services
  4. Public Services

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.

  • url: The web address of the API you want to call.

  • format (optional): Specifies the data format of the external API. It can be either json or xml. Leave blank if using the "Content-Type" header.

  • authToken (optional): Used for Authorization. Leave blank if using the "Authorization" header.

  • method: Specifies the HTTP method, commonly GET or POST.

  • body:The content of the request, formatted as a string. It may need to be escaped if passed as a JSON object and require a set format flag.

  • headers: Additional headers formatted as a JSON-stringified object.

  • bodySelector: Specifies which data element from the original response should be returned to Parloa. For example: objects[0].object.

  • singleObjectOutput (optional): When set, all output data is wrapped into a single object named outputObject.

  • whitelistError (optional): When set, all output data is wrapped into a single object named outputObject. If enabled, the API Adapter forwards the error.response object, corresponding to the specified error code, to Parloa. For smoother dialog flow management, an optional error branch following the format error_<whitelistError> can be used. For instance, specifying "whitelistError" : "400" triggers the error branch "choice": "error_400". Multiple error codes can be listed by separating them with a comma, for example, "whitelistError" : "400, 403, 404".

The output is generated dynamically based on the API used and will match its response object. If the top-most element is not an object, values are returned in a data property.

  • URL: https://parloaservices.azurewebsites.net/api/API-Adapter?clientId=<CLIENTID>

  • Header: x-functions-key: <AUTHCODE>

For authentication, replace <AUTHCODE> and <CLIENTID> with the values provided by your Parloa representative.

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"
    }
}

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

    "input": {
        "url": "https://reqres.in/api/users",
        "method": "post",
        "bodySelector": "",
        "format": "json",
        "body": "{\"name\": \"morpheus\",\"job\": \"leader\"}"
    }

This generates the following result:

{
    "choice": "success",
    "output": {
        "name": "morpheus",
        "job": "leader",
        "id": "886",
        "createdAt": "2022-07-04T22:17:55.040Z"
    }
}

This example demonstrates calling an XML API:

    "input": {
        "url": "https://gorest.co.in/public/v2/users.xml",
        "bodySelector": "objects.0.object.0",
        "format": "xml"
    }

This generates the following result:

{
    "choice": "success",
    "output": {
        "id": "4003",
        "name": "Bhagvan Banerjee",
        "email": "bhagvan_banerjee@bosco-hermiston.name",
        "gender": "female",
        "status": "active"
    }
}

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:

PreviousSMS ServiceNextSalesforce-Flow Connector

Last updated 1 year ago

Was this helpful?

âš™ī¸
Using Simple Text Strings for the Input Parameters
Using Information Captured During the Call To Query an Endpoint
How Branches Can Be Used with the API Adaptor
Construction of Input Variables
Using the Constructed Variables in the Input Parameters
Stringified-JSON Headers for a SOAP Request