// Must be called from a user gesture (e.g. a click handler).
callButton.addEventListener('click', () => {
window.Quarterzip.open(
{
agentId: 'YOUR_AGENT_ID',
workspaceToken: 'YOUR_WORKSPACE_TOKEN',
user: {
id: 'your_internal_user_id',
email: 'jane@example.com',
displayName: 'Jane Doe'
},
context: 'Viewing invoice INV-4471, plan: enterprise',
on: {
close: ({ reason }) => analytics.track('call_ended', { reason }),
error: ({ code, fatal }) => console.warn('Quarterzip call failed', code, fatal)
}
},
);
});