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
        • body
        • description
        • enableEnvExpansion
        • errorKeys
        • expression
        • fallbackOutput
        • foreach
        • globalErrorKeys
        • helpers
        • output
        • parameter
        • params
        • purpose
        • registerWithAgent
        • setAllowedEnvPrefixes
        • toSwaigFunction
        • webhook
        • webhookExpressions
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • 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
AgentsDataMap

expression

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

fallbackOutput

Next
Built with

Add a pattern-based response that does not require an API call. Expressions are evaluated in order; the first matching pattern wins.

Parameters

testValue
stringRequired

Template string to test (e.g., "${args.command}").

pattern
string | RegExpRequired

Regex pattern to match against the test value.

output
FunctionResultRequired

FunctionResult to return when the pattern matches.

nomatchOutput
FunctionResult

Optional FunctionResult to return when the pattern does not match.

Returns

DataMap — Self for method chaining.

Example

1import { DataMap, FunctionResult } from '@signalwire/sdk';
2
3const dm = new DataMap('route_command');
4dm.expression(
5 '${args.command}',
6 /play.*/,
7 new FunctionResult('Playing file.'),
8 new FunctionResult('Unknown command.'),
9);