---
url: https://next.zammad.org/de/reference/rest-api/trigger.md
---

# Trigger

::: info
Trigger können eine `notification.webhook`-Aktion ausführen, die einen
[Webhook](/de/reference/rest-api/webhook) anhand der ID
(`{"notification.webhook": {"webhook_id": <id>}}`) anstelle von oder
parallel zu `notification.email` ausführt. Erstellen Sie den Webhook zuerst und
verweisen Sie dann in der Trigger-Aktionsausführung auf diese `id`.
:::

## Auflisten

Erforderliche Berechtigung: `admin.trigger`

`GET`-Request gesendet: `/api/v1/triggers`

::: details

```json
// HTTP-Code 200 OK

[
  {
    "id": 2,
    "name": "auto reply (on follow-up of tickets)",
    "condition": {
      "ticket.action": {
        "operator": "is",
        "value": "update"
      },
      "article.sender_id": {
        "operator": "is",
        "value": 2
      },
      "article.type_id": {
        "operator": "is",
        "value": [
          1,
          5,
          11
        ]
      }
    },
    "perform": {
      "notification.email": {
        "body": "<div>Your follow-up for <b>(#{config.ticket_hook}#{ticket.number})</b> has been received and will be reviewed by our support staff.</div>\n<br/>\n<div>To provide additional information, please reply to this email or click on the following link:\n<a href=\"#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}\">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>\n</div>\n<br/>\n<div>Your #{config.product_name} Team</div>\n<br/>\n<div><i><a href=\"https://zammad.com\">Zammad</a>, your customer support system</i></div>",
        "recipient": "article_last_sender",
        "subject": "Thanks for your follow-up (#{ticket.title})"
      }
    },
    "disable_notification": true,
    "localization": null,
    "timezone": null,
    "note": null,
    "activator": "action",
    "execution_condition_mode": "selective",
    "active": false,
    "updated_by_id": 1,
    "created_by_id": 1,
    "created_at": "2026-09-07T06:40:27.193Z",
    "updated_at": "2026-09-07T06:40:27.193Z"
  }
]

```

:::

::: info
`recipient: "article_last_sender"` sendet eine E-Mail an jeden, der den auslösenden
Artikel verfasst hat. In diesem Beispiel ist dies immer der Kunde, da die
Bedingung `article.sender_id` auf `2` (Kunde) gesetzt sein muss. Wenn ein
Agent den Artikel verfasst hat, erhält der Agent die E-Mail stattdessen. Verwenden
Sie `recipient: "ticket_customer"` (siehe Create unten), um immer den
Kunden anzusprechen, ungeachtet dessen, wer die Aktion ausgeführt hat.
:::

## Anzeigen

Erforderliche Berechtigung: `admin.trigger`

`GET`-Request gesendet: `/api/v1/triggers/{id}`

::: details

```json
// HTTP-Code 200 OK

{
  "id": 4,
  "name": "Notify customer on auto-close",
  "condition": {
    "operator": "AND",
    "conditions": [
      {
        "name": "ticket.state_id",
        "operator": "is",
        "value": [
          4
        ]
      }
    ]
  },
  "perform": {
    "notification.email": {
      "recipient": "ticket_customer",
      "subject": "Your ticket #{ticket.number} has been closed",
      "body": "<div>Your ticket <b>#{ticket.number}</b> has been closed. Thank you for contacting us.</div>"
    }
  },
  "disable_notification": false,
  "localization": null,
  "timezone": null,
  "note": "Sends a confirmation email when a ticket is closed.",
  "activator": "action",
  "execution_condition_mode": "selective",
  "active": true,
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2026-09-24T12:31:52.822Z",
  "updated_at": "2026-09-24T12:31:52.822Z"
}

```

:::

## Erstellen

Erforderliche Berechtigung: `admin.trigger`

`POST`-Request gesendet: `/api/v1/triggers`

`condition` akzeptiert zwei Formen: ein flaches Objekt, das über Feldnamen
indiziert (wie im List-Beispiel oben, das Zammads Standard-Trigger
entspricht), und die explizite `{"operator": "AND", "conditions": [...]}`
Form, die unten verwendet wird.

Im folgenden Beispiel führt das Schließen eines Tickets dazu, dass der Kunde
des Tickets eine Bestätigungs-E-Mail empfängt, weil `recipient:
"ticket_customer"` immer auf den Kunden aufgelöst wird, unabhängig davon,
wer die Schließaktion ausgeführt hat.

:::: details

::: tabs key:reqres

\=== Request

