Notifuse
  • What is Notifuse
  • Quick start
  • Concepts
    • Platform overview
    • Contacts
    • Templates
  • Integration
    • Widget 🔔
    • Backend API
    • Frontend API
Powered by GitBook
On this page
  • Get user profile & notifications settings
  • List messages
  • Mark a message as read
  • Mark all messages as read
  • Set user preferences

Was this helpful?

  1. Integration

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

Param

Type

Description

projectId

string REQUIRED

Project ID

userId

string REQUIRED

User ID

userHmac

string REQUIRED

HMAC256 of the userId

{
    "user": {
        "id": "xxx",
        "projectId": "your_project_id",
        "language": "en",
        "timezone": "Europe/London",
        "preferences": {
            "notification_welcome": {
                "notificationId": "notification_welcome",
                "muteWidget": false,
                "muteEmail": true,
                "muteSMS": false
            }
        },
        "firstName": "John",
        "lastName": "Doe",
        "photoURL": "https://...jpg",
        "email": "john@doe.com",
        "telephone": "+44 7911 123456",
        "createdAt": "2020-10-18T21:59:27.347Z",
        "updatedAt": "2020-10-18T21:59:27.347Z"
    },
    "notifications": [
        {
            "id": "notification_welcome",
            "projectId": "your_project_id",
            "name": "Welcome",
            "withWidget": true,
            "withEmail": true,
            "withSMS": true,
            "allowMuteWidget": true,
            "allowMuteEmail": false,
            "allowMuteSMS": true,
            "createdAt": "2020-10-18T21:59:27.347Z"
        },
        ...
    ]
}

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

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

{
    "messages": [
        {
            "id": "xxxxxxx",
            "projectId": "your_project_id",
            "notificationId": "welcome",
            "userId": "xxx",
            "data": {
                "a_payload_object": {},
                "another_variable: true,
                "a_number: 1234
            },
            "content": "The content displayed in the widget...",
            "icon": "The widget icon URL",
            "readAt": "2020-10-18T21:59:27.347Z",
            "readFromChannel": "widget",
            "stackId": "new_comments_xxxx",
            "stackCounter": 21,
            "stackAt": "2020-10-18T21:59:27.347Z",
            
        },
        ...
    ],
    "total": 123,
    "unread": 123
}

Mark a message as read

POST https://api.notifuse.com/front/messages.read

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

{
    "code": 200
}

Mark all messages as read

POST https://api.notifuse.com/front/messages.readAll

Param

Type

Description

projectId

string REQUIRED

Project ID

userId

string REQUIRED

User ID

userHmac

string REQUIRED

HMAC256 of the userId

{
    "code": 200
}

Set user preferences

POST https://api.notifuse.com/front/users.setProfile

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.

{
    "code": 200
}

PreviousBackend API

Last updated 4 years ago

Was this helpful?