Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi inviare messaggi di notifica utilizzando
il compositore di notifiche nella console Firebase. Sebbene non offra la stessa flessibilità o scalabilità dell'invio di messaggi con l'Admin SDK o il protocollo HTTP v1, può essere molto utile per i test o per il marketing e il coinvolgimento degli utenti altamente mirati.
La console Firebase fornisce test A/B basati su Analytics per perfezionare e migliorare i messaggi di marketing.
Dopo aver sviluppato la logica nella tua app per ricevere messaggi, puoi consentire agli utenti non tecnici di inviare messaggi con lo strumento di composizione delle notifiche.
Informazioni
Quando invii un messaggio di notifica dal
composer delle notifiche,
Google utilizza i valori inseriti nei campi del modulo nei seguenti modi:
Campi come Segmento di utenti e Scade determinano il target del messaggio
e le opzioni di pubblicazione.
Campi come Testo notifica e Dati personalizzati vengono inviati al client in un
payload composto da coppie chiave/valore.
Questi campi vengono mappati alle chiavi disponibili tramite l'oggetto
Message. Ad esempio, le coppie chiave/valore inserite nel campo Dati personalizzati
del compositore vengono gestite come
payload data
per la notifica. Gli altri campi vengono mappati direttamente alle chiavi nell'oggetto
notification o nella configurazione delle notifiche specifica della piattaforma.
Tieni presente che alcuni campi del
composer delle notifichenon sono disponibili tramite
l'API FCM. Ad esempio, puoi scegliere come target segmenti di utenti
in base alla versione dell'app, alla lingua, al tipo e alla versione del browser o alle proprietà utente
in modi non disponibili utilizzando l'API server.
Le chiavi che la console Firebase invia ai client sono:
Chiave
Etichetta campo console
Descrizione
notification.title
Titolo della notifica
Indica il titolo della notifica.
notification.body
Testo della notifica
Indica il corpo del testo della notifica.
data
Dati personalizzati
Coppie chiave-valore che definisci. Questi vengono forniti
come payload di dati da gestire per l'app.
I fattori che determinano il recapito dei messaggi includono:
Chiave
Etichetta campo console
Descrizione
sound
Audio
Indica un suono da riprodurre quando il dispositivo riceve una notifica.
time_to_live
Scadenza
Questo parametro specifica per quanto tempo (in secondi) il messaggio deve essere conservato nello spazio di archiviazione FCM
se il dispositivo è offline.
Per maggiori informazioni, vedi Impostare la durata di un messaggio.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-03 UTC."],[],[],null,["You can send notification messages using\n[the Notifications composer](//console.firebase.google.com/project/_/notification) in the Firebase console. Though this does not\nprovide the same flexibility or scalability as sending messages with the\n[Admin SDK](/docs/cloud-messaging/admin) or the\n[v1 HTTP protocol](/docs/reference/fcm/rest), it can be\nvery useful for testing or for highly targeted marketing and user engagement.\nThe Firebase console provides analytics-based\n[A/B testing](/docs/ab-testing/abtest-with-console) to help refine and\nimprove marketing messages.\n\nAfter you have developed logic in your app to receive messages, you can allow\nnon-technical users to send messages with\n[the Notifications composer](//console.firebase.google.com/project/_/notification).\n\nAbout\n\nWhen you send a notification message from\n[the Notifications composer](//console.firebase.google.com/project/_/notification),\nGoogle uses the values you enter in the form fields in these ways:\n\n- Fields like **User segment** and **Expires** determine the message target and delivery options.\n- Fields like **Notification text** and **Custom data** are sent to the client in a payload comprised of key/value pairs.\n\nThese fields map to keys available through the\n[`Message`](/docs/reference/fcm/rest/v1/projects.messages#resource:-message)\nobject. For example, key/value pairs entered in the **Custom data**\nfield of the composer are handled as a\n[`data`](/docs/reference/fcm/rest/v1/projects.messages#Message.FIELDS.data)\npayload for the notification. Other fields map directly to keys in the\n[`notification`](/docs/reference/fcm/rest/v1/projects.messages#notification)\nobject or in the platform specific notification configuration.\n\nNote that some fields in\n[the Notifications composer](//console.firebase.google.com/project/_/notification) are *not* available through\nthe FCM API. For example, you can target user segments\nbased on app version, language, browser type and version, or user properties\nin ways that are not available using the server API.\n| **Caution:** In another important difference from programmatic messaging, the console lets you cancel any scheduled message that is not already in progress. **Once\n| a message fanout is actually in progress, it is fully committed and\n| cannot be canceled through the console nor by Firebase support.**\n\nThe keys that the Firebase console sends to clients are:\n\n| Key | Console field label | Description |\n|----------------------|---------------------|-----------------------------------------------------------------------------------------------|\n| `notification.title` | Notification title | Indicates notification title. |\n| `notification.body` | Notification text | Indicates notification body text. |\n| `data` | Custom data | Key/value pairs that you define. These are delivered as a data payload for the app to handle. |\n\nKeys that determine message delivery include:\n\n| Key | Console field label | Description |\n|----------------|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sound` | Sound | Indicates a sound to play when the device receives a notification. |\n| `time_to_live` | Expires | This parameter specifies how long (in seconds) the message should be kept in FCM storage if the device is offline. For more information, see [Setting the lifespan of a message](/docs/cloud-messaging/concept-options#ttl). |"]]