Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JuanSebasSV/healtyhelp/llms.txt

Use this file to discover all available pages before exploring further.

The Notifications API exposes user-scoped in-app notifications. All routes require a valid Bearer token. The POST /api/notifications/mensaje route additionally requires an admin role.

The Notification object

{
  "_id": "665b2c3d4e5f6a7b8c9d0e1f",
  "userId": "663f0a1b2c3d4e5f6a7b8c9d",
  "type": "message",
  "leida": false,
  "fromUserId": null,
  "fromUserName": "",
  "recetaId": null,
  "recetaNombre": "",
  "resenaId": null,
  "respuestaId": null,
  "respuestaTexto": "",
  "adminId": "660a1b2c3d4e5f6a7b8c9d0e",
  "adminName": "Admin HealtyHelp",
  "asunto": "Bienvenido a HealtyHelp Premium",
  "mensaje": "Tu cuenta ha sido actualizada a Premium. ¡Disfruta todas las funciones!",
  "recetaCat": "",
  "recetaSalud": [],
  "createdAt": "2024-05-20T15:30:00.000Z",
  "updatedAt": "2024-05-20T15:30:00.000Z"
}

Field reference

FieldTypeDescription
_idstringMongoDB ObjectId of the notification
userIdstringObjectId of the notification recipient
typestringNotification type: reply, message, or new_recipe
leidabooleanfalse until the user marks it as read
fromUserIdstring | nullObjectId of the user who triggered a reply notification; null otherwise
fromUserNamestringDisplay name of the user who replied (denormalised for resilience)
recetaIdstring | nullObjectId of the related recipe (reply and new_recipe types)
recetaNombrestringRecipe name at notification time
resenaIdstring | nullObjectId of the review being replied to
respuestaIdstring | nullObjectId of the specific reply — use for deep-linking
respuestaTextostringTruncated preview of the reply text (max 120 chars)
adminIdstring | nullObjectId of the admin who sent a message type notification
adminNamestringAdmin display name (denormalised; remains visible even if the account is deleted)
asuntostringSubject line for message notifications (max 120 chars)
mensajestringBody text for message notifications (max 1,000 chars)
recetaCatstringRecipe category slug for new_recipe notifications
recetaSaludstring[]Health tags of the recipe for new_recipe notifications
createdAtstringISO 8601 UTC timestamp of creation
updatedAtstringISO 8601 UTC timestamp of last update

Notification types

typeTriggered when
replyAnother user replies to a review written by the authenticated user
messageAn admin sends a direct message via POST /api/notifications/mensaje
new_recipeA new recipe is published — broadcast to all users

Endpoints

GET /api/notifications

Returns the 30 most recent notifications for the authenticated user, sorted newest-first. Response 200 OK
{
  "success": true,
  "notificaciones": [ /* Notification[] */ ],
  "noLeidas": 3
}
FieldTypeDescription
successbooleanAlways true on success
notificacionesarrayUp to 30 Notification objects, sorted by createdAt descending
noLeidasnumberCount of unread notifications in the returned set
curl https://api.healtyhelp.com/api/notifications \
  -H "Authorization: Bearer <token>"

GET /api/notifications/no-leidas

Returns only the count of unread notifications. Intended for the navbar badge; avoids fetching full notification payloads. Response 200 OK
{
  "success": true,
  "noLeidas": 5
}
curl https://api.healtyhelp.com/api/notifications/no-leidas \
  -H "Authorization: Bearer <token>"

PUT /api/notifications/leer-todas

Marks all of the authenticated user’s unread notifications as read in a single operation. Response 200 OK
{ "success": true }
curl -X PUT https://api.healtyhelp.com/api/notifications/leer-todas \
  -H "Authorization: Bearer <token>"

PUT /api/notifications/:id/leer

Marks a single notification as read. The notification must belong to the authenticated user. Path parameter
id
string
required
MongoDB ObjectId of the notification to mark as read.
Response 200 OK
{
  "success": true,
  "notificacion": { /* updated Notification object */ }
}
Error responses
StatusCondition
404Notification not found or does not belong to the authenticated user
curl -X PUT https://api.healtyhelp.com/api/notifications/665b2c3d4e5f6a7b8c9d0e1f/leer \
  -H "Authorization: Bearer <token>"

DELETE /api/notifications/:id

Permanently deletes a notification owned by the authenticated user. Path parameter
id
string
required
MongoDB ObjectId of the notification to delete.
Response 200 OK
{ "success": true }
Error responses
StatusCondition
404Notification not found or does not belong to the authenticated user
curl -X DELETE https://api.healtyhelp.com/api/notifications/665b2c3d4e5f6a7b8c9d0e1f \
  -H "Authorization: Bearer <token>"

POST /api/notifications/mensaje

This endpoint requires the admin role. Requests from non-admin authenticated users will be rejected by the admin middleware.
Sends a direct message-type notification to a specific user. The notification appears in the recipient’s inbox immediately. Request body
userId
string
required
MongoDB ObjectId of the recipient user. The user must exist in the database.
mensaje
string
required
Notification body text. Must be non-empty and at most 1,000 characters.
asunto
string
Optional subject line. Truncated to 120 characters. Defaults to an empty string if omitted.
Response 201 Created
{
  "success": true,
  "message": "Mensaje enviado"
}
Error responses
StatusCondition
400userId is missing, mensaje is empty, or mensaje exceeds 1,000 characters
403Authenticated user does not have the admin role
404Recipient user not found
curl -X POST https://api.healtyhelp.com/api/notifications/mensaje \
  -H "Authorization: Bearer <admin-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "663f0a1b2c3d4e5f6a7b8c9d",
    "asunto": "Tu plan Premium está activo",
    "mensaje": "¡Hola! Tu cuenta ha sido actualizada a Premium. Ya tienes acceso a todas las funciones exclusivas de HealtyHelp."
  }'

Build docs developers (and LLMs) love