projects

POST /v1/projects/{projectsId}/messages:send

Changed on

Send a message to specified target (a Firebase Installation ID (FID), registration token, topic, or condition). If duplicate fields or parameters are provided in a request (such as repeated JSON keys in the request body or duplicate query parameters), the last occurrence takes precedence.

Request

  • Base URL
    https://fcm.googleapis.com
  • Auth
    • OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/cloud-platform
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/cloud-platform
    • or OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/firebase.messaging
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/firebase.messaging

Path parameters

projectsId, string required

Query parameters

$.xgafv, '1' | '2'

V1 error format.

access_token, string

OAuth access token.

alt, 'json' | 'media' | 'proto'

Data format for response.

callback, string

JSONP

fields, string

Selector specifying which fields to include in a partial response.

key, string

API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

oauth_token, string

OAuth 2.0 token for the current user.

prettyPrint, boolean

Returns response with indentations and line breaks.

quotaUser, string

Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

uploadType, string

Legacy upload protocol for media (e.g. "media", "multipart").

upload_protocol, string

Upload protocol for media (e.g. "raw", "multipart").

Request body

SendMessageRequest required

Request to send a message to specified target.

message, Message

Message to send by Firebase Cloud Messaging Service.

validateOnly, boolean

Flag for testing the request without actually delivering the message.

Response

Successful response

Message required

Message to send by Firebase Cloud Messaging Service.

android, AndroidConfig

Android specific options for messages sent through FCM connection server.

androidV2, AndroidConfigV2

Android specific V2 options for messages sent through FCM connection server. This is a v2 version of the AndroidConfig message and will replace it in the v2 API.

apns, ApnsConfig
condition, string

Condition to send a message to, e.g. "'foo' in topics && 'bar' in topics".

data, object

Input only. Arbitrary key/value payload, which must be UTF-8 encoded. The key should not be a reserved word ("from", "message_type", or any word starting with "google." or "gcm.notification."). When sending payloads containing only data fields to iOS devices, only normal priority ("apns-priority": "5") is allowed in ApnsConfig.

fcmOptions, FcmOptions

Platform independent options for features provided by the FCM SDKs.

fid, string

Firebase Installation ID (FID) to send a message to.

name, string

Output Only. The identifier of the message sent, in the format of projects/*/messages/{message_id}.

notification, Notification

Basic notification template to use across all platforms.

token, string

Deprecated: Use fid instead. During the transition period, this field also accepts a Firebase Installation ID (FID). Registration token to send a message to.

topic, string

Topic name to send a message to, e.g. "weather". Note: "/topics/" prefix should not be provided.

webpush, WebpushConfig

Changes

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/firebase.messaging was removed from the endpoint's security scheme Oauth2

    1 more change in this revision