Skip to content

Guest API: Push and notices

Registering a device for pushes, and the inbox of notices PurrCRM keeps.

What it doesRoute
Forget a deviceDELETE /guest/v1/devices
Register a device for pushesPUT /guest/v1/devices
List the user’s noticesGET /guest/v1/notices
Mark notices readPOST /guest/v1/notices/read

DELETE /guest/v1/devices

Stops pushes to this device for this user: call it before your own sign-out, while the user’s token still works.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Body (application/json): ForgetDeviceBody

FieldTypeDescription
token (always)string

Answers

StatusBodyMeaning
204noneDone, with nothing to say
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
429problemToo many requests: wait for Retry-After.

PUT /guest/v1/devices

The device’s push token (from Firebase), for the user signed in. Register on every start and whenever the token changes.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Body (application/json): DeviceBody

FieldTypeDescription
app_versionstringAppVersion and Locale are what the app is and speaks, for staff to tell devices apart; both may be left out.
localestring
platform (always)PushPlatform (one of android, ios, web)
token (always)string

Answers

StatusBodyMeaning
204noneDone, with nothing to say
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
429problemToo many requests: wait for Retry-After.

GET /guest/v1/notices

The inbox of every push sent to the user, newest first, a page at a time, with the unread count.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Parameters

NameInDescription
beforequeryWhere the page starts: the next_before (or before) of the page before it.
limitqueryHow many to answer, at most.

Answers

StatusBodyMeaning
200NoticePageOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/notices/read

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Body (application/json): NoticesReadBody

FieldTypeDescription
allboolean
idsarray of string

Answers

StatusBodyMeaning
200UnreadCountOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
429problemToo many requests: wait for Retry-After.