How to get AI Assist to query a Google Sheet

The instructions below are for desktops and laptops only.

You can get tawk.to’s AI Assist to query Google Sheets to locate information for customers’ queries using API integration.


By integrating AI Assist and Google Sheets, you’ll help customers get quick, accurate information while reducing the chances of errors that come with manual information retrieval.

In this guide, we’ll show you how to integrate AI Assist with Google Sheets to make this happen.

Note:

  • AI Assist integrations are only available with the Growth, Business, and Enterprise plans.

  • You’ll need a Google account to access Google Sheets, API, and related services.

  • This integration requires coding knowledge. If you’re unfamiliar with coding, we recommend getting a developer’s help. For more information, visit our developer portal.

  • Examples of this integration is available in our public GitHub repository for your reference.

Get your Google Sheet ready

You’ll need a Google Sheet containing the information you want AI Assist to query. It can contain order details, product descriptions, or general information. For example:

You can also import a spreadsheet file from your computer. Follow these steps to import your file:


1. In Google Drive, click New.

2. Select File upload.

3. Select the file on your computer and click Open.

If needed, make the necessary adjustments to the formatting of your sheet to ensure the information can be read easily.


Next, let’s get the code for your sheet.

Write and deploy the App Script

1. In your Google Sheet, go to Extensions > App Script.

2. The Apps Script console will open in a new tab. Enter a script in Code.gs to describe the methods to query your sheet.

You may copy the script in this example. Ensure to modify relevant parameters to fit your requirements. For more information on customizing the script, click here.

3. Click Deploy > New deployment.

4. Click the gear icon next to Select type and choose Web app.

5. Enter the Description. Set Execute as to Me. This gives your script access to your sheet.


Set Who has access to Anyone. This allows AI Assist to query your sheet using your script.

Then, click Deploy.

6. Copy and save the Web App URL. You’ll need it for the next section.

Note: A new URL is generated with each deployment.

Get your API schema ready

You’ll need an API specifications file, like a YAML file, that defines the interaction between AI Assist and your Google Sheet and script.

You may copy the specs in this example. Ensure to:

  • Replace the servers.urls value with the Web App URL copied from the Apps Script above.

  • Remove /exec from the end of the URL.

  • Modify relevant parameters to fit your needs. For more information on customizing the specs, click here.


You can edit and test your API specifications using an online editor like Swagger.

Copy and save your raw file’s URL. You’ll need it for the next section.

Note: The “title” in your specifications will appear as the integration name on your tawk.to dashboard.


For example:

This is how it’ll appear on your dashboard:

If you have multiple API integrations, give each one a descriptive name so it’s easy to find.


Now, let’s complete this integration on the tawk.to dashboard.
Set up the AI Assist integration

Note: You’ll need a paid AI Assist plan to perform this integration.

1. Log in to your tawk.to account.


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

3. Go to Add-ons.

4. Under AI Assist, click Settings.

5. Select Integration/API.

6. Under Tools, click + Add.

7. Click Add tool.

8. Enter your specification file’s URL in Schema File URL.

9. Leave API Base URL blank and set Authentication method to No Auth. Then, click Save.


10. Test your integration using the widget preview on the right. Remember to test your integration for accuracy, latency, and security. Resolve any issues that may negatively affect your customers’ experience.

Now, your customers can easily get important information regarding orders and products via live chat across your site.


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

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us