---
sidebar:
  hidden: true
title: roboto.domain.triggers.operations
---
## Module Contents

### CreateTriggerRequest

```python
class roboto.domain.triggers.operations.CreateTriggerRequest(/, **data: Any)
```

`from roboto.domain.triggers import CreateTriggerRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/operations.py#L23-L64)

Bases: `pydantic.BaseModel`

Request body for [`create()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.create).

Roboto assigns the trigger's ID, creator and timestamps. It rejects a trigger whose parts do not fit together, by the rules [`TriggerValidator`](/docs/reference/python-sdk/roboto/domain/triggers/validation#roboto.domain.triggers.validation.TriggerValidator) checks: for example, a condition or target placeholder that names a record some subscribed event does not expose, or a `once_per` that some subscribed event does not support.

Building the request raises `pydantic.ValidationError` when `name` breaks its character or length limit.

The trigger's targets run as the organization's actions service user, never as the trigger's creator or anyone else.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CreateTriggerRequest.condition** (`roboto.query.ConditionType | None`) = `None`: Condition a firing must meet for the trigger to dispatch its targets.

  The condition is evaluated over the records the firing's event exposes, such as fields under `dataset.`. `None` dispatches on every firing.

- **CreateTriggerRequest.enabled** (`bool`) = `True`: Whether the trigger is active once created.

  If enabling it would put the organization over its limit of active triggers, Roboto creates it disabled instead.

- **CreateTriggerRequest.fires_on** (`roboto.domain.triggers.sources.TriggerSource`): What makes the trigger fire: a subscription to platform events, or a cron schedule.

- **CreateTriggerRequest.name** (`str`) = `None`: Human-readable name of the trigger, unique within its organization.

  It may contain letters, digits, underscores and hyphens only, and is at most 256 characters long ([`MAX_TRIGGER_NAME_LENGTH`](/docs/reference/python-sdk/roboto/domain/triggers/operations#roboto.domain.triggers.operations.MAX_TRIGGER_NAME_LENGTH)).

- **CreateTriggerRequest.targets** (`list[roboto.domain.triggers.targets.TriggerTargetSpec]`): Targets the trigger dispatches when it fires.

  At least one, each with a `target_id` unique within the trigger.

### MAX_TRIGGER_NAME_LENGTH

```python
roboto.domain.triggers.operations.MAX_TRIGGER_NAME_LENGTH = 256
```

`from roboto.domain.triggers import MAX_TRIGGER_NAME_LENGTH`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/operations.py#L19-L19)

Maximum length of a trigger name, in characters.

### TRIGGER_NAME_PATTERN

```python
roboto.domain.triggers.operations.TRIGGER_NAME_PATTERN = '^[\\w\\-]+$'
```

`from roboto.domain.triggers import TRIGGER_NAME_PATTERN`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/operations.py#L16-L16)

Regular expression a trigger name must match: letters, digits, underscores and hyphens only.

### UpdateTriggerRequest

```python
class roboto.domain.triggers.operations.UpdateTriggerRequest(/, **data: Any)
```

`from roboto.domain.triggers import UpdateTriggerRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/operations.py#L67-L112)

Bases: `pydantic.BaseModel`

Request body for [`update()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.update).

A field left unset (`NotSet`) is unchanged. The updated trigger must still pass every rule [`TriggerValidator`](/docs/reference/python-sdk/roboto/domain/triggers/validation#roboto.domain.triggers.validation.TriggerValidator) checks.

Building the request raises `pydantic.ValidationError` when `name` breaks its character or length limit.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateTriggerRequest.condition** (`roboto.query.ConditionType | roboto.sentinels.NotSetType | None`): New condition. `None` clears it, so the trigger dispatches on every firing.

- **UpdateTriggerRequest.enabled** (`bool | roboto.sentinels.NotSetType`): Whether the trigger is active.

  Enabling it fails with `RobotoLimitExceededException` when the organization is at its limit of active triggers.

- **UpdateTriggerRequest.fires_on** (`roboto.domain.triggers.sources.TriggerSource | roboto.sentinels.NotSetType`): Firing source that replaces the current one whole.

  An event subscription's events and `once_per` change together, and the trigger may switch between platform events and a schedule.

- **UpdateTriggerRequest.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

- **UpdateTriggerRequest.name** (`Annotated[str, pydantic.StringConstraints(pattern=TRIGGER_NAME_PATTERN, max_length=MAX_TRIGGER_NAME_LENGTH)] | roboto.sentinels.NotSetType`): New human-readable name of the trigger, unique within its organization.

  The same character and length limits apply as on create. Afterward [`from_name()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.from_name) finds the trigger only under this name; its `trigger_id` does not change.

- **UpdateTriggerRequest.targets** (`list[roboto.domain.triggers.targets.TriggerTargetSpec] | roboto.sentinels.NotSetType`): Target list that replaces the current one.

  Roboto keeps which entities a target already fired for under its `target_id`, so a target given a new `target_id` fires again for them.
