> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# promptTTS

> Speak a prompt, then collect DTMF or speech input.

[collectaction]: /docs/server-sdks/reference/typescript/relay/actions/collect-action

[play-and-collect]: /docs/server-sdks/reference/typescript/relay/call/play-and-collect

Speak a text-to-speech prompt, then collect DTMF or speech input. A typed
convenience over [`playAndCollect()`][play-and-collect].

## **Parameters**

**`text`** `string` — required

The prompt to speak.

---

**`collect`** `CollectConfig` — required

Input collection configuration: `digits`, `speech`, `initial_timeout`, and
the other fields accepted by [`playAndCollect()`][play-and-collect]. Field
names are the snake\_case wire names; the object is sent as-is.

---

**`options`** `object`

Voice and playback options.

---

**`options.language`** `string`

Language code for the voice, such as `"en-US"`.

---

**`options.gender`** `TtsGender`

`"male"` or `"female"`.

---

**`options.voice`** `string`

Voice identifier for the TTS engine.

---

**`options.volume`** `number`

Volume adjustment in dB, from `-40` to `40`.

---

**`options.onCompleted`** `(event: RelayEvent) => void | Promise<void>`

Callback invoked when the operation reaches a terminal state.

---

## **Returns**

`Promise<`[`CollectAction`][collectaction]`>` -- An action handle with `stop()`, `pause()`, `resume()`, `volume()`, `startInputTimers()`, and `wait()` methods.

## **Example**

```typescript {11-14}
import { RelayClient } from '@signalwire/sdk';

const client = new RelayClient({
  project: process.env.SIGNALWIRE_PROJECT_ID!,
  token: process.env.SIGNALWIRE_API_TOKEN!,
  contexts: ['default']
});

client.onCall(async (call) => {
  await call.answer();
  const action = await call.promptTTS(
    'Enter your four digit PIN.',
    { digits: { max: 4, terminators: '#' } },
  );
  const event = await action.wait();
  console.log(event.params);
});

await client.run();
```