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
  • Returns
  • Example
AgentsSWMLService

renderDocument

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

renderSwml

Next
Built with

Render the current SWML document as a JSON string. This is the serialized form returned to SignalWire when a call requests SWML. Delegates to SwmlBuilder.renderDocument() under the hood.

For the document as a plain object, use getDocument() or renderSwml() instead.

Returns

string — The SWML document serialized as a JSON string.

Example

1import { SWMLService } from '@signalwire/sdk';
2
3const service = new SWMLService({ name: 'my-service' });
4service.addVerb('answer', {});
5service.addVerb('hangup', {});
6
7const jsonStr = service.renderDocument();
8console.log(jsonStr);
9// '{"version":"1.0.0","sections":{"main":[{"answer":{}},{"hangup":{}}]}}'