auto_write
automation

Create a metric-threshold automation that fires an alert when a KPI crosses a boundary. Supported metrics: roas, convers

Changed on

Create a metric-threshold automation that fires an alert when a KPI crosses a boundary. Supported metrics: roas, conversion_rate, sessions, margin. The worker checks enabled automations hourly. Alert delivery is switched on per store; until it is, a check records whether it would have fired and sends nothing. Repeat the summary as given.

post/api/v1/tools/create_alert

Request

  • Base URL
    https://app.magistry.io
  • Auth
    • HTTP bearer
    • or OAuth 2
      Authorization codehttps://app.magistry.io/api/oauth/authorize
      Token URLhttps://app.magistry.io/api/oauth/token
      Scopesautomation:write

Headers

Idempotency-Key, string

Optional; honoured when sent. A unique string you choose for this request; send the SAME key when retrying and the first answer is returned instead of writing twice (idempotent-replayed: true). The same key with other arguments is 409 idempotency_conflict. If the header and idempotency_key are both sent they must be equal.

Request body

object required
name, string required

Short human-readable name for the alert rule.

trigger_metric, 'roas' | 'conversion_rate' | 'sessions' | 'margin' required

KPI to monitor.

operator, '<' | '>' | '<=' | '>=' required

Comparison operator applied to the threshold.

threshold, number required

Numeric threshold value (e.g. 2.0 for ROAS, 0.03 for CR).

scope, 'product' | 'store' required

"store" evaluates the aggregate metric; "product" fires per-product.

min_sessions, integer

Optional minimum session count required before the alert can fire.

notify_via, 'email' | 'in_app'

Notification channel (default: in_app).

idempotency_key, string

Optional. A unique string you choose for this request. Send the SAME key when retrying after a timeout and Magistry returns the original outcome instead of performing the write twice. Reusing a key with different arguments is refused rather than replayed.

Response

Tool result

object required
ok, boolean required
result, unknown required

Changes

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    11 more changes in this revision