Skip to content

Alert

Defines an alert rule triggered by metric conditions.

This object can be configured from the WebUI under Settings › Telemetry › Alerts

Type: Expression · required

The condition that triggers the alert.

Type: AlertEmail · required

Email notification settings

Type: AlertEvent · required

Event notification settings

Type: Boolean · default: true

Enable or disable the alert

The Alert object is available via the urn:stalwart:jmap capability.

This is a standard Foo/get method as defined in RFC 8620, Section 5.1.

This method requires the sysAlertGet permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Alert/get",
{
"ids": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This is a standard Foo/set method as defined in RFC 8620, Section 5.3.

Supports create, update, and destroy operations in a single call.

This operation requires the sysAlertCreate permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Alert/set",
{
"create": {
"new1": {
"condition": {
"else": "Example",
"match": {}
},
"emailAlert": {
"@type": "Disabled"
},
"eventAlert": {
"@type": "Disabled"
}
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This operation requires the sysAlertUpdate permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Alert/set",
{
"update": {
"id1": {
"condition": {
"else": "Example",
"match": {}
}
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This operation requires the sysAlertDestroy permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Alert/set",
{
"destroy": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This is a standard Foo/query method as defined in RFC 8620, Section 5.5.

This method requires the sysAlertQuery permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Alert/query",
{
"filter": {}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.

Terminal window
stalwart-cli get Alert id1
Terminal window
stalwart-cli create Alert \
--field 'condition={"else":"Example","match":{}}' \
--field 'emailAlert={"@type":"Disabled"}' \
--field 'eventAlert={"@type":"Disabled"}'
Terminal window
stalwart-cli query Alert
Terminal window
stalwart-cli update Alert id1 --field condition='{"else":"Example","match":{}}'
Terminal window
stalwart-cli delete Alert --ids id1

A conditional expression with match rules and a default value.

Type: ExpressionMatch[]

List of conditions and their corresponding results

Type: String · required

Else condition

A single condition-result pair in an expression.

Type: String · required

If condition

Type: String · required

Then clause

Defines email notification settings for alerts.

  • Disabled: Disabled. No additional fields.
  • Enabled: Enabled. Carries the fields of AlertEmailProperties.

Alert email notification settings.

Type: Text · required

The body of the email

Type: EmailAddress · required

The email address of the sender

Type: String?

The name of the sender

Type: String · required

The subject of the email

Type: EmailAddress[] · min items: 1

The email address of the recipient(s)

Defines event notification settings for alerts.

  • Disabled: Disabled. No additional fields.
  • Enabled: Enabled. Carries the fields of AlertEventProperties.

Alert event notification settings.

Type: Text?

The message of the event to trigger