addVerbToSection

View as MarkdownOpen in Claude

Append a verb to a named section of the SWML document. If the section does not exist, it is created automatically.

Parameters

sectionName
stringRequired

The target section name.

verbName
stringRequired

The SWML verb name (e.g., "answer", "play", "hangup").

config
unknownRequired

The verb’s configuration payload.

Returns

void

Example

1import { SwmlBuilder } from '@signalwire/sdk';
2
3const builder = new SwmlBuilder();
4builder.addVerb('answer', {});
5builder.addVerbToSection('goodbye', 'play', {
6 url: 'https://example.com/goodbye.mp3',
7});
8builder.addVerbToSection('goodbye', 'hangup', {});
9
10console.log(builder.renderDocument());