Developer docs

Supprtly SDK install guide

Add the support widget to your web app, tell it who your users are, and (recommended) verify that identity so every ticket reliably shows which user and which customer account it came from.

Choose a setup level

The levels build on each other and match the toggles in Settings → Install. The same script tag works at every level; identity is added on top and is never required.

LevelSettings → InstallCode neededWhat you get
1. Simple embedAlways onOne script tag. No other code.Tickets with the name and email the user types, plus any capture data you enabled.
2. Capture user & tenant infoCapture user & tenant infoCall Supprtly.identify() after sign-in and Supprtly.reset() on logout.Every ticket shows the user and customer account it came from, marked Unverified.
3. Verified identity (recommended for production)Verify identity (+ optionally Block unverified tickets)Your server signs a short-lived token; pass it to Supprtly.identify({ token }).Tickets marked Verified, users see their recent tickets, and you can reject unverified tickets.

Level 1: Simple embed

Copy your snippet from Settings → Install (it has your button's embed key) and paste it before the closing </body> tag.

<script src="https://app.supprtly.com/widget.js" data-embed="wgt_YOUR_EMBED_KEY" data-mode="widget" async></script>

data-mode is widget (floating button), inline (renders where the tag is) or link. Without identify(), the form asks for the user's name and email.

Level 2: Capture user & tenant info

Turn on Capture user & tenant info in Settings → Install, then add the small queue snippet before the widget so Supprtly.identify() works even if it runs before the widget has loaded:

<script>
  window.Supprtly = window.Supprtly || { q: [],
    identify: function (o) { this.q.push(["identify", o]); },
    reset: function () { this.q.push(["reset"]); } };
</script>
<script src="https://app.supprtly.com/widget.js" data-embed="wgt_YOUR_EMBED_KEY" data-mode="widget" async></script>

After the user signs in, and on each page load while they're signed in, call Supprtly.identify():

JavaScript
// After your user signs in (and on every page load while signed in):
Supprtly.identify({
  userId: user.id,          // required
  email: user.email,
  name: user.name,
  tenantId: account.id,     // the customer account they belong to
  tenantName: account.name,
  plan: account.plan,
  metadata: { role: user.role },
});
React / Next.js
"use client";
import { useEffect } from "react";

// Render once inside your signed-in layout, e.g. <SupprtlyIdentify user={user} account={account} />
export function SupprtlyIdentify({ user, account }: { user: User | null; account: Account | null }) {
  useEffect(() => {
    const supprtly = (window as any).Supprtly;
    if (!supprtly) return;
    if (!user) {
      supprtly.reset();
      return;
    }
    supprtly.identify({
      userId: user.id,
      email: user.email,
      name: user.name,
      tenantId: account?.id,
      tenantName: account?.name,
      plan: account?.plan,
    });
  }, [user?.id, account?.id]);
  return null;
}

// Next.js: add the embed to app/layout.tsx with next/script, e.g.
// <Script id="supprtly-stub" strategy="beforeInteractive">{`window.Supprtly = window.Supprtly || { q: [], identify: function (o) { this.q.push(["identify", o]); }, reset: function () { this.q.push(["reset"]); } };`}</Script>
// <Script src="<widget.js URL from step 1>" data-embed="<embed key>" strategy="afterInteractive" />
Vue
// e.g. in App.vue <script setup> or your auth store
import { watch } from "vue";

watch(
  () => [auth.user, auth.account],
  ([user, account]) => {
    if (!window.Supprtly) return;
    if (!user) {
      window.Supprtly.reset();
      return;
    }
    window.Supprtly.identify({
      userId: user.id,
      email: user.email,
      name: user.name,
      tenantId: account?.id,
      tenantName: account?.name,
      plan: account?.plan,
    });
  },
  { immediate: true }
);
FieldRequiredDescription
userIdRequiredYour user's unique, stable ID.
emailOptionalUsed for replies; the form won't ask for it.
nameOptionalShown on the ticket; the form won't ask for it.
tenantIdOptionalThe customer account / workspace the user belongs to.
tenantNameOptionalReadable name of that account.
planOptionalThe account's plan, e.g. "pro".
metadataOptionalExtra flat key/values (text, numbers, true/false). Max 20 keys, 2 KB.

Supprtly.reset(): logout & switching tenants

Call Supprtly.reset() when the user logs out, and when they switch to another customer account or workspace (then call identify() again). It clears the stored identity and the widget's cached session data (console and network logs, session replay, pending screenshot and recent tickets), so the next ticket isn't filed under the previous user.

// When the user logs out:
Supprtly.reset();

// When the user switches to another account / workspace:
Supprtly.reset();
Supprtly.identify({ userId: user.id, email: user.email, tenantId: newAccount.id, tenantName: newAccount.name });

Level 3: Verify identity (recommended for production)

  1. In Settings → Install, turn on Verify identity. An admin can reveal or copy the workspace's identity secret there.
  2. Store it only on your server, for example as the environment variable SUPPRTLY_IDENTITY_SECRET. Never put it in frontend code, a mobile app, or a public repository.
  3. Add an endpoint (for example /api/supprtly-token) that, for the signed-in user, signs a short-lived HS256 JWT with that secret.
  4. In your frontend, fetch the token and pass it to Supprtly.identify({ token }).

Token claims

ClaimRequiredDescription
userIdRequiredYour user's unique, stable ID (string).
expRequiredExpiry (Unix seconds). At most 24 hours after the token is issued.
iatRecommendedIssued-at time (Unix seconds).
emailOptionalUser's email (used for replies).
nameOptionalUser's display name.
tenantIdOptionalThe customer account / workspace the user belongs to.
tenantNameOptionalReadable name of that account.
planOptionalThe account's plan.

Signed claims override any plain fields passed to identify() alongside the token. metadata is not a claim; pass it to identify() as usual.

Sign the token on your server

Node / Express
// npm install jsonwebtoken
import jwt from "jsonwebtoken";

// Only for signed-in users (use your own auth middleware).
app.get("/api/supprtly-token", requireLogin, (req, res) => {
  const token = jwt.sign(
    {
      userId: String(req.user.id),      // required
      email: req.user.email,
      name: req.user.name,
      tenantId: String(req.user.accountId),
      tenantName: req.user.accountName,
      plan: req.user.plan,
    },
    process.env.SUPPRTLY_IDENTITY_SECRET,  // server-only secret, never in frontend code
    { algorithm: "HS256", expiresIn: "1h" } // max 24h
  );
  res.json({ token });
});
Next.js route
// app/api/supprtly-token/route.ts   (npm install jose)
import { SignJWT } from "jose";

export async function GET() {
  const user = await getCurrentUser(); // your auth
  if (!user) return new Response("Unauthorized", { status: 401 });

  const token = await new SignJWT({
    userId: String(user.id), // required
    email: user.email,
    name: user.name,
    tenantId: String(user.accountId),
    tenantName: user.accountName,
    plan: user.plan,
  })
    .setProtectedHeader({ alg: "HS256" })
    .setIssuedAt()
    .setExpirationTime("1h") // max 24h
    .sign(new TextEncoder().encode(process.env.SUPPRTLY_IDENTITY_SECRET!));

  return Response.json({ token });
}
Python (FastAPI)
# pip install pyjwt
import os, time, jwt
from fastapi import Depends

@app.get("/api/supprtly-token")
def supprtly_token(user = Depends(current_user)):  # your auth dependency
    now = int(time.time())
    token = jwt.encode(
        {
            "userId": str(user.id),  # required
            "email": user.email,
            "name": user.name,
            "tenantId": str(user.account_id),
            "tenantName": user.account_name,
            "plan": user.plan,
            "iat": now,
            "exp": now + 3600,  # max 24h
        },
        os.environ["SUPPRTLY_IDENTITY_SECRET"],
        algorithm="HS256",
    )
    return {"token": token}

# Flask: same jwt.encode(...) call inside a @login_required route returning jsonify(token=token).
PHP
<?php
// composer require firebase/php-jwt
use Firebase\JWT\JWT;

// Only for signed-in users (check your session first).
$now = time();
$token = JWT::encode([
    'userId'     => (string) $user->id, // required
    'email'      => $user->email,
    'name'       => $user->name,
    'tenantId'   => (string) $user->account_id,
    'tenantName' => $user->account_name,
    'plan'       => $user->plan,
    'iat'        => $now,
    'exp'        => $now + 3600, // max 24h
], getenv('SUPPRTLY_IDENTITY_SECRET'), 'HS256');

header('Content-Type: application/json');
echo json_encode(['token' => $token]);

Pass it to the widget

// After sign-in, and again before the token expires (e.g. every 50 minutes):
async function identifySupprtly() {
  const res = await fetch("/api/supprtly-token", { credentials: "include" });
  if (!res.ok) return;
  const { token } = await res.json();
  Supprtly.identify({ token }); // the signed details override any plain fields
}
identifySupprtly();
setInterval(identifySupprtly, 50 * 60 * 1000);

Tokens can live at most 24 hours; refresh them before they expire (the example refreshes every 50 minutes).

Block unverified tickets

Once your first verified ticket has arrived, an admin can turn on Block unverified tickets. From then on, tickets without a valid token are rejected and the widget tells the user it couldn't verify their account. The API returns HTTP 401 with one of these codes:

CodeMeaning
IDENTITY_VERIFICATION_REQUIREDBlock unverified tickets is on and no token was sent.
IDENTITY_TOKEN_INVALIDBad signature, wrong algorithm (only HS256), missing userId/exp, or a lifetime over 24 h.
IDENTITY_TOKEN_EXPIREDThe token's exp has passed. Fetch a new token and call identify() again.

Recent tickets

Verified users see their recent tickets in the widget. Only tickets filed with a verified identity for the same userId and tenantId are shown.

Rotating the secret

Rotate the secret in Settings → Install if it may have leaked. The previous secret keeps working for 24 hours so you can deploy the new one without failed tickets.

What populates a ticket automatically

DataSourceWhen
Subject, description, category, custom fieldsWhat the user enters in the formAlways
Name & emailTyped in the form, or taken from identify() (the form then skips them)Always
User ID, email, name (reporter)Supprtly.identify() or the signed tokenLevel 2+
Tenant ID & tenant nameSupprtly.identify() or the signed tokenLevel 2+
Plan & custom metadataSupprtly.identify() (plan can also be a token claim)Level 2+
Verification status (Verified / Unverified)Verified only when a valid signed token was sentLevel 2+ (Verified at level 3)
Page URL, browser, deviceCaptured by the widgetIf enabled in the button's capture settings
Console & network errorsCaptured by the widget (sensitive values redacted)If enabled
ScreenshotCaptured after the user agrees (sensitive info blocked out unless they turn that off)If enabled
Session replayPrivacy-masked interaction recordingIf enabled
Screen recordingWhen the user chooses Record my screenIf the button offers it

Hide sensitive info in screenshots & recordings

Before a screenshot, screen recording or session replay is captured, the widget offers Hide sensitive info. It's on by default and remembers the user's last choice. When it's on, sensitive details are blocked out in the user's browser, before anything is uploaded:

Detection can't find everything. For example, it can't recognize names in ordinary text or text inside images and canvases. Add data-supprtly-mask to any element that shows customer data. The element and everything inside it is blocked out:

<div class="account-card" data-supprtly-mask>
  <p>Jane Smith</p>
  <p>Account 0042-1187</p>
</div>

<input name="customer-ref" data-supprtly-mask>

To stop clicks inside an element being recorded at all (they appear in the ticket's activity log by name, like Clicked "Save" (button#save)), add data-norecord to it.

For screen recordings, the widget can only hide information on your page. If the user chooses to share their whole screen or another window, anything outside your page is recorded as it appears.

Need help? Open Settings → Install in your Supprtly dashboard and use Send test ticket to try each level.