BindKit

Developers

Identify signed-in users

Your own keys in every sample. Sign in and the code on this page uses your web agent's publishable key.

Sign in

Tell the messenger who is signed in, and your team sees them under People with their conversations. The agent knows their name and attributes, and on their next visit picks up where they left off. Your team can also write to them from People: the messenger shows the message as soon as they are on your site, even while it is closed.

app.js
// After they sign in, or when their details change. Any other field is an attribute your agent knows.
BindKit.identify({
  user: { id: user.id, email: user.email, name: user.name, avatar: user.avatarUrl, plan: user.plan, tags: ['beta'] },
  userToken: () => fetch('/bindkit-token').then((res) => res.text()),
})

// When they sign out: removes the messenger and forgets their conversations in this browser.
BindKit.reset()
BindKit.messenger({ publishableKey: 'pk_...' })

Show their picture

avatar is the HTTPS address of their picture, which your team sees on People and in Conversations in place of their initials. It has to stay public: BindKit keeps the address, not the file. Your agent isn't told about it. avatar: null clears it; leave it out to keep it. In a user token, put it in an avatar claim.

Tag them

tags is a list of short labels, such as beta or enterprise, up to 20. Each call that has it replaces the tags you sent before, so send them all every time, and tags: null clears them; leave it out to keep them. Your team adds tags of its own on the People page, which yours never remove. Your agent knows both, and People finds everyone with one by searching tag:beta. In a user token, put them in a tags claim.

Sign a token on your server

Anyone can claim to be someone in a page. Turn on identity verification in the agent's Security settings, and your server signs a short-lived token with the secret you get there. From then on a visitor without a valid token counts as anonymous, and your MCP servers get the token too.

import jwt from 'jsonwebtoken'

// HS256, with their ID in sub and an expiry. The other claims are what the agent knows about them.
app.get('/bindkit-token', (req, res) => {
  const { id, email, name, plan } = req.user
  res.send(
    jwt.sign({ sub: String(id), email, name, plan }, process.env.BINDKIT_SIGNING_SECRET, {
      expiresIn: '1h',
    })
  )
})
// app/bindkit-token/route.js
import { SignJWT } from 'jose'

import { currentUser } from '@/lib/auth'

const secret = new TextEncoder().encode(process.env.BINDKIT_SIGNING_SECRET)

export async function GET() {
  const user = await currentUser()
  if (!user) return new Response(null, { status: 401 })

  // HS256, with their ID in sub and an expiry. The other claims are what the agent knows about them.
  const token = await new SignJWT({ email: user.email, name: user.name, plan: user.plan })
    .setProtectedHeader({ alg: 'HS256' })
    .setSubject(String(user.id))
    .setExpirationTime('1h')
    .sign(secret)
  return new Response(token)
}
import os
from datetime import datetime, timedelta, timezone

import jwt


# HS256, with their ID in sub and an expiry. The other claims are what the agent knows about them.
@app.get("/bindkit-token")
def bindkit_token():
    user = current_user()
    return jwt.encode(
        {
            "sub": str(user.id),
            "email": user.email,
            "name": user.name,
            "plan": user.plan,
            "exp": datetime.now(timezone.utc) + timedelta(hours=1),
        },
        os.environ["BINDKIT_SIGNING_SECRET"],
        algorithm="HS256",
    )

Put an agent in your product this week