NotificationMessagePayload interface

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 for code samples and detailed documentation.

Signature:

export interface NotificationMessagePayload 

Properties

Property Type Description
badge string The value of the badge on the home screen app icon.If not specified, the badge is not changed.If set to 0, the badge is removed.**Platforms:** iOS
body string The notification's body text.**Platforms:** iOS, Android, Web
bodyLocArgs string Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.The value should be a stringified JSON array.**iOS:** Corresponds to loc-args in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.**Android:** See Formatting and Styling for more information.**Platforms:** iOS, Android
bodyLocKey string The key to the body string in the app's string resources to use to localize the body text to the user's current localization.**iOS:** Corresponds to loc-key in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.**Android:** See String Resources for more information.**Platforms:** iOS, Android
clickAction string Action associated with a user click on the notification. If specified, an activity with a matching Intent Filter is launched when a user clicks on the notification.* **Platforms:** Android
color string The notification icon's color, expressed in #rrggbb format.**Platforms:** Android
icon string The notification's icon.**Android:** Sets the notification icon to myicon for drawable resource myicon. If you don't send this key in the request, FCM displays the launcher icon specified in your app manifest.**Web:** The URL to use for the notification's icon.**Platforms:** Android, Web
sound string The sound to be played when the device receives a notification. Supports "default" for the default notification sound of the device or the filename of a sound resource bundled in the app. Sound files must reside in /res/raw/.**Platforms:** Android
tag string Identifier used to replace existing notifications in the notification drawer.If not specified, each request creates a new notification.If specified and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.**Platforms:** Android
title string The notification's title.**Platforms:** iOS, Android, Web
titleLocArgs string Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.The value should be a stringified JSON array.**iOS:** Corresponds to title-loc-args in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.**Android:** See Formatting and Styling for more information.**Platforms:** iOS, Android
titleLocKey string The key to the title string in the app's string resources to use to localize the title text to the user's current localization.**iOS:** Corresponds to title-loc-key in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.**Android:** See String Resources for more information.**Platforms:** iOS, Android

NotificationMessagePayload.badge

The value of the badge on the home screen app icon.

If not specified, the badge is not changed.

If set to 0, the badge is removed.

**Platforms:** iOS

Signature:

badge?: string;

NotificationMessagePayload.body

The notification's body text.

**Platforms:** iOS, Android, Web

Signature:

body?: string;

NotificationMessagePayload.bodyLocArgs

Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.

The value should be a stringified JSON array.

**iOS:** Corresponds to loc-args in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.

**Android:** See Formatting and Styling for more information.

**Platforms:** iOS, Android

Signature:

bodyLocArgs?: string;

NotificationMessagePayload.bodyLocKey

The key to the body string in the app's string resources to use to localize the body text to the user's current localization.

**iOS:** Corresponds to loc-key in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.

**Android:** See String Resources for more information.

**Platforms:** iOS, Android

Signature:

bodyLocKey?: string;

NotificationMessagePayload.clickAction

Action associated with a user click on the notification. If specified, an activity with a matching Intent Filter is launched when a user clicks on the notification.

* **Platforms:** Android

Signature:

clickAction?: string;

NotificationMessagePayload.color

The notification icon's color, expressed in #rrggbb format.

**Platforms:** Android

Signature:

color?: string;

NotificationMessagePayload.icon

The notification's icon.

**Android:** Sets the notification icon to myicon for drawable resource myicon. If you don't send this key in the request, FCM displays the launcher icon specified in your app manifest.

**Web:** The URL to use for the notification's icon.

**Platforms:** Android, Web

Signature:

icon?: string;

NotificationMessagePayload.sound

The sound to be played when the device receives a notification. Supports "default" for the default notification sound of the device or the filename of a sound resource bundled in the app. Sound files must reside in /res/raw/.

**Platforms:** Android

Signature:

sound?: string;

NotificationMessagePayload.tag

Identifier used to replace existing notifications in the notification drawer.

If not specified, each request creates a new notification.

If specified and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.

**Platforms:** Android

Signature:

tag?: string;

NotificationMessagePayload.title

The notification's title.

**Platforms:** iOS, Android, Web

Signature:

title?: string;

NotificationMessagePayload.titleLocArgs

Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.

The value should be a stringified JSON array.

**iOS:** Corresponds to title-loc-args in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.

**Android:** See Formatting and Styling for more information.

**Platforms:** iOS, Android

Signature:

titleLocArgs?: string;

NotificationMessagePayload.titleLocKey

The key to the title string in the app's string resources to use to localize the title text to the user's current localization.

**iOS:** Corresponds to title-loc-key in the APNs payload. See Payload Key Reference and Localizing the Content of Your Remote Notifications for more information.

**Android:** See String Resources for more information.

**Platforms:** iOS, Android

Signature:

titleLocKey?: string;