Report an event
How a browser reports a click, an action button or a dismissal back to Push.
POST
/v1/eventsAuth None. The browser's event token in the body is the credential.
Push's service worker sends this when the person clicks a notification, clicks one of its buttons or dismisses it. You never call it; read the results with Get a notification. See browser events.
Request#
Body#
browserId
stringrequired
The browser reporting the event.
- Rules
- UUID
eventToken
stringrequired
The token the browser received when it connected. It must match
browserId.- Rules
- 1–128 characters
attemptId
stringrequired
The attempt that showed the notification. It must belong to
browserId.- Rules
- UUID
type
stringrequired
What the person did.
- Rules
click,actionorclose
action
stringoptional
The
id of the button that was clicked.- Rules
^[a-z0-9][a-z0-9_-]{0,31}$; required whentypeisaction
Response#
200 OK with { "ok": true }, also when the event changes nothing.
clickandactionset the attempt'sclickedAt, andactionalso setsactionClicked. Only the first click is kept.closesetsclosedAt. Only the first dismissal is kept.
Errors#
| Code | HTTP | When |
|---|---|---|
| VALIDATION_ERROR | 400 | The body is not valid JSON, is over 16,384 bytes or breaks a field rule, or type is action without action. |
| UNAUTHORIZED | 401 | browserId is not a UUID or eventToken does not match it. The message is “Invalid event token”. |
| NOT_FOUND | 404 | The attempt does not exist or belongs to another browser. The message is “Attempt not found”. |
| RATE_LIMITED | 429 | More than 300 event and disconnect requests a minute from one IP address. |
| INTERNAL_ERROR | 500 | Something failed on Push's side. It is safe to retry. |
Example#
⫻
curl
⫻
200 OK