say

View as MarkdownOpen in Claude

Convenience wrapper that appends a play verb with a say:-prefixed URL for text-to-speech. Equivalent to calling builder.play({ url: 'say:${text}', ... }) but exposes the TTS options as typed arguments.

Parameters

text
stringRequired

Text the agent should speak. The method prepends say: to produce the final URL passed to the underlying play verb.

opts
object

Optional TTS parameters.

opts.voice
string

Voice name for the TTS engine. Maps to say_voice in the emitted SWML.

opts.language
string

Language code (e.g., "en-US"). Maps to say_language in the emitted SWML.

opts.gender
string

Gender for TTS voice selection. Maps to say_gender in the emitted SWML.

opts.volume
number

Volume adjustment in dB (−40 to 40). Maps to volume on the play verb.

Returns

this — The builder instance for method chaining.

Example

1import { SwmlBuilder } from '@signalwire/sdk';
2
3const builder = new SwmlBuilder();
4builder.answer();
5builder.say('Welcome to our service.', { voice: 'rime.spore', language: 'en-US' });
6builder.hangup();