Docs·Notifications

POST/api/v1/spreelytics/notification-rules/:ruleId/test

Preview 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

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

Response

Answers 201.

PropTypeNotes
idstring
ruleIdstring
ruleNamestringSnapshot taken when the row was written, survives deleting the rule.
titlestring
messagestring
payloadobject
readAtstring
createdAtstring

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"
}

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.