> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pyai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent greeting messages

> Set an opening greeting on an Omni agent profile in the console or via POST /v1/agents, spoken at turn 0 before the caller speaks.

Omni agents can speak a **greeting message** the instant a call connects, turn 0,
before the caller says anything. Store it on an **agent profile** in the console
(or `POST /v1/agents`) and connect with `session_label={agent_id}`; the engine
loads persona, voice, and greeting from that profile.

<Note>
  Greeting playback is **live** on Omni. The same field works
  inline in a post-handshake `configure` frame if you are not using agent profiles.
</Note>

## Console (recommended)

<Steps>
  <Step title="Create or open an agent">
    In [console.pyai.com](https://console.pyai.com) → **Agents** → **New agent**
    or open an existing profile.
  </Step>

  <Step title="Set the greeting message">
    Under **Persona & Voice**, fill in **Greeting message**, e.g.

    ```
    Hi, thanks for calling Acme Dental. How can I help you today?
    ```

    Pick a **voice** on the same tab. Save changes.
  </Step>

  <Step title="Test in the browser">
    Click **Test greeting** on the same tab. The console opens a short Omni
    session with your agent profile and plays turn-0 audio in your speakers.
  </Step>

  <Step title="Connect from your app">
    Use the **Connect** tab URL:

    ```
    wss://api.pyai.com/v1/omni?session_label=agent_…&format=pcm16&rate=24000
    ```

    Authorize with your API key (`omni:session` scope). The greeting plays
    automatically, you do not send it again in `configure` unless you want to
    override per call.
  </Step>
</Steps>

### Recording disclosure (consent line)

When **Record calls** is enabled, set a **Recording disclosure** on the same tab.
The engine speaks the consent line **before** recording starts, then plays your
greeting. Required for TCPA-style compliance when capturing audio.

## API

Create or update an agent with `greeting` (and optional `voice_id`):

```bash theme={null}
curl -X POST "https://api.pyai.com/v1/agents" \
  -H "Authorization: Bearer $PYAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Front desk",
    "voice_id": "stock_dorit_en_us",
    "greeting": "Hi, thanks for calling Acme. How can I help?",
    "persona": "You are a warm receptionist.",
    "recordings_enabled": true,
    "consent_line": "This call may be recorded for quality assurance."
  }'
```

Patch later:

```bash theme={null}
curl -X PATCH "https://api.pyai.com/v1/agents/agent_…" \
  -H "Authorization: Bearer $PYAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"greeting": "Thanks for calling, we will be with you shortly."}'
```

Saving an agent with a greeting triggers a **best-effort prerender** on the engine
(when configured) so repeat calls hit cached audio for lower latency.

## Inline `configure` (no agent profile)

If you connect without `session_label`, pass `greeting` in the first
`configure` frame after the WebSocket opens:

```json theme={null}
{
  "type": "configure",
  "voice_id": "stock_dorit_en_us",
  "greeting": "Hello from PyAI.",
  "persona": "You are a brief demo agent."
}
```

See [Omni protocol](/realtime/omni-protocol) for the full `configure` surface.

## Pre-roll alternative (client-side TTS)

Before native greeting shipped, apps synthesized the opening line with Speak and
played it locally. That pattern still works but is optional now, prefer the
native `greeting` field for one billing line and simpler wiring. Details:
[Browser voice agent, Make the agent speak first](/guides/browser-voice-agent#make-the-agent-speak-first-greeting).

## Related

<CardGroup cols={2}>
  <Card title="Browser voice agent" href="/guides/browser-voice-agent">Full browser Omni walkthrough.</Card>
  <Card title="Twilio phone agent" href="/guides/twilio-voice-agent">Greeting on inbound PSTN calls.</Card>
  <Card title="Omni protocol" href="/realtime/omni-protocol">`greeting`, `consent_line`, and `configure` frames.</Card>
  <Card title="Post-call extraction" href="/guides/post-call-extraction">Capture structured data after the greeting call.</Card>
</CardGroup>
