Docs·Notifications
PUT
/api/v1/spreelytics/notification-rules/:ruleIdUpdate 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
| Prop | In | Type | Notes |
|---|---|---|---|
ruleId | path | string | The rule id. |
contactListId | query | string | The audience id, a UUID. With an audience key it must be that key's own audience. |
Request body
| Prop | Type | Notes |
|---|---|---|
name? | string | Optional. Trimmed, and a blank name answers 400. |
config? | NotificationRuleConfig | Optional. A whole new trigger, read as on create. |
cooldownSeconds? | number | Optional. A new snooze, 0 to 86400 seconds. |
enabled? | boolean | Optional. false pauses the rule, true resumes it. |
emailEnabled? | boolean | Optional. Leaving it out keeps the rule's email setting as it is. |
Response
| Prop | Type | Notes |
|---|---|---|
id | string | The rule id. |
name | string | The rule's name. Every notification it writes carries it as its title. |
config | NotificationRuleConfig | What it watches for: its type and its events rows, as Create a notification rule describes them. |
cooldownSeconds | number | The snooze in seconds: after the rule writes a notification, it skips every match for this long. 0 notifies on every match. |
enabled | boolean | false while the rule is paused. A paused rule writes nothing. |
emailEnabled | boolean | true when the rule also emails the team. |
createdAt | string | When it was created, in ISO 8601. |
updatedAt | string | When it last changed, in ISO 8601. |
triggeredCount | number | Only when the list was asked for a window: how many notifications the rule wrote in it, previews left out. |
lastTriggeredAt | string | Only 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"
}