Notification - os-salahuddin/php8-cluster GitHub Wiki

Get All Notifications

This API provides list of all notifications

URL

[GET] http://127.0.0.1:8282/api/v1/private/user/notifications

Sample Response

{
    "code": 200,
    "messages": [],
    "data": {
        "notifications": [
            {
                "id": "52f5e84a-7ac2-4e19-aad6-f82df31d08de",
                "title": "Money Sent",
                "sub_title": "Money Sent Successfully",
                "title_color": "#03EBA3",
                "icon": "https://dev-apigw-personal.deshipay.com/image/icons/money-requests/accepted.png",
                "description": "Money Transferred at 2025-02-19 16:20:38",
                "created_at": "2025-02-19 16:20:38",
                "jump_to": null,
                "read_at": "2025-02-24 13:07:31"
            },
            {
                "id": "e9f41c2d-ccaa-48cc-8a42-6a00d5f6d13a",
                "title": "Money Received",
                "sub_title": "Money Received in ST Pay Wallet",
                "title_color": "#03EBA3",
                "icon": "https://dev-apigw-personal.deshipay.com/image/icons/money-requests/accepted.png",
                "description": "You've received Taka 106 from +8801784563942",
                "created_at": "2025-02-19 15:05:59",
                "jump_to": null,
                "read_at": "2025-02-24 13:07:31"
            },
            {
                "id": "5729eb43-2ef6-47da-8e3f-5066f6c69c0c",
                "title": "Money Sent",
                "sub_title": "Money Sent Successfully",
                "title_color": "#03EBA3",
                "icon": "https://dev-apigw-personal.deshipay.com/image/icons/money-requests/accepted.png",
                "description": "Money Transferred at 2025-02-19 13:34:07",
                "created_at": "2025-02-19 13:34:07",
                "jump_to": null,
                "read_at": "2025-02-24 13:06:50"
            },                    
            {
                "id": "36997dc2-c758-4cd0-8b88-66e19039783b",
                "title": "Money Sent",
                "sub_title": "Money Sent Successfully",
                "title_color": "#03EBA3",
                "icon": "https://dev-apigw-personal.deshipay.com/image/icons/money-requests/accepted.png",
                "description": "Money Transferred at 2024-08-21 11:33:20",
                "created_at": "2024-08-21 11:33:20",
                "jump_to": null,
                "read_at": "2025-01-14 10:59:29"
            },
            {
                "id": "9feea1a5-932b-4a06-b84f-1da780c21c14",
                "title": "Withdraw Bank",
                "sub_title": "Withdraw Bank",
                "title_color": "#03EBA3",
                "icon": "https://dev-apigw-personal.deshipay.com/image/icons/money-requests/accepted.png",
                "description": "",
                "created_at": "2024-07-18 09:31:16",
                "jump_to": null,
                "read_at": "2025-01-14 10:59:29"
            }
        ],
        "has_next_page": true,
        "unread_count": 0
    },
    "data_additional": {
        "per_page": 50,
        "total": 258
    }
}```

### Sample Response Format

| Parameter                               | Type   | Description                                         | Always Present |
|-----------------------------------------|--------|-----------------------------------------------------|----------------|
| `code`                                  | Int    | HTTP code (e.g., 200)                               | Yes            |
| `messages`                              | Array  | Result messages (empty if no messages)              | Yes            |
| `data.notifications`                    | Array  | List of notifications                              | Yes            |
| `data.notifications[].id`               | String | Unique identifier for the notification             | Yes            |
| `data.notifications[].title`            | String | Title of the notification                           | Yes            |
| `data.notifications[].sub_title`        | String | Subtitle of the notification                       | Yes            |
| `data.notifications[].title_color`      | String | Color for the notification title (hex code)         | Yes            |
| `data.notifications[].icon`             | String | URL to the notification icon                        | Yes            |
| `data.notifications[].description`      | String | Detailed description of the notification            | Yes            |
| `data.notifications[].created_at`       | String | Timestamp when the notification was created         | Yes            |
| `data.notifications[].jump_to`          | String | URL to navigate to (if any)                        | No             |
| `data.notifications[].read_at`          | String | Timestamp when the notification was read            | Yes            |
| `data.has_next_page`                    | Bool   | Indicates if there are more pages of notifications  | Yes            |
| `data.unread_count`                     | Int    | Number of unread notifications                     | Yes            |
| `data_additional.per_page`              | Int    | Number of notifications per page                   | Yes            |
| `data_additional.total`                 | Int    | Total number of notifications                      | Yes            |



## Mark as Read for a specific Notification
This API is used to read a specific

### URL

[POST] http://127.0.0.1:8282/api/v1/private/user/notification


### Sample request

```JSON
{
    "id" : "5729eb43-2ef6-47da-8e3f-5066f6c69c0c",
}

Sample Request Format

Parameter Type Description Always Present
id string unique id of a notification Yes

Sample Response

{
    "code": 200,
    "messages": [
        "Notification has been read"
    ],
    "data": null
}

Sample Response Format

Parameter Type Description Always Present
code Int HTTP code (e.g., 200) Yes
messages Array Result messages (empty if no messages) Yes
data Mixed Object or null Yes

Mark as Read for all Notification

This API is used to read all notification

URL

[POST] http://127.0.0.1:8282/api/v1/private/user/notification/read-all

Sample Response

{
    "code": 200,
    "messages": [
        "Notification has been read"
    ],
    "data": null
}

Sample Response Format

Parameter Type Description Always Present
code Int HTTP code (e.g., 200) Yes
messages Array Result messages (empty if no messages) Yes
data Mixed Object or null Yes