Alert
Defines an alert rule triggered by metric conditions.
This object can be configured from the WebUI under Settings › Telemetry › Alerts
Fields
Section titled “Fields”condition
Section titled “condition”Type:
Expression· requiredThe condition that triggers the alert.
emailAlert
Section titled “emailAlert”Type:
AlertEmail· requiredEmail notification settings
eventAlert
Section titled “eventAlert”Type:
AlertEvent· requiredEvent notification settings
enable
Section titled “enable”Type:
Boolean· default:trueEnable or disable the alert
JMAP API
Section titled “JMAP API”The Alert object is available via the urn:stalwart:jmap capability.
x:Alert/get
Section titled “x:Alert/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysAlertGet permission.
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" ] }'x:Alert/set
Section titled “x:Alert/set”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.
Create
Section titled “Create”This operation requires the sysAlertCreate permission.
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" ] }'Update
Section titled “Update”This operation requires the sysAlertUpdate permission.
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" ] }'Destroy
Section titled “Destroy”This operation requires the sysAlertDestroy permission.
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" ] }'x:Alert/query
Section titled “x:Alert/query”This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysAlertQuery permission.
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.
stalwart-cli get Alert id1Create
Section titled “Create”stalwart-cli create Alert \ --field 'condition={"else":"Example","match":{}}' \ --field 'emailAlert={"@type":"Disabled"}' \ --field 'eventAlert={"@type":"Disabled"}'stalwart-cli query AlertUpdate
Section titled “Update”stalwart-cli update Alert id1 --field condition='{"else":"Example","match":{}}'Delete
Section titled “Delete”stalwart-cli delete Alert --ids id1Nested types
Section titled “Nested types”Expression
Section titled “Expression”A conditional expression with match rules and a default value.
Type:
ExpressionMatch[]List of conditions and their corresponding results
Type:
String· requiredElse condition
ExpressionMatch
Section titled “ExpressionMatch”A single condition-result pair in an expression.
Type:
String· requiredIf condition
Type:
String· requiredThen clause
AlertEmail
Section titled “AlertEmail”Defines email notification settings for alerts.
Disabled: Disabled. No additional fields.Enabled: Enabled. Carries the fields ofAlertEmailProperties.
AlertEmailProperties
Section titled “AlertEmailProperties”Alert email notification settings.
Type:
Text· requiredThe body of the email
fromAddress
Section titled “fromAddress”Type:
EmailAddress· requiredThe email address of the sender
fromName
Section titled “fromName”Type:
String?The name of the sender
subject
Section titled “subject”Type:
String· requiredThe subject of the email
Type:
EmailAddress[]· min items: 1The email address of the recipient(s)
AlertEvent
Section titled “AlertEvent”Defines event notification settings for alerts.
Disabled: Disabled. No additional fields.Enabled: Enabled. Carries the fields ofAlertEventProperties.
AlertEventProperties
Section titled “AlertEventProperties”Alert event notification settings.
eventMessage
Section titled “eventMessage”Type:
Text?The message of the event to trigger