SDK JavaScript: riferimento alle notifiche
Ogni metodo per inviare e amministrare le notifiche, con relativa firma.
6 min letto·Livello riferimento·Revisionato il 12 ott 2026
Questo testo inglese è stato generato automaticamente dall'originale francese e non è stato ancora rivisto.
Questa pagina è stata tradotta automaticamente. Fa fede la versione inglese.
#
Classe
Servizio Notifiche
| Proprietà | Descrizione |
|---|---|
readonly admin: NotificationsAdminService | Subclient di amministrazione: statistiche, code, scarti (DLQ), log fornitori, eventi, regole e impostazioni. |
| Metodo | Descrizione |
|---|---|
send(options: SendNotificationOptions): Promise<AuraResponse<Notification>>send(channel: NotificationChannel, recipient: string, body: string, options?: { subject?: string; templateId?: string; variables?: Record<string, unknown>; metadata?: Record<string, unknown>; idempotencyKey?: string; }): Promise<AuraResponse<Notification>> | Accoda una notifica da inviare (API Modern Object). |
sendBatch(items: Array<SendNotificationRequest | SendNotificationItem>): Promise<AuraResponse<BatchSendResponse>> | Invia un batch di notifiche (POST /send/batch). |
sendEmail(recipient: string, subject: string, body: string, options?: SendEmailOptions): Promise<AuraResponse<Notification>> | Invia un'e-mail transazionale (channel: 'email'). |
sendSms(recipient: string, body: string, options?: SendSmsOptions): Promise<AuraResponse<Notification>> | Invia un SMS transazionale (channel: 'sms'). |
sendPush(recipient: string, title: string, body: string, options?: SendPushOptions): Promise<AuraResponse<Notification>> | Invia una notifica push mobile (channel: 'push', FCM o APN). |
sendWebhook(targetUrl: string, event: string, payload: string | Record<string, unknown>, options?: SendWebhookOptions): Promise<AuraResponse<Notification>> | Emette un webhook HTTP POST in uscita (channel: 'webhook'). |
retry(id: string): Promise<AuraResponse<Notification>> | Riprova una notifica non riuscita (status: 'failed' o 'dead_lettered'). |
list(options?: { channel?: NotificationChannel; status?: NotificationStatus; search?: string; sort?: 'created_at' | 'updated_at' | 'status'; order?: 'asc' | 'desc'; limit?: number; offset?: number; }): Promise<AuraResponse<Notification[]>> | Elenca la cronologia delle notifiche del progetto, filtrabile per channel, status e search, ordinata per created_at, updated_at o status, con limit / offset impaginazione. |
get(id: string): Promise<AuraResponse<Notification>> | Legge una notifica in base al suo identificatore. |
listTemplates(): Promise<AuraResponse<NotificationTemplate[]>> | Elenca i modelli di messaggio del progetto. |
getTemplate(id: string): Promise<AuraResponse<NotificationTemplate>> | Legge un modello di messaggio in base al relativo identificatore. |
createTemplate(template: Omit<NotificationTemplate, 'id' | 'project_id' | 'created_at' | 'updated_at'>): Promise<AuraResponse<NotificationTemplate>> | Crea un modello: name, channel, subject, body e nient'altro. |
updateTemplate(id: string, updates: Partial<Pick<NotificationTemplate, 'name' | 'subject' | 'body'>>): Promise<AuraResponse<NotificationTemplate>> | Aggiorna un modello: name, subject e/o body. |
deleteTemplate(id: string): Promise<AuraResponse<null>> | Elimina un modello di messaggio. |
#
Classe
NotificheAdminService
| Metodo | Descrizione |
|---|---|
getSettings(): Promise<AuraResponse<NotificationSettingsPublic>> | Recupera il fornitore pubblico del progetto e le impostazioni delle quote (GET /settings). |
updateSettings(settings: NotificationSettingsPatch | Partial<NotificationSettings>): Promise<AuraResponse<NotificationSettingsPublic>> | Aggiorna le impostazioni del fornitore o della quota del progetto (PATCH /settings). |
getStats(options?: { window?: NotificationStatsWindow; channel?: NotificationChannel; }): Promise<AuraResponse<NotificationStats>> | Statistiche di invio aggregate (GET /stats). |
getQueue(): Promise<AuraResponse<NotificationQueueStats>> | Legge lo stato della coda di invio: profondità e distribuzione delle notifiche pendenti. |
listAttempts(notificationId: string): Promise<AuraResponse<NotificationAttempt[]>> | Elenca i tentativi di inviare una notifica, con la risposta del provider a ciascuno. |
listDeadLetters(options?: { channel?: NotificationChannel; search?: string; limit?: number; offset?: number; }): Promise<AuraResponse<NotificationDeadLetter[]>> | Elenca le notifiche inserite nella coda dei rifiuti (DLQ), filtrabili da channel e search. |
retryDeadLetter(id: string): Promise<AuraResponse<Notification>> | Invia nuovamente una notifica specifica dalla coda degli scarti (DLQ). |
listEvents(options?: { status?: 'received' | 'matched' | 'ignored' | 'failed' | 'enqueued'; limit?: number; offset?: number; }): Promise<AuraResponse<NotificationEvent[]>> | Elenca gli eventi ricevuti dal motore delle regole, filtrabili da status. |
listProviderLogs(options?: { channel?: NotificationChannel; status?: NotificationAttemptStatus; limit?: number; offset?: number; }): Promise<AuraResponse<NotificationProviderLog[]>> | Registri di esecuzione del fornitore di terze parti (GET /providers/logs). |
previewTemplate(id: string, variables: Record<string, unknown>): Promise<AuraResponse<NotificationTemplatePreview>> | Esegue il rendering di un modello con variables specificato per l'anteprima, senza inviare un messaggio. |
listRules(): Promise<AuraResponse<NotificationRule[]>> | Elenca le regole di notifica del progetto (attivazione automatica di un invio). |
createRule(rule: CreateNotificationRuleRequest): Promise<AuraResponse<NotificationRule>> | Crea una regola di notifica: per ogni evento di tipo trigger_type che controlla condition, viene inviato un messaggio su channel al destinatario indicato da recipient_expr, con un ritardo opzionale. |
getRule(id: string): Promise<AuraResponse<NotificationRule>> | Legge una regola di notifica in base al relativo identificatore. |
updateRule(id: string, updates: UpdateNotificationRuleRequest): Promise<AuraResponse<NotificationRule>> | Aggiorna una regola di notifica: cambiano solo i campi forniti (ad esempio enabled). |
deleteRule(id: string): Promise<AuraResponse<null>> | Elimina una regola di notifica. |
Pagina generata
Questa pagina viene generata dalle dichiarazioni di tipo e dai commenti dell'SDK, quindi non può derivare dal codice pubblicato. Per esempi pratici, leggi le guide.
Ultimo aggiornamento · 12 ott 2026