Property

app

non-null admin.app.App

The app associated with the current Messaging service instance.

Example

var app = messaging.app;

Methods

sendToCondition

sendToCondition(condition, payload, options) returns Promise containing non-null admin.messaging.MessagingConditionResponse

Sends an FCM message to a condition.

See Send to a condition for code samples and detailed documentation.

Parameter

condition

string

The condition determining to which topics to send the message.

payload

admin.messaging.MessagingPayload

The message payload.

Value must not be null.

options

Optional

admin.messaging.MessagingOptions

Optional options to alter the message.

Value must not be null.

Returns

non-null Promise containing non-null admin.messaging.MessagingConditionResponse A promise fulfilled with the server's response after the message has been sent.

sendToDevice

sendToDevice(registrationTokens, payload, options) returns Promise containing non-null admin.messaging.MessagingDevicesResponse

Sends an FCM message to an array of devices corresponding to the provided registration tokens.

See Send to individual devices for code samples and detailed documentation.

Parameter

registrationTokens

Array of string

An array of registration tokens for the devices to which to send the message.

Value must not be null.

payload

admin.messaging.MessagingPayload

The message payload.

Value must not be null.

options

Optional

admin.messaging.MessagingOptions

Optional options to alter the message.

Value must not be null.

Returns

non-null Promise containing non-null admin.messaging.MessagingDevicesResponse A promise fulfilled with the server's response after the message has been sent.

sendToDevice

sendToDevice(registrationToken, payload, options) returns Promise containing non-null admin.messaging.MessagingDevicesResponse

Sends an FCM message to a single device corresponding to the provided registration token.

See Send to individual devices for code samples and detailed documentation.

Parameter

registrationToken

string

The registration token for the device to which to send the message.

payload

admin.messaging.MessagingPayload

The message payload.

Value must not be null.

options

Optional

admin.messaging.MessagingOptions

Optional options to alter the message.

Value must not be null.

Returns

non-null Promise containing non-null admin.messaging.MessagingDevicesResponse A promise fulfilled with the server's response after the message has been sent.

sendToDeviceGroup

sendToDeviceGroup(notificationKey, payload, options) returns Promise containing non-null admin.messaging.MessagingDeviceGroupResponse

Sends an FCM message to a device group corresponding to the provided notification key.

See Send to a device group for code samples and detailed documentation.

Parameter

notificationKey

string

The notification key for the device group to which to send the message.

payload

admin.messaging.MessagingPayload

The message payload.

Value must not be null.

options

Optional

admin.messaging.MessagingOptions

Optional options to alter the message.

Value must not be null.

Returns

non-null Promise containing non-null admin.messaging.MessagingDeviceGroupResponse A promise fulfilled with the server's response after the message has been sent.

sendToTopic

sendToTopic(topic, payload, options) returns Promise containing non-null admin.messaging.MessagingTopicResponse

Sends an FCM message to a topic.

See Send to a topic for code samples and detailed documentation.

Parameter

topic

string

The topic to which to send the message.

payload

admin.messaging.MessagingPayload

The message payload.

Value must not be null.

options

Optional

admin.messaging.MessagingOptions

Optional options to alter the message.

Value must not be null.

Returns

non-null Promise containing non-null admin.messaging.MessagingTopicResponse A promise fulfilled with the server's response after the message has been sent.