getDocument

View as MarkdownOpen in Claude

Returns the raw SWML document object containing the version string and all sections with their verb arrays.

Parameters

This method takes no parameters.

Returns

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

Example

1import { SwmlBuilder } from '@signalwire/sdk';
2
3const builder = new SwmlBuilder();
4builder.addVerb('answer', {});
5builder.addVerb('play', { url: 'https://example.com/audio.mp3' });
6
7const doc = builder.getDocument();
8console.log(doc);
9// { version: '1.0.0', sections: { main: [ { answer: {} }, { play: { url: '...' } } ] } }