notifications

Send notification

Send a Firebase notification to one user (self by default). Uses notification logs as source of truth.

post/api/notifications/send

Request body

user_idstring uuid nullable

Target user ID. If omitted, sends to the authenticated user.

titlestring required

Notification title

bodystring required

Notification body

notification_type'chat' | 'booking' | 'payment' | 'subscription' | 'event' | 'general' | 'daily_morning' | 'daily_evening' | 'lunch' | 'journey' | 'corabea_plus' | 'diary_shared' | 'kit_document'

Notification type constants for FCM notifications.

dataobject nullable

Optional FCM data payload (string key-value pairs)

notification_metadataobject nullable

Optional metadata for backend logs (chat_id, appointment_id, etc.)

active_onlyboolean

If true, send only to active FCM tokens

Example request

{
  "active_only": true,
  "body": "Hai un nuovo appuntamento prenotato",
  "data": {
    "appointment_id": "123e4567-e89b-12d3-a456-426614174001",
    "show_in_foreground": "true",
    "type": "booking"
  },
  "notification_metadata": {
    "appointment_id": "123e4567-e89b-12d3-a456-426614174001"
  },
  "notification_type": "booking",
  "title": "Nuovo appuntamento",
  "user_id": "123e4567-e89b-12d3-a456-426614174000"
}

Response

Successful Response

success_countinteger required

Number of successful notifications sent

failure_countinteger required

Number of failed notifications

total_devicesinteger required

Total number of devices with FCM tokens

resultsobject[]

Detailed results per device

Example response

{
  "failure_count": 0,
  "results": [
    {
      "success": true,
      "token": "fGhJkLmNoPqRsTu..."
    },
    {
      "success": true,
      "token": "aBcDeFgHiJkLmNo..."
    }
  ],
  "success_count": 2,
  "total_devices": 2
}

Changes