```json
{
  "name": "Notify customer on auto-close",
  "condition": {
    "operator": "AND",
    "conditions": [
      {
        "name": "ticket.state_id",
        "operator": "is",
        "value": [
          4
        ]
      }
    ]
  },
  "perform": {
    "notification.email": {
      "recipient": "ticket_customer",
      "subject": "Your ticket #{ticket.number} has been closed",
      "body": "<div>Your ticket <b>#{ticket.number}</b> has been closed. Thank you for contacting us.</div>"
    }
  },
  "disable_notification": false,
  "activator": "action",
  "execution_condition_mode": "selective",
  "active": true,
  "note": "Sends a confirmation email when a ticket is closed."
}

```

\=== Response

```json
// HTTP-Code 201 Created

{
  "id": 4,
  "name": "Notify customer on auto-close",
  "condition": {
    "operator": "AND",
    "conditions": [
      {
        "name": "ticket.state_id",
        "operator": "is",
        "value": [
          4
        ]
      }
    ]
  },
  "perform": {
    "notification.email": {
      "recipient": "ticket_customer",
      "subject": "Your ticket #{ticket.number} has been closed",
      "body": "<div>Your ticket <b>#{ticket.number}</b> has been closed. Thank you for contacting us.</div>"
    }
  },
  "disable_notification": false,
  "localization": null,
  "timezone": null,
  "note": "Sends a confirmation email when a ticket is closed.",
  "activator": "action",
  "execution_condition_mode": "selective",
  "active": true,
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2026-09-24T12:31:52.822Z",
  "updated_at": "2026-09-24T12:31:52.822Z"
}

```

:::

::::

## Aktualisierung

Erforderliche Berechtigung: `admin.trigger`

`PUT`-Request gesendet: `/api/v1/triggers/{id}`

Die Struktur der Nutzlast entspricht der von Create. Die Antwort besteht aus
dem aktualisierten Datensatz, dessen Struktur der von Show/Create
entspricht, wobei `updated_at` aktualisiert wird.

::: tip
Eine teilweise Nutzlast funktioniert ebenfalls, z.B. `{"active": false}`, um nur dieses
Feld umzuschalten. Um einen Trigger auf Basis seines Namens zu aktualisieren, suchen
Sie zuerst dessen `ID` mit `GET /api/v1/triggers`, und senden dann einen `PUT`-Request
an `/api/v1/triggers/{id}`.
:::

:::: details

::: tabs key:reqres

\=== Request

```json
{
  "name": "Notify customer on auto-close",
  "condition": {
    "operator": "AND",
    "conditions": [
      {
        "name": "ticket.state_id",
        "operator": "is",
        "value": [
          4
        ]
      }
    ]
  },
  "perform": {
    "notification.email": {
      "recipient": "ticket_customer",
      "subject": "Your ticket #{ticket.number} has been closed",
      "body": "<div>Your ticket <b>#{ticket.number}</b> has been closed. Thank you for contacting us.</div>"
    }
  },
  "disable_notification": false,
  "activator": "action",
  "execution_condition_mode": "selective",
  "active": true,
  "note": "Sends a confirmation email when a ticket is closed.",
  "id": 4
}

```

\=== Response

```json
// HTTP-Code 200 OK

{
  "id": 4,
  "name": "Notify customer on auto-close",
  "condition": {
    "operator": "AND",
    "conditions": [
      {
        "name": "ticket.state_id",
        "operator": "is",
        "value": [
          4
        ]
      }
    ]
  },
  "perform": {
    "notification.email": {
      "recipient": "ticket_customer",
      "subject": "Your ticket #{ticket.number} has been closed",
      "body": "<div>Your ticket <b>#{ticket.number}</b> has been closed. Thank you for contacting us.</div>"
    }
  },
  "disable_notification": false,
  "localization": null,
  "timezone": null,
  "note": "Sends a confirmation email when a ticket is closed.",
  "activator": "action",
  "execution_condition_mode": "selective",
  "active": true,
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2026-09-24T12:31:52.822Z",
  "updated_at": "2026-09-24T12:32:20.104Z"
}

```

:::

::::

## Löschen

Erforderliche Berechtigung: `admin.trigger`

::: danger
**Dies ist eine dauerhafte Entfernung**

Bitte beachten Sie, dass das Entfernen von Triggern nicht rückgängig gemacht werden kann.
:::

`DELETE`-Request gesendet: `/api/v1/triggers/{id}`

::: details

```json
// HTTP-Code 200 OK

{}

```

:::
