***

title: CollectAction
slug: /reference/typescript/relay/actions/collect-action
description: Action handle for a play-and-collect operation.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

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

[base-action-interface]: /docs/server-sdks/reference/typescript/relay/actions

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

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

[startinputtimers]: /docs/server-sdks/reference/typescript/relay/actions/collect-action/start-input-timers

Returned from [`call.playAndCollect()`][call-play-and-collect].
Tracks a combined play-and-collect operation where a prompt is played and user
input (digits or speech) is collected. Terminal states: `finished`, `error`,
`no_input`, `no_match`.

<Note>
  `CollectAction` only resolves on collect events. Play events sharing the same
  `controlId` are ignored, so `await action.wait()` returns only when input
  collection completes.
</Note>

Inherits all properties and methods from the
[base Action interface][base-action-interface] (`controlId`,
`isDone`, `completed`, `result`, `wait()`).

## **Properties**

No additional properties beyond the [base Action interface][base-action-interface].

## **Methods**

<CardGroup cols={3}>
  <Card title="stop" href="/docs/server-sdks/reference/typescript/relay/actions/collect-action/stop">
    Stop the play-and-collect operation.
  </Card>

  <Card title="volume" href="/docs/server-sdks/reference/typescript/relay/actions/collect-action/volume">
    Adjust the prompt playback volume during a play-and-collect operation.
  </Card>

  <Card title="startInputTimers" href="/docs/server-sdks/reference/typescript/relay/actions/collect-action/start-input-timers">
    Manually start the initial\_timeout timer on an active collect.
  </Card>
</CardGroup>

## **Example**

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

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

client.onCall(async (call) => {
  await call.answer();
  const action = await call.playAndCollect(
    [{ type: 'tts', text: 'Press 1 for sales, 2 for support.' }],
    { digits: { max: 1, digit_timeout: 5.0 } },
  );

  const event = await action.wait();
  const result = event.params.result ?? {};
  const digit = (result as Record<string, unknown>).digits ?? '';
  console.log(`User pressed: ${digit}`);
});

await client.run();
```