Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sleekplan.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Sleekplan associates feedback, votes, and changelog subscriptions with the user. Call $sleek.setUser() after authentication to identify who is logged in. This page covers setUser(), addMetadata(), and resetUser().

Set the current user

Call $sleek.setUser(data) as soon as you know who is logged in — typically right after your application authenticates the user.
$sleek.setUser({
  mail: 'user@example.com',
  id: '1398',
  name: 'janesmith',
  img: 'https://myapp.com/avatars/1398.jpg',
  weight: 4,
  changelog_subscribed: true
});

Parameters

body.mail
string
Email address of the logged-in user. Used to uniquely identify the user in Sleekplan and send them notifications.
body.token
string
A signed JSON Web Token (JWT) for Single Sign-On. Required if your workspace has private boards enabled or if you have selected “Registration requires email verification” or “Login requires email confirmation” in your preferences. Passing a valid token bypasses email confirmation prompts.
body.id
string | number
Your application’s internal identifier for the user — for example, a database user ID or UUID. Useful for correlating Sleekplan users with records in your own system.
body.name
string
Display name for the user. Must use lowercase letters only and must not contain spaces or special characters (e.g., janesmith not Jane Smith).
body.img
string
Publicly accessible URL of the user’s avatar image. Sleekplan fetches and displays this image alongside the user’s activity.
body.weight
integer
Weighting factor between 1 and 10. A higher weight makes this user’s feedback and votes count more in the impact score calculation — useful for prioritizing input from high-value customers.
body.changelog_subscribed
boolean
When true, automatically subscribes the user to the changelog so they receive update notifications without having to opt in manually.
If you only pass mail and your workspace requires email confirmation, Sleekplan will prompt the user to verify their address. To bypass this, include a signed token via SSO.

SSO with a JWT token

If your workspace uses private boards or enforces email verification, pass a signed JWT as the token field. Generate the token server-side using your Sleekplan SSO secret.
$sleek.setUser({
  mail: 'user@example.com',
  id: '1398',
  name: 'janesmith',
  token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' // server-generated JWT
});
Generate the JWT on your server and inject it into your front-end code at render time. Never expose your SSO secret in client-side JavaScript. See Single Sign-On for setup instructions.

Add metadata

Use $sleek.addMetadata(meta) to attach arbitrary key-value data to the current user. There are no restrictions on the object structure, so you can pass any additional context that is useful for your team — plan tier, company name, MRR, region, and so on.
$sleek.addMetadata({
  company_name: 'Acme LLC',
  company_mrr: 5000,
  plan: 'enterprise',
  country: 'France',
  customer_since: '2019-06-05'
});
You can call addMetadata() multiple times. Each call merges the provided object into the existing metadata for the current session.
body.meta
object
required
An object containing any key-value pairs you want to attach to the user. Keys and values can be any type — strings, numbers, booleans, or nested objects.

Reset the session on logout

Call $sleek.resetUser() whenever the current user logs out of your application. This clears all user data from the session and removes any stored identifiers, so the next visitor does not inherit the previous user’s session.
// Call this in your logout handler
function handleLogout() {
  // ... your existing logout logic ...
  $sleek.resetUser();
}
If you do not call resetUser() on logout, the session cookie or localStorage entry remains active. The next person to use the same browser will be identified as the previous user until the session expires.

Full example

The following example shows a typical integration where you identify the user after login, attach extra context, and clear the session on logout.
// On login — identify the user
$sleek.setUser({
  mail: currentUser.email,
  id: currentUser.id,
  name: currentUser.username,
  img: currentUser.avatarUrl,
  weight: currentUser.isPremium ? 8 : 3,
  changelog_subscribed: true
});

// Attach extra context
$sleek.addMetadata({
  plan: currentUser.plan,
  company: currentUser.companyName,
  mrr: currentUser.mrr
});

// On logout — clear the session
$sleek.resetUser();