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.
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.
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. This example looks for matches in a specific column (SKU) and does not perform a comprehensive query across multiple columns. You may use this example as a starting point to build more complex queries.
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.
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.
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.
Note: You’ll need a paid AI Assist plan to perform this integration.
3. Go to Add-ons.
4. Under AI Assist, click Settings.
5. Select your AI agent.
6. Select Integration/API.
7. Under Tools, click + Add.
8. Click Add tool.
10. Leave API Base URL blank and set Authentication method to No Auth. Then, click Save.
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:
Click the green live chat icon
Schedule a call with us
Visit our community