blob: fb031484a1e4d83247d7c62f849b2dd4d1117f6c [file] [log] [blame]
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="fcm_v1.html">Firebase Cloud Messaging API</a> . <a href="fcm_v1.projects.html">projects</a> . <a href="fcm_v1.projects.messages.html">messages</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#send">send(parent, body, x__xgafv=None)</a></code></p>
79<p class="firstline">Send a message to specified target (a registration token, topic</p>
80<h3>Method Details</h3>
81<div class="method">
82 <code class="details" id="send">send(parent, body, x__xgafv=None)</code>
83 <pre>Send a message to specified target (a registration token, topic
84or condition).
85
86Args:
87 parent: string, Required. It contains the Firebase project id (i.e. the unique identifier
88for your Firebase project), in the format of `projects/{project_id}`.
89For legacy support, the numeric project number with no padding is also
90supported in the format of `projects/{project_number}`. (required)
91 body: object, The request body. (required)
92 The object takes the form of:
93
94{ # Request to send a message to specified target.
95 "message": { # Message to send by Firebase Cloud Messaging Service. # Required. Message to send.
96 "name": "A String", # Output Only. The identifier of the message sent, in the format of
97 # `projects/*/messages/{message_id}`.
98 "fcmOptions": { # Platform independent options for features provided by the FCM SDKs. # Input only. Template for FCM SDK feature options to use across all
99 # platforms.
100 "analyticsLabel": "A String", # Label that the message's analytics data will be associated with.
101 },
102 "notification": { # Basic notification template to use across all platforms. # Input only. Basic notification template to use across all platforms.
103 "body": "A String", # The notification's body text.
104 "title": "A String", # The notification's title.
105 },
106 "token": "A String", # Registration token to send a message to.
107 "webpush": { # [Webpush protocol](https://tools.ietf.org/html/rfc8030) options. # Input only. [Webpush protocol](https://tools.ietf.org/html/rfc8030)
108 # options.
109 "headers": { # HTTP headers defined in webpush protocol. Refer to
110 # [Webpush protocol](https://tools.ietf.org/html/rfc8030#section-5) for
111 # supported headers, e.g. "TTL": "15".
112 "a_key": "A String",
113 },
114 "data": { # Arbitrary key/value payload. If present, it will override
115 # google.firebase.fcm.v1.Message.data.
116 "a_key": "A String",
117 },
118 "fcmOptions": { # Options for features provided by the FCM SDK for Web. # Options for features provided by the FCM SDK for Web.
119 "link": "A String", # The link to open when the user clicks on the notification.
120 # For all URL values, HTTPS is required.
121 },
122 "notification": { # Web Notification options as a JSON object. Supports Notification instance
123 # properties as defined in [Web Notification
124 # API](https://developer.mozilla.org/en-US/docs/Web/API/Notification). If
125 # present, "title" and "body" fields override
126 # [google.firebase.fcm.v1.Notification.title] and
127 # [google.firebase.fcm.v1.Notification.body].
128 "a_key": "", # Properties of the object.
129 },
130 },
131 "topic": "A String", # Topic name to send a message to, e.g. "weather".
132 # Note: "/topics/" prefix should not be provided.
133 "apns": { # [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options. # Input only. [Apple Push Notification Service](https://goo.gl/MXRTPa)
134 # specific options.
135 "headers": { # HTTP request headers defined in Apple Push Notification Service. Refer to
136 # [APNs request headers](https://goo.gl/C6Yhia) for
137 # supported headers, e.g. "apns-priority": "10".
138 "a_key": "A String",
139 },
140 "payload": { # APNs payload as a JSON object, including both `aps` dictionary and custom
141 # payload. See [Payload Key Reference](https://goo.gl/32Pl5W).
142 # If present, it overrides google.firebase.fcm.v1.Notification.title
143 # and google.firebase.fcm.v1.Notification.body.
144 "a_key": "", # Properties of the object.
145 },
146 "fcmOptions": { # Options for features provided by the FCM SDK for iOS. # Options for features provided by the FCM SDK for iOS.
147 "analyticsLabel": "A String", # Label that the message's analytics data will be associated with.
148 },
149 },
150 "android": { # Android specific options for messages sent through # Input only. Android specific options for messages sent through
151 # [FCM connection server](https://goo.gl/4GLdUl).
152 # [FCM connection server](https://goo.gl/4GLdUl).
153 "fcmOptions": { # Options for features provided by the FCM SDK for Android. # Options for features provided by the FCM SDK for Android.
154 "analyticsLabel": "A String", # Label that the message's analytics data will be associated with.
155 },
156 "notification": { # Notification to send to android devices. # Notification to send to android devices.
157 "sound": "A String", # The sound to play when the device receives the notification.
158 # Supports "default" or the filename of a sound resource bundled in the app.
159 # Sound files must reside in /res/raw/.
160 "bodyLocKey": "A String", # The key to the body string in the app's string resources to use to localize
161 # the body text to the user's current localization.
162 # See [String Resources](https://goo.gl/NdFZGI) for more information.
163 "bodyLocArgs": [ # Variable string values to be used in place of the format specifiers in
164 # body_loc_key to use to localize the body text to the user's current
165 # localization.
166 # See [Formatting and Styling](https://goo.gl/MalYE3) for more information.
167 "A String",
168 ],
169 "title": "A String", # The notification's title. If present, it will override
170 # google.firebase.fcm.v1.Notification.title.
171 "color": "A String", # The notification's icon color, expressed in #rrggbb format.
172 "channelId": "A String", # The [notification's channel
173 # id](https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels)
174 # (new in Android O). The app must create a channel with this channel ID
175 # before any notification with this channel ID is received. If you don't send
176 # this channel ID in the request, or if the channel ID provided has not yet
177 # been created by the app, FCM uses the channel ID specified in the app
178 # manifest.
179 "body": "A String", # The notification's body text. If present, it will override
180 # google.firebase.fcm.v1.Notification.body.
181 "clickAction": "A String", # The action associated with a user click on the notification.
182 # If specified, an activity with a matching intent filter is launched when
183 # a user clicks on the notification.
184 "titleLocKey": "A String", # The key to the title string in the app's string resources to use to
185 # localize the title text to the user's current localization.
186 # See [String Resources](https://goo.gl/NdFZGI) for more information.
187 "titleLocArgs": [ # Variable string values to be used in place of the format specifiers in
188 # title_loc_key to use to localize the title text to the user's current
189 # localization.
190 # See [Formatting and Styling](https://goo.gl/MalYE3) for more information.
191 "A String",
192 ],
193 "tag": "A String", # Identifier used to replace existing notifications in the notification
194 # drawer.
195 # If not specified, each request creates a new notification.
196 # If specified and a notification with the same tag is already being shown,
197 # the new notification replaces the existing one in the notification drawer.
198 "icon": "A String", # The notification's icon.
199 # Sets the notification icon to myicon for drawable resource myicon.
200 # If you don't send this key in the request, FCM displays the launcher icon
201 # specified in your app manifest.
202 },
203 "priority": "A String", # Message priority. Can take "normal" and "high" values.
204 # For more information, see [Setting the priority of a
205 # message](https://goo.gl/GjONJv).
206 "collapseKey": "A String", # An identifier of a group of messages that can be collapsed, so that only
207 # the last message gets sent when delivery can be resumed. A maximum of 4
208 # different collapse keys is allowed at any given time.
209 "ttl": "A String", # How long (in seconds) the message should be kept in FCM storage if the
210 # device is offline. The maximum time to live supported is 4 weeks, and the
211 # default value is 4 weeks if not set. Set it to 0 if want to send the
212 # message immediately.
213 # In JSON format, the Duration type is encoded as a string rather than an
214 # object, where the string ends in the suffix "s" (indicating seconds) and
215 # is preceded by the number of seconds, with nanoseconds expressed as
216 # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
217 # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
218 # be expressed in JSON format as "3.000000001s". The ttl will be rounded down
219 # to the nearest second.
220 "restrictedPackageName": "A String", # Package name of the application where the registration token must match in
221 # order to receive the message.
222 "data": { # Arbitrary key/value payload. If present, it will override
223 # google.firebase.fcm.v1.Message.data.
224 "a_key": "A String",
225 },
226 },
227 "data": { # Input only. Arbitrary key/value payload.
228 "a_key": "A String",
229 },
230 "condition": "A String", # Condition to send a message to,
231 # e.g. "'foo' in topics && 'bar' in topics".
232 },
233 "validateOnly": True or False, # Flag for testing the request without actually delivering the message.
234 }
235
236 x__xgafv: string, V1 error format.
237 Allowed values
238 1 - v1 error format
239 2 - v2 error format
240
241Returns:
242 An object of the form:
243
244 { # Message to send by Firebase Cloud Messaging Service.
245 "name": "A String", # Output Only. The identifier of the message sent, in the format of
246 # `projects/*/messages/{message_id}`.
247 "fcmOptions": { # Platform independent options for features provided by the FCM SDKs. # Input only. Template for FCM SDK feature options to use across all
248 # platforms.
249 "analyticsLabel": "A String", # Label that the message's analytics data will be associated with.
250 },
251 "notification": { # Basic notification template to use across all platforms. # Input only. Basic notification template to use across all platforms.
252 "body": "A String", # The notification's body text.
253 "title": "A String", # The notification's title.
254 },
255 "token": "A String", # Registration token to send a message to.
256 "webpush": { # [Webpush protocol](https://tools.ietf.org/html/rfc8030) options. # Input only. [Webpush protocol](https://tools.ietf.org/html/rfc8030)
257 # options.
258 "headers": { # HTTP headers defined in webpush protocol. Refer to
259 # [Webpush protocol](https://tools.ietf.org/html/rfc8030#section-5) for
260 # supported headers, e.g. "TTL": "15".
261 "a_key": "A String",
262 },
263 "data": { # Arbitrary key/value payload. If present, it will override
264 # google.firebase.fcm.v1.Message.data.
265 "a_key": "A String",
266 },
267 "fcmOptions": { # Options for features provided by the FCM SDK for Web. # Options for features provided by the FCM SDK for Web.
268 "link": "A String", # The link to open when the user clicks on the notification.
269 # For all URL values, HTTPS is required.
270 },
271 "notification": { # Web Notification options as a JSON object. Supports Notification instance
272 # properties as defined in [Web Notification
273 # API](https://developer.mozilla.org/en-US/docs/Web/API/Notification). If
274 # present, "title" and "body" fields override
275 # [google.firebase.fcm.v1.Notification.title] and
276 # [google.firebase.fcm.v1.Notification.body].
277 "a_key": "", # Properties of the object.
278 },
279 },
280 "topic": "A String", # Topic name to send a message to, e.g. "weather".
281 # Note: "/topics/" prefix should not be provided.
282 "apns": { # [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options. # Input only. [Apple Push Notification Service](https://goo.gl/MXRTPa)
283 # specific options.
284 "headers": { # HTTP request headers defined in Apple Push Notification Service. Refer to
285 # [APNs request headers](https://goo.gl/C6Yhia) for
286 # supported headers, e.g. "apns-priority": "10".
287 "a_key": "A String",
288 },
289 "payload": { # APNs payload as a JSON object, including both `aps` dictionary and custom
290 # payload. See [Payload Key Reference](https://goo.gl/32Pl5W).
291 # If present, it overrides google.firebase.fcm.v1.Notification.title
292 # and google.firebase.fcm.v1.Notification.body.
293 "a_key": "", # Properties of the object.
294 },
295 "fcmOptions": { # Options for features provided by the FCM SDK for iOS. # Options for features provided by the FCM SDK for iOS.
296 "analyticsLabel": "A String", # Label that the message's analytics data will be associated with.
297 },
298 },
299 "android": { # Android specific options for messages sent through # Input only. Android specific options for messages sent through
300 # [FCM connection server](https://goo.gl/4GLdUl).
301 # [FCM connection server](https://goo.gl/4GLdUl).
302 "fcmOptions": { # Options for features provided by the FCM SDK for Android. # Options for features provided by the FCM SDK for Android.
303 "analyticsLabel": "A String", # Label that the message's analytics data will be associated with.
304 },
305 "notification": { # Notification to send to android devices. # Notification to send to android devices.
306 "sound": "A String", # The sound to play when the device receives the notification.
307 # Supports "default" or the filename of a sound resource bundled in the app.
308 # Sound files must reside in /res/raw/.
309 "bodyLocKey": "A String", # The key to the body string in the app's string resources to use to localize
310 # the body text to the user's current localization.
311 # See [String Resources](https://goo.gl/NdFZGI) for more information.
312 "bodyLocArgs": [ # Variable string values to be used in place of the format specifiers in
313 # body_loc_key to use to localize the body text to the user's current
314 # localization.
315 # See [Formatting and Styling](https://goo.gl/MalYE3) for more information.
316 "A String",
317 ],
318 "title": "A String", # The notification's title. If present, it will override
319 # google.firebase.fcm.v1.Notification.title.
320 "color": "A String", # The notification's icon color, expressed in #rrggbb format.
321 "channelId": "A String", # The [notification's channel
322 # id](https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels)
323 # (new in Android O). The app must create a channel with this channel ID
324 # before any notification with this channel ID is received. If you don't send
325 # this channel ID in the request, or if the channel ID provided has not yet
326 # been created by the app, FCM uses the channel ID specified in the app
327 # manifest.
328 "body": "A String", # The notification's body text. If present, it will override
329 # google.firebase.fcm.v1.Notification.body.
330 "clickAction": "A String", # The action associated with a user click on the notification.
331 # If specified, an activity with a matching intent filter is launched when
332 # a user clicks on the notification.
333 "titleLocKey": "A String", # The key to the title string in the app's string resources to use to
334 # localize the title text to the user's current localization.
335 # See [String Resources](https://goo.gl/NdFZGI) for more information.
336 "titleLocArgs": [ # Variable string values to be used in place of the format specifiers in
337 # title_loc_key to use to localize the title text to the user's current
338 # localization.
339 # See [Formatting and Styling](https://goo.gl/MalYE3) for more information.
340 "A String",
341 ],
342 "tag": "A String", # Identifier used to replace existing notifications in the notification
343 # drawer.
344 # If not specified, each request creates a new notification.
345 # If specified and a notification with the same tag is already being shown,
346 # the new notification replaces the existing one in the notification drawer.
347 "icon": "A String", # The notification's icon.
348 # Sets the notification icon to myicon for drawable resource myicon.
349 # If you don't send this key in the request, FCM displays the launcher icon
350 # specified in your app manifest.
351 },
352 "priority": "A String", # Message priority. Can take "normal" and "high" values.
353 # For more information, see [Setting the priority of a
354 # message](https://goo.gl/GjONJv).
355 "collapseKey": "A String", # An identifier of a group of messages that can be collapsed, so that only
356 # the last message gets sent when delivery can be resumed. A maximum of 4
357 # different collapse keys is allowed at any given time.
358 "ttl": "A String", # How long (in seconds) the message should be kept in FCM storage if the
359 # device is offline. The maximum time to live supported is 4 weeks, and the
360 # default value is 4 weeks if not set. Set it to 0 if want to send the
361 # message immediately.
362 # In JSON format, the Duration type is encoded as a string rather than an
363 # object, where the string ends in the suffix "s" (indicating seconds) and
364 # is preceded by the number of seconds, with nanoseconds expressed as
365 # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
366 # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
367 # be expressed in JSON format as "3.000000001s". The ttl will be rounded down
368 # to the nearest second.
369 "restrictedPackageName": "A String", # Package name of the application where the registration token must match in
370 # order to receive the message.
371 "data": { # Arbitrary key/value payload. If present, it will override
372 # google.firebase.fcm.v1.Message.data.
373 "a_key": "A String",
374 },
375 },
376 "data": { # Input only. Arbitrary key/value payload.
377 "a_key": "A String",
378 },
379 "condition": "A String", # Condition to send a message to,
380 # e.g. "'foo' in topics && 'bar' in topics".
381 }</pre>
382</div>
383
384</body></html>