Trusted app-server client
Use AppServerClient from a protected backend to manage data-plane resources and mint app-user tokens.
Construct the client
import { AppServerClient } from '@vchatsdk/sdk-typescript';
const appServer = new AppServerClient({
baseUrl: 'https://api.example.com',
tenantId,
appId,
environment: 'production',
credential: readCurrentVChatCredentialFromSecretStore,
});Resource facades
| Facade | Common methods |
|---|---|
| appUsers | upsert, get, query, search, deactivate, reactivate, issueToken, revokeTokens |
| channels | create, query, search, get, update |
| channelMemberships | add, get, update, remove |
| messages | send, query, search, sendReply, getThread, get, update, delete, listReactionUsers |
| moderation | put/delete/query bans, blocklists, moderation cases, resolve case |
Retries, versions, and fixed identities
The client includes exact tenant, app, and environment locators, omits cookies, bounds timeouts, and retries only eligible safe reads once by default. Mutations are never retried automatically.
const membership = await appServer.channelMemberships.add(
'messaging',
'support-123',
'customer-user-1',
{ custom: { source: 'support-import' } },
);
await appServer.channelMemberships.update(
'messaging',
'support-123',
'customer-user-1',
{
expectedVersion: membership.data.membership.version,
custom: { source: 'manual-review' },
},
);Issue an app-user token
const issued = await appServer.appUsers.issueToken({
userId: 'user-123',
lifetimeSeconds: 3600,
});
return {
token: issued.data.token,
expiresAt: issued.data.expiresAt,
};Authenticate the caller in your own backend and derive user-123 from that trusted identity. The device must not select an arbitrary V Chat user ID.