Overview
The Notificaciones (Notifications) API manages notifications sent to users regarding campaigns and system events.Model Structure
The Notificacion model represents notifications with read/unread status tracking.Fields
Primary key. Auto-incremented unique identifier for the notification.
Date when the notification was sent. Format:
YYYY-MM-DDCampaign ID associated with this notification. Links to CampanaPublicitaria.
Notification read status. Must be one of the following choices:
"leido": Notification has been read by the user"no leido": Notification has not been read yet
Notification title. Brief subject line. Maximum 20 characters.
Notification description. Detailed message content. Maximum 100 characters.
Endpoints
List Notifications
Query Parameters
Filter notifications by read status. Values:
"leido" or "no leido"Filter notifications by campaign ID
Filter notifications by send date (YYYY-MM-DD)
Response
Unique identifier for the notification
Date the notification was sent
Associated campaign ID
Read status:
"leido" or "no leido"Notification title
Notification description
Example Response
Get Notification
Path Parameters
The unique identifier of the notification to retrieve
Response
Unique identifier for the notification
Date the notification was sent
Associated campaign ID
Read status:
"leido" or "no leido"Notification title
Notification description
Example Response
Get Unread Notifications
Example Response
Create Notification
Request Body
Date the notification is sent. Format:
YYYY-MM-DDID of the associated campaign
Initial read status. Values:
"leido" or "no leido". Typically set to "no leido" for new notifications.Notification title. Maximum 20 characters.
Notification description. Maximum 100 characters.
Example Request
Response
Unique identifier for the newly created notification
Date the notification was sent
Associated campaign ID
Read status
Notification title
Notification description
Update Notification
Path Parameters
The unique identifier of the notification to update
Request Body
Date the notification was sent
ID of the associated campaign
Read status. Values:
"leido" or "no leido"Notification title. Maximum 20 characters.
Notification description. Maximum 100 characters.
Example Request
Mark as Read
Path Parameters
The unique identifier of the notification to mark as read
Request Body
Set to
"leido" to mark as readExample Request
Example Response
Bulk Mark as Read
Request Body
Array of notification IDs to mark as read
Example Request
Example Response
Delete Notification
Path Parameters
The unique identifier of the notification to delete
Response
Returns 204 No Content on successful deletion.Estado Field Values
Theestado field uses specific string choices:
Available States
Leido - Notification has been read by the user
- Used when: User opens and views the notification
- Display label: “Leído”
No Leido - Notification has not been read
- Used when: Notification is first created or hasn’t been opened
- Display label: “No Leído”
- Default state for new notifications
Example Estado Usage
Relationships
The Notificacion model references:- CampanaPublicitaria: Notifications are associated with specific campaigns via
id_campana
Usage Notes
- The
estadofield must be exactly"leido"or"no leido"(case-sensitive) - New notifications should typically be created with
estado: "no leido" - The
titulofield is limited to 20 characters - keep titles concise - The
descripcionfield is limited to 100 characters - keep messages brief - Use the
fecha_envioto track when notifications were sent for sorting and filtering - Consider implementing pagination for notification lists in high-volume scenarios
Best Practices
- User Experience: Show unread count as a badge in the UI
- Automatic Marking: Mark notifications as read when user views them
- Sorting: Display newest notifications first (
orden_by=-fecha_envio) - Cleanup: Implement periodic cleanup of old read notifications
- Push Notifications: Integrate with
Usuario.token_notificacionfor push notifications - Grouping: Group notifications by campaign or date for better organization
- Validation: Ensure
id_campanareferences a valid campaign before creating
Integration with Push Notifications
The notification system integrates with user push notification tokens:Common Notification Types
Campaign Notifications
- New campaign launches
- Campaign approval/rejection
- Campaign expiration reminders
- Registration deadlines
Payment Notifications
- Payment processed
- Payment pending
- Payment failed
System Notifications
- Account activation
- Profile updates
- Document verification status
- Terms and conditions updates