render

View as MarkdownOpen in Claude

Render the SWML document as a JSON string. The name matches the Python SDK’s SWMLBuilder.render(). For the document as a plain object, use build().

Returns

string — JSON-serialized SWML document.

Example

import { SwmlBuilder } from '@signalwire/sdk';
const builder = new SwmlBuilder();
builder.answer();
builder.ai({ prompt: { text: 'You are a helpful assistant.' } });
const json = builder.render();
console.log(json);
// '{"version":"1.0.0","sections":{"main":[{"answer":{}},{"ai":{...}}]}}'