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

boolTrue if the section was created, False if a section with that name already exists.

Example

1from signalwire import SWMLService
2
3service = SWMLService(name="multi-section")
4service.add_section("fallback")
5service.add_verb_to_section("fallback", "play", {
6 "url": "https://example.com/sorry.mp3"
7})
8service.add_verb_to_section("fallback", "hangup", {})
9
10print(service.render_document())