Visitor Context
Public visitor and metadata fields can help route a conversation. Sensitive context should use a signed context token from the client backend when Server API is available.
Public fields
Use this for harmless data that may exist in browser code, such as the visitor name or a selected department.
Context token
Use this when your backend must attach trusted CRM identity, account tier, or routing context. The Server API key stays on your backend.
Simple public example
Ringnity.init({
slug: 'your-tenant-slug',
visitor: {
externalId: 'crm-customer-123',
name: 'Aira Kirana',
phone: '+6281228326888',
email: 'aira@example.com'
},
metadata: {
crm: 'internal-crm',
invoiceId: 'INV-2026-001'
}
});Trusted backend example
In a CRM integration, your backend creates the short-lived token first. The website only receives the token, not the Server API key.
curl -X POST "https://api.ringnity.com/api/server/visitor-context-token" \
-H "Authorization: Bearer SERVER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"visitor": {
"externalId": "crm-1001",
"name": "Budi Santoso"
},
"metadata": {
"tier": "priority"
},
"expiresIn": 900
}'Frontend usage
const { contextToken } = await fetch('/api/ringnity/context-token', {
method: 'POST'
}).then((response) => response.json());
Ringnity.init({
slug: 'your-tenant-slug',
contextToken
});