Represents a notification sent to a user, including its type, data, read status, and timestamps.
Field | Type | Description |
---|---|---|
id | int | Unique identifier for the notification |
type | string | Type of the notification (see Notification Types below) |
data | object | Notification-specific data payload. Always includes a __text field with a user-friendly message. |
read_at | string | Timestamp when the notification was read, or null if unread |
created_at | string | Creation timestamp (ISO 8601 format) |
{
"id": 123,
"type": "Comments\\NewCommentNotification",
"data": {
"comment_id": 456,
"content": "Great post!",
"__text": "A new comment was posted by user #42: \"Great post!\""
},
"read_at": "2025-01-01 00:00:00",
"created_at": "2025-01-01 00:00:00"
}
The type
field represents the type of the notification. All types have the App\Notifications\
prefix. Available types include:
Comments\NewCommentNotification
: Notifies users when a comment is added under their comment/commentablePayments\UserPremiumSubscriptionPurchasedNotification
: Notifies users when their premium purchase is completeRatings\NewRatingNotification
: Notifies users when their ratable is rated (only the score is shown)Users\RoleAssignedNotification
: Notifies users when a new permission role is assigned to their accountGyms\Subscriptions\GymSubscriptionCheckInNotification
: Notifies users/gym owners when a check-in is doneGyms\Subscriptions\NewGymSubscriptionNotification
: Notifies gym owners when a new subscription is purchasedGyms\Subscriptions\GymSubscriptionCheckOutNotification
: Notifies users/gym owners when a check-out is doneReports\NewReportNotification
: Notifies admins when a new report is createdChats\NewMessageNotification
: Notifies users of new chat messagesChats\YouAreAddedToChatNotification
: Notifies users when they are added to a new chatTraining\Trainees\NewTraineeNotification
: Notifies trainees/trainers when a trainee record is createdTraining\Trainees\TraineeDeliveredNotification
: Notifies trainees when their record is marked as deliveredTraining\DietPlans\DietPlanCreatedNotification
: Notifies trainees when a diet plan is createdTraining\DietPlans\DietPlanUpdatedNotification
: Notifies trainees when a diet plan or its meals are updatedTraining\WorkoutPlans\WorkoutPlanUpdatedNotification
: Notifies trainees when a workout plan is updated by the trainerTraining\WorkoutPlans\WorkoutPlanCreatedNotification
: Notifies trainees when a workout plan is created by the trainerUsers\ReferralScoreIncreasedNotification
: Notifies users when their referral score is increasedUsers\ReferralRewardReceivedNotification
: Notifies users when they receive a referral rewardTracker\UserAteMealNotification
: Notifies when a user logs a new mealTracker\UserDrankWaterNotification
: Notifies when a user logs drinking water (glass count included)Tracker\UserFinishedWorkoutNotification
: Notifies when a user finishes a workout sessionTracker\UserSharedTrackerWithYouNotification
: Notifies when a user shares their tracker with another userTracker\UserSleptNotification
: Notifies when a user logs the time they went to sleepTracker\UserStartedWorkoutNotification
: Notifies when a user starts a workout sessionTracker\UserTookSupplementNotification
: Notifies when a user logs taking a supplementTracker\UserTrackedWeightNotification
: Notifies when a user tracks their body weightTracker\UserWokeUpNotification
: Notifies when a user logs the time they woke upTracker\Reminders\WakeupReminderNotification
: Reminds user to wakeup after 8 hours of sleepTracker\Reminders\WorkoutReminderNotification
: Reminds user about today's workout 1 hour after waking upTracker\Reminders\SleepReminderNotification
: Reminds user to sleep after 16 hours of being awakeTracker\Reminders\WeightReminderNotification
: Reminds user to enter their weight 1 after after waking upTracker\Reminders\WaterReminderNotification
: Reminds user to drink some water every 3 hoursTracker\Reminders\MealReminderNotification
: Reminds user to eat their mealTracker\Reminders\SupplementReminderNotification
: Reminds user to take their supplement__text
UsageEach notification's data
object contains notification-specific fields, as well as a __text
field. The __text
field provides a ready-to-display, human-readable summary of the notification. Client applications should use the __text
field as the default message to show to users.
__text
value is always present and is consistent with the notification's type and context.data
provide structured information for advanced or custom UI needs.data.__text
is sufficient for a clear, user-friendly notification experience.// Example: Displaying notification in a client app
const notification = /* fetched notification object */;
const message = notification.data.__text;
showNotification(message); // Display to user