Classes

Class Description
Messaging Messaging service bound to the provided app.

Functions

Function Description
getMessaging(app) Gets the service for the default app or a given app.admin.messaging() can be called with no arguments to access the default app's service or as admin.messaging(app) to access the service associated with a specific app.

Interfaces

Interface Description
AndroidConfig Represents the Android-specific options that can be included in an .
AndroidFcmOptions Represents options for features provided by the FCM SDK for Android.
AndroidNotification Represents the Android-specific notification options that can be included in .
ApnsConfig Represents the APNs-specific options that can be included in an . Refer to [Apple documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for various headers and payload fields supported by APNs.
ApnsFcmOptions Represents options for features provided by the FCM SDK for iOS.
ApnsPayload Represents the payload of an APNs message. Mainly consists of the aps dictionary. But may also contain other arbitrary custom keys.
Aps Represents the [aps dictionary](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html) that is part of APNs messages.
ApsAlert
BaseMessage
BatchResponse Interface representing the server response from the and methods.
ConditionMessage
CriticalSound Represents a critical sound configuration that can be included in the aps dictionary of an APNs payload.
DataMessagePayload Interface representing an FCM legacy API data message payload. Data messages let developers send up to 4KB of custom key-value pairs. The keys and values must both be strings. Keys can be any custom string, except for the following reserved strings:* "from" * Anything starting with "google.".See [Build send requests](/docs/cloud-messaging/send-message) for code samples and detailed documentation.
FcmOptions Represents platform-independent options for features provided by the FCM SDKs.
LightSettings Represents settings to control notification LED that can be included in .
MessagingConditionResponse Interface representing the server response from the legacy method.See [Send to a condition](/docs/cloud-messaging/admin/send-messages#send_to_a_condition) for code samples and detailed documentation.
MessagingDeviceGroupResponse Interface representing the server response from the method.See [Send messages to device groups](/docs/cloud-messaging/send-message?authuser=0#send_messages_to_device_groups) for code samples and detailed documentation.
MessagingDeviceResult
MessagingDevicesResponse Interface representing the status of a message sent to an individual device via the FCM legacy APIs.See [Send to individual devices](/docs/cloud-messaging/admin/send-messages#send_to_individual_devices) for code samples and detailed documentation.
MessagingOptions Interface representing the options that can be provided when sending a message via the FCM legacy APIs.See [Build send requests](/docs/cloud-messaging/send-message) for code samples and detailed documentation.
MessagingPayload Interface representing a Firebase Cloud Messaging message payload. One or both of the data and notification keys are required.See [Build send requests](/docs/cloud-messaging/send-message) for code samples and detailed documentation.
MessagingTopicManagementResponse Interface representing the server response from the and methods.See [Manage topics from the server](/docs/cloud-messaging/manage-topics) for code samples and detailed documentation.
MessagingTopicResponse Interface representing the server response from the legacy method.See [Send to a topic](/docs/cloud-messaging/admin/send-messages#send_to_a_topic) for code samples and detailed documentation.
MulticastMessage Payload for the admin.messaing.sendMulticast() method. The payload contains all the fields in the BaseMessage type, and a list of tokens.
Notification A notification that can be included in .
NotificationMessagePayload Interface representing an FCM legacy API notification message payload. Notification messages let developers send up to 4KB of predefined key-value pairs. Accepted keys are outlined below.See [Build send requests](/docs/cloud-messaging/send-message) for code samples and detailed documentation.
SendResponse Interface representing the status of an individual message that was sent as part of a batch request.
TokenMessage
TopicMessage
WebpushConfig Represents the WebPush protocol options that can be included in an .
WebpushFcmOptions Represents options for features provided by the FCM SDK for Web (which are not part of the Webpush standard).
WebpushNotification Represents the WebPush-specific notification options that can be included in . This supports most of the standard options as defined in the Web Notification [specification](https://developer.mozilla.org/en-US/docs/Web/API/notification/Notification).

Type Aliases

Type Alias Description
Message Payload for the admin.messaging.send() operation. The payload contains all the fields in the BaseMessage type, and exactly one of token, topic or condition.

getMessaging()

Gets the service for the default app or a given app.

admin.messaging() can be called with no arguments to access the default app's service or as admin.messaging(app) to access the service associated with a specific app.

Signature:

export declare function getMessaging(app?: App): Messaging;

Parameters

Parameter Type Description
app App Optional app whose Messaging service to return. If not provided, the default Messaging service will be returned. The default Messaging service if no app is provided or the Messaging service associated with the provided app.

Returns:

Messaging

Example 1

// Get the Messaging service for the default app
const defaultMessaging = getMessaging();

Example 2

// Get the Messaging service for a given app
const otherMessaging = getMessaging(otherApp);

Message

Payload for the admin.messaging.send() operation. The payload contains all the fields in the BaseMessage type, and exactly one of token, topic or condition.

Signature:

export declare type Message = TokenMessage | TopicMessage | ConditionMessage;