Integrations

Overview

Integrations allow your chatbot to interact with external systems via API calls, enabling real-time data retrieval and automated actions. This ensures a more dynamic and intelligent chatbot experience.

The Integrations section can be found under the Advanced tab in the left-hand sidebar of BotStudio.

Understanding API Integrations

BotStudio primarily supports REST API integrations, which allow the chatbot to send and receive data from external systems. Key requirements:

  • The API endpoint must be accessible from the server (consult Puzzel for details).
  • The API response must be in JSON format and include a data field containing the relevant payload.
  • Often, businesses create a wrapper API to handle backend logic and format responses correctly for the chatbot.

Adding an Integration

Integrating an API into BotStudio involves two steps:

  1. Defining the action (creating the integration blueprint).
  2. Using the action in a chatbot node (invoking the integration at runtime).

Steps to Add a New Integration

  1. Navigate to the Integrations page in BotStudio.
  2. Click Add Custom Integration.
  3. In the pop-up, fill in the following details:
    • Name: A descriptive name for the integration (e.g., FetchUserData).
    • REST Endpoint: The URL of the API.
    • Request Type: Choose between GET, POST, PUT, PATCH or DELETE.
    • Response Format: Indicate if the relevant data is located under the data key.
    • Headers: Add HTTP headers like authentication tokens or content-type specifications.
    • Parameters: Define query parameters (for GET requests) or request body parameters (for POST requests).
    • Timeout: Set a response timeout (default: 120s; recommended: 10s for fast responses).
    • Path Parameters: Enable value appending to the endpoint path if required.
    • Mock Response: Provide a sample API response for testing.
    • Test Action: Verify the connection before saving.
  4. Click Save to finalize the integration.

Using an Integration in a Chatbot Node

Once an integration is created, it can be added to chatbot nodes as an action.

Steps to Invoke an Integration in a Node

  1. Open the node editor for the target chatbot node.
  2. Add a new activity of type Action.
  3. Select the desired integration from the list.
  4. Fill in dynamic parameters using chatbot variables.
  5. Define the target variable where the API response will be stored.
  6. Save and test the chatbot.

 

Best Practices for Integrations

  • Fail Fast: If an endpoint is slow, set a lower timeout and inform users of delays.
  • Secure API Calls: Use authentication headers to protect sensitive data.
  • Error Handling: Implement fallback messages for failed requests.
  • Optimize Requests: Minimize redundant API calls to improve speed.

 

Published

Last updated

0
0