Notifications

This series of endpoints allows users to manage their notifications within the app. The endpoints provide functionalities such as retrieving the count of notifications, getting all notifications for the current authenticated user, and deleting a push notification.

A note is essentially a record that is created in the database whenever an offer is viewed (one every hour per offer), accepted, declined, or sent. Each note captures specific interactions with an offer, helping to track user engagement and actions over time.


GET/api/notifications/count

Notifications count

This endpoint retrieves the count of notifications for the current authenticated user in the app. It filters notifications based on specific criteria such as the user_id, company_id, and the type of notification (push notification). It excludes notifications that have been marked as deleted in the app.

  • user_id and company_id: The user_id and company_id are obtained from the bearer token of the authenticated user.
  • Push notification toggle: The is_push_notification field is a toggle that users can enable per offer to receive notifications.
  • Deleted notifications: The query excludes notifications that have been marked as deleted in the app.

Response:

{
    "notification_count": 42
}

GET/api/notifications

Get all notifications

This endpoint retrieves all notifications for the current authenticated user in the app. It filters notifications based on specific criteria such as the user_id, user_id, and the type of notification (push notification). It excludes notifications that have been marked as deleted in the app.

{
    "data": [
        {
            "id" => "id",
                "attributes": {
                    "offer_id" => "offer_id",
                    "created_by" => "offer_id",
                    "is_push_notification" => "offer_id",
                    "type" => "offer_id",
                    "message" => "offer_id",
                    "is_deleted_app" => "offer_id",
                    "created_at" => "offer_id",
                    "updated_at" => "offer_id",
                },
                // More records
        }
]
DELETE/api/notifications/{note_id}

Delete push notification

This endpoint sets the is_deleted_app field to true for a specific notification on the user's mobile app. This means that the user will delete the notification from their mobile app, but it won't be deleted from the system.

Parameters

  • note_id (string, required): The id of the notification to be updated.

Request body

  • is_deleted_app (boolean, required): Indicates whether the notification is deleted from the app. Must be set to true.

response

{
    "id": "12345",
    "attributes": {
        "offer_id": "67890",
        "created_by": "user@example.com",
        "is_push_notification": true,
        "type": "offer",
        "message": "Your offer is now active!",
        "is_deleted_app": true,
        "created_at": "2023-01-01T12:00:00Z",
        "updated_at": "2023-01-02T12:00:00Z"
    }
}

Was this page helpful?