For the complete documentation index, see llms.txt. This page is also available as Markdown.

🐰Quickstart

Create a vCon in TypeScript or JavaScript β€” parties, dialog, analysis, serialize.

This is the TypeScript counterpart to the Python Quickstart. Both libraries produce byte-compatible vCons.

Install

npm install vcon-js

vcon-js targets draft-ietf-vcon-vcon-core-02 and sets the vcon: "0.4.0" syntax parameter automatically.

Minimal example

import { Vcon, Party, Dialog } from 'vcon-js';

const vcon = Vcon.buildNew();
vcon.subject = 'Customer Support Chat';

vcon.addParty(new Party({ tel: '+15551234567', name: 'Alice', role: 'customer' }));
vcon.addParty(new Party({ mailto: 'bob@example.com', name: 'Bob', role: 'agent' }));

vcon.addDialog(new Dialog({
  type: 'text',
  start: new Date().toISOString(),
  parties: [0, 1],
  originator: 0,
  mediatype: 'text/plain',
  body: 'Hi, I need help with my account.',
  encoding: 'none',
}));

console.log(vcon.toJson());

Recording with external media

For audio/video, prefer the external-media pattern: keep the recording out of the JSON, reference it with url, and provide a SHA-512 content_hash so consumers can verify integrity.

Adding an analysis (transcript)

Analysis entries record what was derived from the conversation. Always include vendor. For JSON-bodied analyses, set encoding: 'json' and pass a string body (use JSON.stringify).

Declaring an extension

Extension declarations are generic in vcon-js β€” there are no per-extension builder helpers in 0.4.0. You add extension data to the right array yourself and declare the extension:

For the JSON shape of each extension, see the Extensions section.

Lawful Basis example

Tags

Tags are surfaced through the conserver and through the vCon MCP server for fast filtering.

Loading and saving

Common mistakes (caught in code review)

  • Using appended instead of amended β€” the library writes amended; if you carry data forward from older code, rename.

  • Using must_support β€” use addCriticalExtension() (writes to critical[] / must_understand[]).

  • Putting transcripts in attachments[] β€” transcripts belong in analysis[] (see WTF Transcription).

  • Passing a JS object directly as body for JSON content β€” body must be a string. Use JSON.stringify.

  • Forgetting vendor on analysis entries β€” vendor is REQUIRED.

See also

Last updated

Was this helpful?