WhoPrompt
FeaturesPricingFAQContact
Back to Documentation

Integration Guide

Securely embed Whoprompt analytics into your application using JWT authentication.

Get StartedContact Sales

Overview

Whoprompt uses JSON Web Tokens (JWT) to securely authenticate your users. This ensures that your users only see the data they are authorized to access, without requiring them to have a separate Whoprompt account.

1. Generate Secret
Create a JWT signing secret in your dashboard.
2. Sign Token
Sign a JWT on your backend with user context.
3. Embed Widget
Pass the token to the frontend SDK.

Backend Setup

You need to generate a JWT on your server for each user session. This token must be signed with your Tenant Secret.

javascript

import jwt from 'jsonwebtoken';

// 1. Get your secret from Dashboard > Integration & API
const JWT_SECRET = process.env.WHOPROMPT_JWT_SECRET;
const TENANT_ID = 'YOUR_TENANT_ID';

// 2. Sign a token for your user
function generateWhopromptToken(user) {
  const payload = {
    iss: 'your-app-name',
    sub: user.id,        // Your user's ID
    aud: 'whoprompt-widget',
    tid: TENANT_ID,      // Your Tenant ID
    
    // Optional: User context for RLS
    ctx: {
      role: user.role,
      orgId: user.orgId
    }
  };

  return jwt.sign(payload, JWT_SECRET, {
    algorithm: 'HS256',
    expiresIn: '1h'
  });
}

Frontend Integration

Once you have the token, you can simply add the SDK script and use the web component.

html

<!-- 1. Add the SDK Script -->
<script src="https://cdn.whoprompt.com/whoprompt-component.js" async></script>

<!-- 2. Use the Web Component -->
<whoprompt-widget
  token="YOUR_JWT_TOKEN"
  user-id="user_123"
  connection-id="conn_123" <!-- Optional -->
></whoprompt-widget>

Embed Dashboard

You can also embed the full analytics dashboard.

Universal method (HTML, Vue, Svelte, etc).

html
<div style="height: 600px;">
  <whoprompt-dashboard></whoprompt-dashboard>
</div>
Need Help?
Check out our database connection docs or contact our team if you need assistance.
WhoPrompt

Your AI data analyst. Available 24/7. Thinks like a human analyst, works at machine speed.

© 2025 WhoPrompt. All rights reserved.

Product

  • Features
  • Pricing
  • Documentation

Company

  • About
  • Contact
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service