In Chat, user and agent are not product roles. They are who is speaking in the conversation. That changes webhooks, metrics, and which JWT you put in the app.
In short
When to use USER
Use USER for everyone who joins chat from your application. Each person has a stable externalUserId in your database.
Typical flow:
- The person signs in to your app
- Your backend upserts them (
PUT /v1/chat/users)
- Your backend mints the JWT (
POST /v1/chat/users/token)
- The app opens the WebSocket with that JWT and sends as that person
The JWT carries kind: USER. Whoever holds that token is that person in the conversation.
When to use AGENT
Use AGENT when the message should appear as your company, not an end user.
Typical cases:
- Someone on the team replies in the dashboard (Chat or Inbox) — Notifique already creates the agent
agent:{workspaceUserId}
- Your backend posts a notice in the thread as support
- You want sent (agent) vs received (user) metrics on the Chat App detail
workspaceUserId must be a workspace member. The default externalUserId is agent:{workspaceUserId}.
Then send as that agent:
What not to mix
- Do not put an
AGENT JWT in the customer app. The customer speaks with a USER JWT.
- Do not register staff as
USER if they answer from the dashboard — the webhook would fire as chat.received.
- Two
USERs in a 1:1 is people in your product talking. A USER and an AGENT is support.
Chat App flags
Who can create a conversation, create a group, and add members with a user JWT applies to anyone with a user token. An agent via API Key ignores those flags: the backend can always create.
See Quick Start and Send messages.