Docs·Notifications
/api/v1/spreelytics/notification-rules/:ruleId/testPreview a notification rule
Writes one notification for the rule now and returns it, so you can see what the rule will say. Its title is Preview: and the rule's name, and its message uses the rule's own first event, steps, payment or goal with example values for the rest: Jane Doe in Berlin, on Chrome, on /pricing, paying 49.00 in the audience's reporting currency for "Pro plan".
A preview is listed and pops up in the app like a real notification, unread, with "test": true in its payload. It is never emailed, it ignores the snooze, and it does not count towards triggeredCount or lastTriggeredAt. Previewing a paused rule works too.
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. |
Response
Answers 201.
| Prop | Type | Notes |
|---|---|---|
id | string | |
ruleId | string | |
ruleName | string | Snapshot taken when the row was written, survives deleting the rule. |
title | string | |
message | string | |
payload | object | |
readAt | string | |
createdAt | string |
Request
curl -X POST 'https://app.spreelytics.com/api/v1/spreelytics/notification-rules/:ruleId/test?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/test', {
method: 'POST',
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.post(
"https://app.spreelytics.com/api/v1/spreelytics/notification-rules/:ruleId/test",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={}, # see Request body above
)
data = res.json()
Response
{
"id": "string",
"ruleId": "string",
"ruleName": "string",
"title": "string",
"message": "string",
"payload": "string",
"readAt": "string",
"createdAt": "string"
}