Notifuse
Search…
Frontend API
The frontend API is used by the widget to fetch the user profile, notifications settings and messages.
You might need to use it if you want to build your own widget, or list the users messages somewhere else out of the widget.
The frontend API endpoint is: https://api.notifuse.com/front/ and the data is sent as JSON.

Get user profile & notifications settings

This method returns the user profile with its preferences: which notifications he wants to mute or not, and the list of notifications definitions.
GET https://api.notifuse.com/front/users.get
Request query parameters
Response
Param
Type
Description
projectId
string REQUIRED
Project ID
userId
string REQUIRED
User ID
userHmac
string REQUIRED
HMAC256 of the userId
1
{
2
"user": {
3
"id": "xxx",
4
"projectId": "your_project_id",
5
"language": "en",
6
"timezone": "Europe/London",
7
"preferences": {
8
"notification_welcome": {
9
"notificationId": "notification_welcome",
10
"muteWidget": false,
11
"muteEmail": true,
12
"muteSMS": false
13
}
14
},
15
"firstName": "John",
16
"lastName": "Doe",
17
"photoURL": "https://...jpg",
18
"email": "[email protected]",
19
"telephone": "+44 7911 123456",
20
"createdAt": "2020-10-18T21:59:27.347Z",
21
"updatedAt": "2020-10-18T21:59:27.347Z"
22
},
23
"notifications": [
24
{
25
"id": "notification_welcome",
26
"projectId": "your_project_id",
27
"name": "Welcome",
28
"withWidget": true,
29
"withEmail": true,
30
"withSMS": true,
31
"allowMuteWidget": true,
32
"allowMuteEmail": false,
33
"allowMuteSMS": true,
34
"createdAt": "2020-10-18T21:59:27.347Z"
35
},
36
...
37
]
38
}
Copied!

List messages

List messages for a given user, sent to the "widget" channel. The response contains the count of unread messages and the overall total.
GET https://api.notifuse.com/front/messages.list
Request query parameters
Response
Param
Type
Description
projectId
string REQUIRED
Project ID
userId
string REQUIRED
User ID
userHmac
string REQUIRED
HMAC256 of the userId
skip
int
Number of messages to retrieve
limit
int
Number of messages to skip
1
{
2
"messages": [
3
{
4
"id": "xxxxxxx",
5
"projectId": "your_project_id",
6
"notificationId": "welcome",
7
"userId": "xxx",
8
"data": {
9
"a_payload_object": {},
10
"another_variable: true,
11
"a_number: 1234
12
},
13
"content": "The content displayed in the widget...",
14
"icon": "The widget icon URL",
15
"readAt": "2020-10-18T21:59:27.347Z",
16
"readFromChannel": "widget",
17
"stackId": "new_comments_xxxx",
18
"stackCounter": 21,
19
"stackAt": "2020-10-18T21:59:27.347Z",
20
21
},
22
...
23
],
24
"total": 123,
25
"unread": 123
26
}
Copied!

Mark a message as read

POST https://api.notifuse.com/front/messages.read
JSON request body
Response
Param
Type
Description
projectId
string REQUIRED
Project ID
userId
string REQUIRED
User ID
userHmac
string REQUIRED
HMAC256 of the userId
messageId
string REQUIRED
Message ID
1
{
2
"code": 200
3
}
Copied!

Mark all messages as read

POST https://api.notifuse.com/front/messages.readAll
JSON request body
Response
Param
Type
Description
projectId
string REQUIRED
Project ID
userId
string REQUIRED
User ID
userHmac
string REQUIRED
HMAC256 of the userId
1
{
2
"code": 200
3
}
Copied!

Set user preferences

POST https://api.notifuse.com/front/users.setProfile
JSON request body
Response
Param
Type
Description
projectId
string REQUIRED
Project ID
userId
string REQUIRED
User ID
userHmac
string REQUIRED
HMAC256 of the userId
user
object REQUIRED
The user object with updated preferences.
1
{
2
"code": 200
3
}
Copied!

Last modified 10mo ago