How to set up a custom API integration with AI Assist

The instructions below are for desktops and laptops only.

tawk.to’s AI Assist lets you connect your live chat to backend systems, giving customers quick access to real-time product and order information. This makes it easy for customers to browse your inventory, make and track orders, schedule appointments, and more.


You can also tap into customer data and personalize interactions, like greeting customers by name and recommending products based on their past purchases.


API integrations can help to expand your live chat capabilities, enhance customer experience, and reduce your support team’s workload.


In this guide, we walk you through the basic steps to integrate AI Assist with other APIs using OpenAPI.


Check out these articles for examples of integrating Apollo AI with other APIs:

Get your OpenAPI schema ready

First, you’ll need your OpenAPI specifications, which is a JSON (.json) or YAML (.yaml) file that defines the communication between the API and Apollo AI. Your OpenAPI specifications contain the API’s data models, endpoints, request parameters, and response formats.


Click here for an example of a JSON OpenAPI schema.


If the API you want to integrate doesn't already have an OpenAPI specification, you may need to create one. You can use editors like Postman or Swagger Editor to write your specifications, and validate them using Swagger’s validator or any online validator.


Learn more about creating OpenAPI specifications here

Host your OpenAPI schema

Next, host your OpenAPI specification file on a server that allows public access. You can use a repository like GitHub, cloud storage like Amazon S3, or any web hosting service.


Take note of your file’s URL; you’ll need it for the next step. 


Note: If you update your OpenAPI schema file and receive a new URL after setting up the integration, you’ll need to delete the integration and re-add it with the new URL. 

Integrate with AI Assist

Follow these steps to configure your integration:

1. Log in to your tawk.to account.

2. On your dashboard, select the property for which you want to integrate. Hover over the property name to ensure you’ve selected the correct one.

3. Click Add-ons on the top menu.

4. Click Settings under AI Assist.

5. Click Integration/API.

6. Click Add Tool under API.

7. Enter the URL of your OpenAPI specification file in Schema File URL. You can get this from the repository or storage that hosts your OpenAPI specification file. Ensure your URL is publicly accessible and correctly points to your specification file.


For example:
https://petstore.swagger.io/v2/swagger.json


Note: If you update your OpenAPI schema file and receive a new URL, you’ll need to delete the integration and re-add it with the new Schema File URL

8. Enter the API Base URL. This is the root URL of the API. You can get this from the provider of the API. The endpoints, requests, and responses in your OpenAPI specifications will be accessed via this URL. Ensure the endpoints in your specifications match the API endpoints to avoid any errors.


For example:
https://petstore.swagger.io/v2

9. Set the appropriate authentication method for the API. Select No Auth if the API doesn’t require authentication.


If you select API key, enter the API Key and Value. You can get this from the provider of the API. Ensure that you’re using the correct API key to avoid authentication errors.

If you select Basic, enter your username and password.

10. Double-check your details and click Save.

Help AI Assist understand your API integration

AI Assist uses the data sources you provide to generate responses in chat conversations with your visitors. This includes the data obtained through your API integrations.

To help AI Assist understand your API integration and respond accurately:

  • Ensure your API schema contains detailed descriptions of the endpoints and parameters used in your integration.

  • Update the Base Prompt in the Settings page so that AI Assist obtains information via API for specific scenarios. For example:

    - For questions related to <topic e.g. order status>, run a function call to get the relevant information.

    To learn more about setting up the Base Prompt, click here.

Things to remember
  • While the API Base URL can be changed, the Schema File URL cannot be edited. If you update your OpenAPI schema file and receive a new URL, you’ll need to delete the integration and re-add it with the new Schema File URL.
     

  • Test your integration for accuracy, latency, and security. Follow best practices for API authentication and data encryption.

  • Optimize your integration to ensure a smooth chat experience for your customers. Create a customer-centric experience that fosters loyalty, boosts sales, and propels your business forward.

  • Ensure your integration can handle increasing chat volumes as your business grows.


If you have feedback about this article, or if you need more help:

Was this article helpful?

2 out of 4 liked this article

Still need help? Message Us