# On Key Pressed

**On Key Pressed** fires when the caller finishes a keypad run (**Runs when: When caller presses a key**) - usually after the end key on [Call handling - Advanced](https://docs.voicelogica.ai/agent-configuration/advanced-config/) or when the wait expires. Digits are available to later nodes as the key-pressed / DTMF input variable.

The agent's **Phone keypad input** settings decide when a run is complete. The trigger panel itself is light:

- **Enable Message Creation** — When enabled, the AI speaks a message to the caller before executing this workflow.

  <ShotPlaceholder
    src="/assets/workflows/keyword-pressed.png"
    name="wf-dtmf"
    alt="On Key Pressed trigger on the canvas"
    capture="On Key Pressed canvas."
  />

  <ShotPlaceholder
    src="/assets/workflows/keyword-pressed-form.png"
    name="keyword-pressed-form"
    alt="On Key Pressed Enable Message Creation"
    capture="On Key Pressed trigger settings."
  />

## Why this trigger

Order ids, account numbers, menu digits. Speech is sloppy for long numbers - [Skip Turn](https://docs.voicelogica.ai/agent-configuration/built-in-tools/) plus this trigger is the usual pair.

## First setup - digits in, status out

1. On the agent, **Call handling - Advanced - Phone keypad input** - wait long enough for the id, end key **#** unless your IVR already uses another key.
2. **+ Add Trigger - On Key Pressed**.
3. **Connect To External Service** - pass the DTMF input into the URL or body.
4. **AI Response to Caller** on success (and a failure path if useful).
5. **Save & go live**, attach. Prompt the agent to ask them to type the id then **#**. Call, type, listen.

## Troubleshooting

**The API gets three digits of a ten-digit id**

Raise the keypad wait on Advanced, and tell callers to press **#**. Confirm **Skip Turn** is on.

**Why not During Call?**

During Call makes the model *hear* the number. Key Pressed reads the pad. Use During only if they will say the id, not type it.

## Next Steps

[Advanced](https://docs.voicelogica.ai/agent-configuration/advanced-config/) - keypad wait and end key.  
[Skip Turn](https://docs.voicelogica.ai/agent-configuration/built-in-tools/) - do not talk over digits.  
[Keyword Detected](https://docs.voicelogica.ai/workflows/keyword-detected/) - spoken phrases.
