Build a GenAI analytics app with ThoughtSpot and Vercel

1. Overview

Integrate ThoughtSpot's Vercel integration to provide GenAI-powered natural language search in your application. Quickly analyze data in your Vercel Postgres databases, and display analytics and key insights in your application by embedding Natural Language Search and Liveboards in your app.

Prerequisites

1. A Vercel account.

2. A ThoughtSpot account.

2. What you will build

1. Connect to your existing data warehouse (seamless integration with Postgres databases in the project the integration is installed into)

2. Deploy a token-based authentication backend service to authenticate users into ThoughtSpot

3. Embed Natural Language Search into your Vercel application using ThoughtSpot Visual Embed SDK.

3. Getting started

To start, access ThoughtSpot’s integration on Vercel’s marketplace, here.

Select a Vercel account and a project to install ThoughtSpot’s integration into.

Click “Install”.

If you don’t have an existing ThoughtSpot account, sign up for a free trial. Otherwise, you can continue by logging into your existing ThoughSpot account.

When signing up for a free trial

Enter the required information, select “Start Free Trial” and head over to your email. You should receive an activation email within minutes. Follow the link and you will get signed into ThoughtSpot.

Note: The Free Trial will guide you through the creation of a data source connection. If you have a Postgres connection in the Vercel project you are integrating ThoughtSpot to, feel free to skip this step by clicking on “Exit”. ThoughtSpot’s Vercel integration will automatically create that connection for you in the Vercel integration installation. If you wish to analyze data from other data sources, select a data warehouse and click “Continue” to configure it in your Free Trial:

Successful creation of a connection will bring you to the following page:

You can then go back to the Vercel popup to resume the integration process:

Click on “Resume”.

Enter the URL of your ThoughtSpot instance

Tip: You can find that URL in the ThoughtSpot Free Trial tab on your browser - which should be of the format: https://team3.thoughtspot.cloud/

Click on “Continue”.

4. Select a project to connect to ThoughtSpot

Select the Vercel project you wish to connect to ThoughtSpot. If you have a project that contains a Postgres database, we recommend you select it! ThoughtSpot streamlines the creation of a connection to your Postgres database in Vercel to get you going in minutes.

In the flow below, we assume you wish to connect to a Postgres database. (You don’t? No problem! Click on “Connect to existing worksheets” and select the table you imported in the connection created previously in the Free Trial).

Click on “Create a new connection”.

5. Connect to your data

Then, select tables to import from your Postgres database

When done, click on “Update connection”, and confirm your selection by pressing “Update”.

6. Create data model

Next, ThoughtSpot will show you a list of eligible tables that can be used to create worksheets (lightweight data models in ThoughtSpot). You can analyze single database tables, or let ThoughtSpot auto-join several tables and create a data model out of it for analysis across tables.

Select the table(s) you want to analyze, then click on “Continue”:

7. Test embedding ThoughtSpot

Now that data is connected to ThoughtSpot, we can preview what embedding Natural Language Search can look like in ThoughtSpot.

The next screen shows the code you can paste into your own application to test embedding Natural Language Search.

To test out the experience, click on “Try in Stackblitz”. The next page will let you embed ThoughtSpot in a Playground and try Natural Language Search as it would appear in your Vercel application:

Once you are done, close that browser tab and get back in the Vercel installation.

Click “Next” to start embedding ThoughtSpot in your application.

8. Deploy the Trusted Authentication template

The next step is to create an authentication service to log users in ThoughtSpot as they access your application. In ThoughtSpot, this is done via Trusted Authentication. Thanks to Vercel, you can deploy a Trusted Authentication template as a Vercel application in minutes.

You will need two global variables to set the Trusted Authentication service:

  • The ThoughtSpot host (TS_HOST), e.g. the URL of your ThoughtSpot instance, against which to authenticate your users
  • The ThoughtSpot secret key (TS_SECRET_KEY), which the authentication service will use to request login tokens from the ThoughtSpot server.

Click on “Deploy Auth Service”. Then, create a new repository in Github to host the Trusted Authentication service and copy-paste the global variables’ values into the Vercel configuration screen above to configure it.

Click on “Deploy”.

9. Embed ThoughtSpot with Trusted Authentication

You will now get a code sample that allows you to authenticate your ThoughtSpot users and provide Natural Language Search in your Vercel application. Try this code in Stackblitz using the “Try in Stackblitz” button, or copy-paste this code into your application to get started with embedding ThoughtSpot.

By default, the ThoughtSpot user authenticated into your application will be the user you created the Vercel application with - keep in mind you can log in any other user existing in your ThoughtSpot environment by changing the TSUserName constant to a variable representing the user you wish to authenticate for a particular session.

Click “Next”.

10. ThoughtSpot integration summary

The last page of the setup provides you with one central page to return to and fetch:

  1. All information needed to embed ThoughtSpot’s Natural Language Search in your existing Vercel application.
  2. A template demo app where you can easily deploy ThoughtSpot’s embedded Liveboards and Natural Language Search based on your cluster’s content.
  3. A link to the ThoughtSpot instance where you can connect to more data sources, create data models and generate insights via Answers and Liveboards.

ThoughtSpot’s Summary page

ThoughtSpot’s demo app

Click on “Finish Setup”. You are now ready to provide state-of-the-art analytics to your users - congratulations!