This document provides a reference for the XMPP syntax used to pass messages between your app server, client apps, and Firebase Cloud Messaging (FCM). Your app server must connect to these endpoints:
// Production fcm-xmpp.googleapis.com:5235 // Testing fcm-xmpp.googleapis.com:5236
The available parameters and options fall into these categories:
- Downstream message syntax
- Downstream message error response codes
- Upstream message syntax
- FCM control messages
Downstream message syntax
This section gives the syntax for sending downstream messages.
Downstream XMPP messages (JSON)
The following table lists the targets, options, and payload for XMPP JSON messages.
Table 1 Targets, options, and payload for downstream XMPP messages (JSON).
Parameter | Usage | Description | |
---|---|---|---|
Target | |||
to |
Optional, string |
This parameter specifies the recipient of a message.
The value can be a device's registration token, a device group's
notification key, or a single topic (prefixed with
|
|
condition |
Optional, string | This parameter specifies a logical expression of conditions that determines the message target. Supported condition: Topic, formatted as "'yourTopic' in topics". This value is case-insensitive. Supported operators: |
|
Options | |||
message_id |
Required, string | This parameter uniquely identifies a message in an XMPP connection. |
|
collapse_key |
Optional, string | This parameter identifies a group of messages (e.g., with
There is no guarantee of the order in which messages get sent. Note: A maximum of 4 different collapse keys is allowed at any given time. This means FCM can simultaneously store 4 different messages per client app. If you exceed this number, there is no guarantee which 4 collapse keys FCM will keep. |
|
priority |
Optional, string | Sets the priority of the message. Valid values are "normal" and "high." On iOS, these correspond to APNs priorities 5 and 10. By default, notification messages are sent with high priority, and data messages are sent with normal priority. Normal priority optimizes the client app's battery consumption and should be used unless immediate delivery is required. For messages with normal priority, the app may receive the message with unspecified delay. When a message is sent with high priority, it is sent immediately, and the app can display a notification. |
|
content_available |
Optional, boolean | On iOS, use this field to represent |
|
mutable_content |
Optional, JSON boolean | Currently for iOS 10+ devices only. On iOS, use this field to represent
|
|
time_to_live |
Optional, number | This parameter specifies how long (in seconds) the message should be kept in FCM storage if the device is offline. The maximum time to live supported is 4 weeks, and the default value is 4 weeks. For more information, see Setting the lifespan of a message. |
|
delivery_receipt_
|
Optional, boolean | This parameter lets the app server request confirmation of message delivery. When this parameter is set to Note: this parameter is not supported for messages sent to iOS
devices. The default value is |
|
dry_run |
Optional, boolean | This parameter, when set to The default value is |
|
Payload | |||
data |
Optional, object | This parameter specifies the key-value pairs of the message's payload. For example, with On iOS, if the message is delivered by APNs, it represents the custom data fields. If
it is delivered by FCM,
it is represented as a key value dictionary in On Android, this results in an intent extra named The key should not be a reserved word ("from", "message_type", or any word starting with
"google" or "gcm"). Do not use any of the words defined in this table
(such as |