Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Wiadomości z powiadomieniami możesz wysyłać za pomocą Firebase kompozytora powiadomień w konsoli. Chociaż nie zapewnia to takiej elastyczności ani skalowalności jak wysyłanie wiadomości za pomocą pakietu Admin SDK lub protokołu HTTP w wersji 1, może być bardzo przydatne do testowania lub do wysoce ukierunkowanego marketingu i angażowania użytkowników.
FirebaseKonsola udostępnia opartą na analizach funkcję testów A/B, która pomaga dopracowywać i ulepszać komunikaty marketingowe.
Po opracowaniu w aplikacji logiki odbierania wiadomości możesz umożliwić użytkownikom nietechnicznym wysyłanie wiadomości za pomocą kompozytora powiadomień.
Informacje
Gdy wysyłasz wiadomość z powiadomieniem z
kompozytora powiadomień,
Google wykorzystuje wartości wpisane w polach formularza w ten sposób:
Pola takie jak Segment użytkowników i Wygasa określają grupę docelową wiadomości i opcje dostawy.
Pola takie jak Tekst powiadomienia i Dane niestandardowe są wysyłane do klienta w ładunku składającym się z par klucz/wartość.
Te pola są mapowane na klucze dostępne w obiekcie Message. Na przykład pary klucz-wartość wpisane w polu Dane niestandardowe w kompozytorze są traktowane jako ładunek data powiadomienia. Pozostałe pola są mapowane bezpośrednio na klucze w obiekcie notification lub w konfiguracji powiadomień na konkretnej platformie.
Pamiętaj, że niektóre pola w
edytorze powiadomień są niedostępne w interfejsie FCM API. Możesz na przykład kierować reklamy na segmenty użytkowników na podstawie wersji aplikacji, języka, typu i wersji przeglądarki lub właściwości użytkownika w sposób niedostępny w przypadku interfejsu API serwera.
Klucze, które konsola Firebase wysyła do klientów, to:
Klucz
Etykieta pola konsoli
Opis
notification.title
Tytuł powiadomienia
Wskazuje tytuł powiadomienia.
notification.body
Tekst powiadomienia
Wskazuje tekst powiadomienia.
data
Dane niestandardowe
Pary klucz/wartość, które definiujesz. Są one dostarczane jako ładunek danych, który aplikacja może przetworzyć.
Klucze, które określają dostarczanie wiadomości, to:
Klucz
Etykieta pola konsoli
Opis
sound
Dźwięk
Wskazuje dźwięk, który ma być odtwarzany, gdy urządzenie otrzyma powiadomienie.
time_to_live
Wygasa
Ten parametr określa, jak długo (w sekundach) wiadomość ma być przechowywana w pamięci FCM, jeśli urządzenie jest w trybie offline.
Więcej informacji znajdziesz w artykule Ustawianie czasu życia wiadomości.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 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). |"]]