---
related_nodes: ["discord_action", "discord_modal_submit"]
---

# Discord Component

Starts a workflow from Discord message component interactions received through a `discord_bot` connection's gateway.

For multi-step state, store sessions in Feather tables. See [Bot Form State With Feather Tables](../workflows/bot-form-state-with-feather-tables.md).

## When to Use

- Handle button clicks
- Handle select menu choices
- Route component workflows by `custom_id`
- Feed interaction IDs and tokens into `Discord Action`

## Configuration

### connection

The `discord_bot` connection whose gateway component interactions start the workflow. Add one under **Settings → Connections**; agents discover existing ones with `list_connections` and `provider_name: "discord_bot"`, then pass the returned connection id. Gateway intents come from the connection's `intents` property.

### custom_id_exact

Optional exact `custom_id` filter. If set, only exact matches trigger the workflow.

### custom_id_prefix

Optional `custom_id` prefix filter. Used only when `custom_id_exact` is empty.

### component_type

Optional Discord component type number. For example, `2` filters to buttons.

## Output Contract

The node emits one `output` object:

```json
{
  "event": "message_component",
  "interaction": {
    "id": "123",
    "application_id": "456",
    "token": "interaction_token",
    "channel_id": "789",
    "guild_id": "111",
    "user": { "id": "222", "username": "alice" }
  },
  "component": {
    "custom_id": "create_bot:confirm",
    "component_type": 2,
    "values": []
  },
  "message": {
    "id": "333",
    "channel_id": "789",
    "content": "Create bot?"
  }
}
```

## Tips

- Exact `custom_id` matching takes precedence over prefix matching.
- Each matching click or selection starts one run, in the order Discord sent them, including ones that arrive while earlier runs are still going.
- Keep `custom_id` bounded and use Feather tables for multi-step state.
- Use `interaction.id` and `interaction.token` with `Discord Action` to respond, defer, update, or show a modal.
