send(parent, body, x__xgafv=None)
Send a message to specified target (a registration token, topic
send(parent, body, x__xgafv=None)
Send a message to specified target (a registration token, topic or condition). Args: parent: string, Required. It contains the Firebase project id (i.e. the unique identifier for your Firebase project), in the format of `projects/{project_id}`. For legacy support, the numeric project number with no padding is also supported in the format of `projects/{project_number}`. (required) body: object, The request body. (required) The object takes the form of: { # Request to send a message to specified target. "message": { # Message to send by Firebase Cloud Messaging Service. # Required. Message to send. "name": "A String", # Output Only. The identifier of the message sent, in the format of # `projects/*/messages/{message_id}`. "fcmOptions": { # Platform independent options for features provided by the FCM SDKs. # Input only. Template for FCM SDK feature options to use across all # platforms. "analyticsLabel": "A String", # Label that the message's analytics data will be associated with. }, "notification": { # Basic notification template to use across all platforms. # Input only. Basic notification template to use across all platforms. "body": "A String", # The notification's body text. "title": "A String", # The notification's title. }, "token": "A String", # Registration token to send a message to. "webpush": { # [Webpush protocol](https://tools.ietf.org/html/rfc8030) options. # Input only. [Webpush protocol](https://tools.ietf.org/html/rfc8030) # options. "headers": { # HTTP headers defined in webpush protocol. Refer to # [Webpush protocol](https://tools.ietf.org/html/rfc8030#section-5) for # supported headers, e.g. "TTL": "15". "a_key": "A String", }, "data": { # Arbitrary key/value payload. If present, it will override # google.firebase.fcm.v1.Message.data. "a_key": "A String", }, "fcmOptions": { # Options for features provided by the FCM SDK for Web. # Options for features provided by the FCM SDK for Web. "link": "A String", # The link to open when the user clicks on the notification. # For all URL values, HTTPS is required. }, "notification": { # Web Notification options as a JSON object. Supports Notification instance # properties as defined in [Web Notification # API](https://developer.mozilla.org/en-US/docs/Web/API/Notification). If # present, "title" and "body" fields override # [google.firebase.fcm.v1.Notification.title] and # [google.firebase.fcm.v1.Notification.body]. "a_key": "", # Properties of the object. }, }, "topic": "A String", # Topic name to send a message to, e.g. "weather". # Note: "/topics/" prefix should not be provided. "apns": { # [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options. # Input only. [Apple Push Notification Service](https://goo.gl/MXRTPa) # specific options. "headers": { # HTTP request headers defined in Apple Push Notification Service. Refer to # [APNs request headers](https://goo.gl/C6Yhia) for # supported headers, e.g. "apns-priority": "10". "a_key": "A String", }, "payload": { # APNs payload as a JSON object, including both `aps` dictionary and custom # payload. See [Payload Key Reference](https://goo.gl/32Pl5W). # If present, it overrides google.firebase.fcm.v1.Notification.title # and google.firebase.fcm.v1.Notification.body. "a_key": "", # Properties of the object. }, "fcmOptions": { # Options for features provided by the FCM SDK for iOS. # Options for features provided by the FCM SDK for iOS. "analyticsLabel": "A String", # Label that the message's analytics data will be associated with. }, }, "android": { # Android specific options for messages sent through # Input only. Android specific options for messages sent through # [FCM connection server](https://goo.gl/4GLdUl). # [FCM connection server](https://goo.gl/4GLdUl). "fcmOptions": { # Options for features provided by the FCM SDK for Android. # Options for features provided by the FCM SDK for Android. "analyticsLabel": "A String", # Label that the message's analytics data will be associated with. }, "notification": { # Notification to send to android devices. # Notification to send to android devices. "sound": "A String", # The sound to play when the device receives the notification. # Supports "default" or the filename of a sound resource bundled in the app. # Sound files must reside in /res/raw/. "bodyLocKey": "A 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. # See [String Resources](https://goo.gl/NdFZGI) for more information. "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. # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. "A String", ], "title": "A String", # The notification's title. If present, it will override # google.firebase.fcm.v1.Notification.title. "color": "A String", # The notification's icon color, expressed in #rrggbb format. "channelId": "A String", # The [notification's channel # id](https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels) # (new in Android O). The app must create a channel with this channel ID # before any notification with this channel ID is received. If you don't send # this channel ID in the request, or if the channel ID provided has not yet # been created by the app, FCM uses the channel ID specified in the app # manifest. "body": "A String", # The notification's body text. If present, it will override # google.firebase.fcm.v1.Notification.body. "clickAction": "A String", # The 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. "titleLocKey": "A 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. # See [String Resources](https://goo.gl/NdFZGI) for more information. "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. # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. "A String", ], "tag": "A 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. "icon": "A String", # The notification's icon. # 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. }, "priority": "A String", # Message priority. Can take "normal" and "high" values. # For more information, see [Setting the priority of a # message](https://goo.gl/GjONJv). "collapseKey": "A String", # An identifier of a group of messages that can be collapsed, so that only # the last message gets sent when delivery can be resumed. A maximum of 4 # different collapse keys is allowed at any given time. "ttl": "A String", # 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 if not set. Set it to 0 if want to send the # message immediately. # In JSON format, the Duration type is encoded as a string rather than an # object, where the string ends in the suffix "s" (indicating seconds) and # is preceded by the number of seconds, with nanoseconds expressed as # fractional seconds. For example, 3 seconds with 0 nanoseconds should be # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should # be expressed in JSON format as "3.000000001s". The ttl will be rounded down # to the nearest second. "restrictedPackageName": "A String", # Package name of the application where the registration token must match in # order to receive the message. "data": { # Arbitrary key/value payload. If present, it will override # google.firebase.fcm.v1.Message.data. "a_key": "A String", }, }, "data": { # Input only. Arbitrary key/value payload. "a_key": "A String", }, "condition": "A String", # Condition to send a message to, # e.g. "'foo' in topics && 'bar' in topics". }, "validateOnly": True or False, # Flag for testing the request without actually delivering the message. } x__xgafv: string, V1 error format. Allowed values 1 - v1 error format 2 - v2 error format Returns: An object of the form: { # Message to send by Firebase Cloud Messaging Service. "name": "A String", # Output Only. The identifier of the message sent, in the format of # `projects/*/messages/{message_id}`. "fcmOptions": { # Platform independent options for features provided by the FCM SDKs. # Input only. Template for FCM SDK feature options to use across all # platforms. "analyticsLabel": "A String", # Label that the message's analytics data will be associated with. }, "notification": { # Basic notification template to use across all platforms. # Input only. Basic notification template to use across all platforms. "body": "A String", # The notification's body text. "title": "A String", # The notification's title. }, "token": "A String", # Registration token to send a message to. "webpush": { # [Webpush protocol](https://tools.ietf.org/html/rfc8030) options. # Input only. [Webpush protocol](https://tools.ietf.org/html/rfc8030) # options. "headers": { # HTTP headers defined in webpush protocol. Refer to # [Webpush protocol](https://tools.ietf.org/html/rfc8030#section-5) for # supported headers, e.g. "TTL": "15". "a_key": "A String", }, "data": { # Arbitrary key/value payload. If present, it will override # google.firebase.fcm.v1.Message.data. "a_key": "A String", }, "fcmOptions": { # Options for features provided by the FCM SDK for Web. # Options for features provided by the FCM SDK for Web. "link": "A String", # The link to open when the user clicks on the notification. # For all URL values, HTTPS is required. }, "notification": { # Web Notification options as a JSON object. Supports Notification instance # properties as defined in [Web Notification # API](https://developer.mozilla.org/en-US/docs/Web/API/Notification). If # present, "title" and "body" fields override # [google.firebase.fcm.v1.Notification.title] and # [google.firebase.fcm.v1.Notification.body]. "a_key": "", # Properties of the object. }, }, "topic": "A String", # Topic name to send a message to, e.g. "weather". # Note: "/topics/" prefix should not be provided. "apns": { # [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options. # Input only. [Apple Push Notification Service](https://goo.gl/MXRTPa) # specific options. "headers": { # HTTP request headers defined in Apple Push Notification Service. Refer to # [APNs request headers](https://goo.gl/C6Yhia) for # supported headers, e.g. "apns-priority": "10". "a_key": "A String", }, "payload": { # APNs payload as a JSON object, including both `aps` dictionary and custom # payload. See [Payload Key Reference](https://goo.gl/32Pl5W). # If present, it overrides google.firebase.fcm.v1.Notification.title # and google.firebase.fcm.v1.Notification.body. "a_key": "", # Properties of the object. }, "fcmOptions": { # Options for features provided by the FCM SDK for iOS. # Options for features provided by the FCM SDK for iOS. "analyticsLabel": "A String", # Label that the message's analytics data will be associated with. }, }, "android": { # Android specific options for messages sent through # Input only. Android specific options for messages sent through # [FCM connection server](https://goo.gl/4GLdUl). # [FCM connection server](https://goo.gl/4GLdUl). "fcmOptions": { # Options for features provided by the FCM SDK for Android. # Options for features provided by the FCM SDK for Android. "analyticsLabel": "A String", # Label that the message's analytics data will be associated with. }, "notification": { # Notification to send to android devices. # Notification to send to android devices. "sound": "A String", # The sound to play when the device receives the notification. # Supports "default" or the filename of a sound resource bundled in the app. # Sound files must reside in /res/raw/. "bodyLocKey": "A 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. # See [String Resources](https://goo.gl/NdFZGI) for more information. "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. # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. "A String", ], "title": "A String", # The notification's title. If present, it will override # google.firebase.fcm.v1.Notification.title. "color": "A String", # The notification's icon color, expressed in #rrggbb format. "channelId": "A String", # The [notification's channel # id](https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels) # (new in Android O). The app must create a channel with this channel ID # before any notification with this channel ID is received. If you don't send # this channel ID in the request, or if the channel ID provided has not yet # been created by the app, FCM uses the channel ID specified in the app # manifest. "body": "A String", # The notification's body text. If present, it will override # google.firebase.fcm.v1.Notification.body. "clickAction": "A String", # The 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. "titleLocKey": "A 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. # See [String Resources](https://goo.gl/NdFZGI) for more information. "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. # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. "A String", ], "tag": "A 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. "icon": "A String", # The notification's icon. # 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. }, "priority": "A String", # Message priority. Can take "normal" and "high" values. # For more information, see [Setting the priority of a # message](https://goo.gl/GjONJv). "collapseKey": "A String", # An identifier of a group of messages that can be collapsed, so that only # the last message gets sent when delivery can be resumed. A maximum of 4 # different collapse keys is allowed at any given time. "ttl": "A String", # 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 if not set. Set it to 0 if want to send the # message immediately. # In JSON format, the Duration type is encoded as a string rather than an # object, where the string ends in the suffix "s" (indicating seconds) and # is preceded by the number of seconds, with nanoseconds expressed as # fractional seconds. For example, 3 seconds with 0 nanoseconds should be # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should # be expressed in JSON format as "3.000000001s". The ttl will be rounded down # to the nearest second. "restrictedPackageName": "A String", # Package name of the application where the registration token must match in # order to receive the message. "data": { # Arbitrary key/value payload. If present, it will override # google.firebase.fcm.v1.Message.data. "a_key": "A String", }, }, "data": { # Input only. Arbitrary key/value payload. "a_key": "A String", }, "condition": "A String", # Condition to send a message to, # e.g. "'foo' in topics && 'bar' in topics". }