Docs·Notifications

PUT/api/v1/spreelytics/notification-rules/:ruleId

Update a notification rule

Changes a notification rule and returns it. Send only the fields to change, but config replaces the whole trigger, its type and every row together. Pause a rule with "enabled": false and resume it with true. The change takes effect within a minute.

It answers 404 when the id is not a rule in this audience. Needs the Editor or Admin role in the workspace that owns the audience. A Viewer gets 403.

Keys: an account key. Getting started explains both kinds.

Parameters

PropInTypeNotes
ruleIdpathstringThe rule id.
contactListIdquerystringThe audience id, a UUID. With an audience key it must be that key's own audience.

Request body

PropTypeNotes
name?stringOptional. Trimmed, and a blank name answers 400.
config?NotificationRuleConfigOptional. A whole new trigger, read as on create.
cooldownSeconds?numberOptional. A new snooze, 0 to 86400 seconds.
enabled?booleanOptional. false pauses the rule, true resumes it.
emailEnabled?booleanOptional. Leaving it out keeps the rule's email setting as it is.

Response

PropTypeNotes
idstringThe rule id.
namestringThe rule's name. Every notification it writes carries it as its title.
configNotificationRuleConfigWhat it watches for: its type and its events rows, as Create a notification rule describes them.
cooldownSecondsnumberThe snooze in seconds: after the rule writes a notification, it skips every match for this long. 0 notifies on every match.
enabledbooleanfalse while the rule is paused. A paused rule writes nothing.
emailEnabledbooleantrue when the rule also emails the team.
createdAtstringWhen it was created, in ISO 8601.
updatedAtstringWhen it last changed, in ISO 8601.
triggeredCountnumberOnly when the list was asked for a window: how many notifications the rule wrote in it, previews left out.
lastTriggeredAtstringOnly alongside triggeredCount: when the rule last wrote a notification, at any time, or null if it never has.

Request

curl -X PUT 'https://app.spreelytics.com/api/v1/spreelytics/notification-rules/:ruleId?contactListId=…' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{ … }'
const res = await fetch('https://app.spreelytics.com/api/v1/spreelytics/notification-rules/:ruleId', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ /* see Request body above */ }),
});
const data = await res.json();
import requests

res = requests.put(
    "https://app.spreelytics.com/api/v1/spreelytics/notification-rules/:ruleId",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={},  # see Request body above
)
data = res.json()

Response

{
  "id": "string",
  "name": "string",
  "config": {
    "type": "events",
    "events": [
      {
        "name": "string",
        "filters": [
          null
        ]
      }
    ]
  },
  "cooldownSeconds": 0,
  "enabled": true,
  "emailEnabled": true,
  "createdAt": "string",
  "updatedAt": "string",
  "triggeredCount": 0,
  "lastTriggeredAt": "string"
}

See your own numbers today.

Free up to 100k events a month · no credit card

Contact

Tell us what you need.

A real person reads these. We usually reply within one working day.

Or email us directly at contact@spreelytics.com.