Skip to main content
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.

Parameters

string
Email address of the logged-in user. Used to uniquely identify the user in Sleekplan and send them notifications.
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.
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.
string
Username, or handle, for the user. Must use lowercase letters only and must not contain spaces or special characters (janesmith, not Jane Smith). It must be unique inside your workspace; if the one you pass is taken, Sleekplan appends digits to make it unique. If you omit it, the local part of the email address is used.
string
The user’s real display name, shown next to their posts, comments, and votes (Jane Smith). Unlike name it has no format or uniqueness restriction.
string
Publicly accessible URL of the user’s avatar image. Sleekplan fetches and displays this image alongside the user’s activity.
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.
boolean
When true, subscribes the user to the changelog so they receive update emails without opting in manually. Applied when the account is first created.
boolean
When true, unsubscribes the user from changelog emails. Use it to mirror an unsubscribe the user made in your own notification settings.
boolean
When true, signs the visitor in without an email address by generating a throwaway one. Their activity is attributed to a persistent account so they can edit their own posts and see replies, but they cannot be emailed and cannot be recognized on another device. Do not combine it with mail.
object
Custom metadata attached to the user. See Add metadata below; $sleek.addMetadata() is a shortcut for passing this field.
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.
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.
Each call replaces the user’s stored metadata; it does not merge into it. Always pass the complete object you want the user to end up with, rather than one changed key.
addMetadata() is exactly setUser({ meta: … }). Metadata only reaches Sleekplan once the user is signed in: called before that, it is queued and applied with the sign-in.
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.
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.