Docs·Notifications
GET
/api/v1/spreelytics/notification-rulesList notification rules
Returns the audience's notification rules, newest first. Send startDate and endDate to also get each rule's triggeredCount and lastTriggeredAt for that window, the numbers the app's Rules tab shows.
Every role can call it, Viewer included.
Keys: an account key or an audience key. Getting started explains both kinds.
Parameters
| Prop | In | Type | Notes |
|---|---|---|---|
contactListId | query | string | The audience id, a UUID. With an audience key it must be that key's own audience. |
startDate? | query | string | Optional, sent together with endDate: a YYYY-MM-DD date or an ISO UTC time, included. Adds the triggered counts. |
endDate? | query | string | Optional: the end of the window. It must come after startDate, and sending only one of the two answers 400. |
Response
An array of NotificationRuleDto.
| 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 'https://app.spreelytics.com/api/v1/spreelytics/notification-rules?contactListId=…' \
-H 'Authorization: Bearer YOUR_API_KEY'
const url = new URL('https://app.spreelytics.com/api/v1/spreelytics/notification-rules');
url.searchParams.set('contactListId', '…');
const res = await fetch(url, {
headers: { Authorization: 'Bearer YOUR_API_KEY' },
});
const data = await res.json();
import requests
res = requests.get(
"https://app.spreelytics.com/api/v1/spreelytics/notification-rules",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"contactListId": "…"},
)
data = res.json()
Response
[
{
"id": "string",
"name": "string",
"config": {
"type": "events",
"events": [
{
"name": null,
"filters": null
}
]
},
"cooldownSeconds": 0,
"enabled": true,
"emailEnabled": true,
"createdAt": "string",
"updatedAt": "string",
"triggeredCount": 0,
"lastTriggeredAt": "string"
}
]