add_section

View as MarkdownOpen in Claude

Add a new empty section to the SWML document. Sections are named containers for ordered lists of verbs. Every document starts with a main section.

Parameters

section_name
strRequired

Name of the section to create. Must be unique within the document.

Returns

bool — True if the section was created, False if a section with that name already exists.

Example

from signalwire import SWMLService
service = SWMLService(name="multi-section")
service.add_section("fallback")
service.add_verb_to_section("fallback", "play", {
"url": "https://example.com/sorry.mp3"
})
service.add_verb_to_section("fallback", "hangup", {})
print(service.render_document())