Arcwise Documentation
English
English
  • 👋Welcome to Arcwise!
  • 📘Arcwise setup
    • ⚙ïļUser & Role Management
    • 🌐Add to Google Workspace
    • 🔌Connect Data Warehouse
      • ðŸ“ŦArcwise Fixed IP Address
      • ❄ïļSnowflake
      • 🔍BigQuery
      • 🐘Postgres
      • ðŸ§ąDatabricks
      • ðŸŠķAthena
      • ðŸŠĢS3
    • ðŸ’ŧConnecting data tools
      • 🎆Connect to dbt
      • 🔎Connect to Looker
      • 🧊Connect to Cube
    • 📜Audit logging
    • ☁ïļIntegrations
      • Overview
      • Hubspot
      • Salesforce
    • ❔FAQ
  • 🔐Google Login Errors
  • 📜Product Changelog
  • Connecting data
    • âœĻConnecting Data
    • ðŸ’ŋData Warehouse
    • ⮆ïļUploading CSV Files
    • ðŸ”ĻImporting Data from Other Tools
    • ðŸĪ–Selecting Spreadsheet Data for AI Analysis
  • Using Arcwise in sheets
    • â–ķïļArcwise Connected Data
      • Adding Columns
      • Filtering
      • Sorting
    • 🗃ïļWorking With Large Data
    • 🧊Using Formulas in Sheets
    • 🟰Supported Formulas
    • 📊Pivot Tables
    • 📉Creating Manual Visualizations
  • Using Arcwise AI Analyst
    • ðŸĪ–AI Analyst Overview
    • ❇ïļUsing AI Analyst in Sheets
    • 📂Getting Data Using AI
    • 📈Creating a Visual
    • ðŸ’ĄGenerating an Insight
    • 📃Using AI Analyst on Spreadsheet Data
    • Embedding the AI Analyst Chat
  • Using Arcwise AI Formulas
    • ðŸĪ–GPT Formulas Overview
    • ✔ïļGPT Formula Basics
    • 📖GPT Formula Reference
Powered by GitBook
On this page
  1. Using Arcwise AI Analyst

Embedding the AI Analyst Chat

PreviousUsing AI Analyst on Spreadsheet DataNextGPT Formulas Overview

Last updated 6 months ago

The Arcwise AI Analyst can be embedded as an iframe within your page or application using our embeddable chat page, , as the source.

Using this method, we allow the outer frame to pass parameters into the embeddable chat page using the following query parameters.

  • spreadsheet_id

    If you have used the , you may provide the Sheets spreadsheet id to chat across the connected tabs in that spreadsheet.

  • table

    Instead of passing in a spreadsheet_id, you may provide fully-qualified table names in the form of table=db.schema.table to scope any new chat threads with the Arcwise AI Analyst to only those tables provided. Multiple tables can be added to the AI Analyst context by providing this query parameter multiple times like so: table=db.schema.table1&table=db.schema.table2&table=...

  • custom_instructions

    This parameter may be used to provide any specific custom instructions to the Arcwise AI Analyst, which will be appended to its system context.

JWT authentication

By default, the embedded AI Analyst chat will display a Google login button and ask the user to authenticate manually.

If you'd like to allow users to skip the login flow, the embedding URL may provide a user-specific JWT token via a #token hash parameter (example: https://sql.arcwise.app/chat-embed?table=x#token=JWT_TOKEN).

JWTs must be created programmatically in your embedding code through a server-side endpoint, to avoid leaking the Embed Secret.

  1. Go to and click to Edit your organization. On the next screen, click Manage Embed Secret.

    1. Generate a new embed secret (important: you will only be shown this secret once, so you must store it securely in your application environment (e.g. as an environment variable) when it is created.

    2. Also, copy and store the organization_id in your application (this is non-sensitive).

  1. Generate a JWT with the following payload format using the Embed Secret as the JWT key, and the Arcwise organization ID as the issuer, using the HS256 encryption algorithm. All fields in the payload are required.

// JWT JSON payload format
{
  "sub": "user@organization.com",
  "aud": "arcwise.app",
  "iat": [current UNIX time],
  "iss": [arcwise_organization_id],
  "exp": [desired expiration time, e.g. current time + 8 hours]
}
  • "sub" should be the user's Google account email address. It must match the Google email they use to access Arcwise.

  • "aud" specifies the audience for the JWT (Arcwise).

  • "iat" should be the current UNIX timestamp.

  • "iss" must be your Arcwise Organization ID from above.

  • "exp" determines how long the JWT will be valid. The user will be logged out of the iframe after this time, so we recommend setting this to a fairly large number of hours (depending on your organization's security policy).

import jwt
import time

# Replace these with the values from the admin dashboard
arcwise_embed_secret = "00000000-0000-0000-0000-000000000000"
arcwise_organization_id = "12345678-1234-5678-4321-000000000000"
# viewer's email
user_email = "user@organization.com"
token_expiration_time = 8 * 3600  # 8 hours

# Generate a JWT
current_timestamp = int(time.time())
arcwise_token = jwt.encode({
    "sub": user_email,
    "aud": "arcwise.app",
    "iat": current_timestamp,
    "iss": arcwise_organization_id,
    "exp": current_timestamp + token_expiration_time,
}, arcwise_embed_secret, algorithm="HS256")

# Embedding URL
embed_url = f"https://sql.arcwise.app/chat-embed#token={arcwise_token}"

Example with the Python library

PyJWT
https://sql.arcwise.app/chat-embed
Arcwise AI Analyst in Sheets
https://admin.arcwise.app/#/organizations