For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
        • addSection
        • addVerb
        • addVerbToSection
        • asRouter
        • extractSipUsername
        • getApp
        • getBasicAuthCredentials
        • getBuilder
        • getDocument
        • manualSetProxyUrl
        • onRequest
        • registerRoutingCallback
        • registerVerbHandler
        • renderDocument
        • renderSwml
        • resetDocument
        • run
        • serve
        • setOnRequestCallback
        • stop
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
AgentsSWMLService

addVerbToSection

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

asRouter

Next
Built with

Add a SWML verb to a specific named section of the document. If the section does not exist, it is created automatically before the verb is appended. Throws a validation error if schema validation is enabled and the verb config is invalid.

Use addSection() first to create an empty section if you prefer explicit creation, or use this method directly and let it auto-create. For the default main section, use addVerb() instead.

Parameters

sectionName
stringRequired

Name of the section to add the verb to (e.g., "main", "transfer_flow").

verbName
stringRequired

The SWML verb name.

config
unknownRequired

Configuration for the verb. Typically a Record<string, unknown> object; certain verbs like sleep accept a bare number.

Returns

this — returns the service for fluent chaining.

Example

1import { SWMLService } from '@signalwire/sdk';
2
3const service = new SWMLService({ name: 'transfer-flow' });
4
5// Build the main section
6service.addVerb('answer', {});
7service.addVerb('ai', { prompt: { text: 'You are a helpful assistant' } });
8
9// Build a separate transfer section
10service.addVerbToSection('transfer', 'connect', {
11 to: '+15551234567',
12 from: '+15559876543',
13});
14
15console.log(service.renderDocument());