Skip to navigation

Return the SWML document as a plain object. The name matches the Python SDK’s SWMLBuilder.build(). For a JSON string, use render(). For property-style access to the same object, use the document getter.

Returns

Record<string, unknown> — the SWML document with version and sections keys.

Example

import { SwmlBuilder } from '@signalwire/sdk';
const builder = new SwmlBuilder();
builder.answer();
// The SDK types prompt as string | object[]; SWML requires an object
builder.ai({ prompt: { text: 'You are a helpful assistant.' } as never });
const doc = builder.build();
console.log(JSON.stringify(doc, null, 2));