Send FCM avatar
Send FCM

Pricing

Pay per usage

Go to Store
Send FCM

Send FCM

Developed by

Martin Forejt

Maintained by Community

This actor can be used as integration with Firebase Cloud Messaging (FCM). It sends a message (aka push notification) to a device, group of devices or topics. The message can be fully customised supporting all FCM options.

5.0 (1)

Pricing

Pay per usage

3

Monthly users

1

Last modified

2 hours ago

FCM Send

Firebase Cloud Messaging

This actor can be used as integration with Firebase Cloud Messaging. It sends a message to a device, group of devices or topics. The message can be fully customized supporting all FCM options.

Targets option

  • Device id(s) - Send a message to a specific device or group of devices.
  • Topic - Send a message to a topic.
  • Condition - Send a message to a condition.

Input

The input of this actor should be JSON containing the following fields:

FieldRequiredTypeDescription
serviceAccountKeytruestringService account key in JSON format. You can get it from Firebase Console -> Project Settings -> Service accounts -> Generate new private key.
deviceTokensfalse*string arrayArray of device tokens to send the message to.
topicfalse*stringTopic to send the message to.
conditionfalse*stringCondition to send the message to.
notificationtrueobject (json)Notification object to send. See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource:-message for more details.
datafalseobject (json)Data object to send. See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource:-message for more details.
androidfalseobject (json)Android specific options. See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidconfig for more details.
webPushfalseobject (json)WebPush specific options. See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushconfig for more details.
apnsfalseobject (json)APNs specific options. See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#apnsconfig for more details.
fcmOptionsfalseobject (json)FCM options. See https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#fcmoptions for more details.

*One of the targets (deviceTokens, topic or condition) is required.

Example of the input:

1{
2  "serviceAccountKey": "{\n  \"type\": \"service_account\",\n  \"project_id\": \"your-project-id\",\n  \"private_key_id\": \"someprivatekeyid1234567890abcdef\",\n  \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\n-----END PRIVATE KEY-----\\n\",\n  \"client_email\": \"firebase-adminsdk-abcde@your-project-id.iam.gserviceaccount.com\",\n  \"client_id\": \"123456789012345678901\",\n  \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n  \"token_uri\": \"https://oauth2.googleapis.com/token\",\n  \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n  \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-abcde%40your-project-id.iam.gserviceaccount.com\"\n}",
3  "deviceTokens": [
4    "eZc9N8F-3wIaFQq2_rU2K_v2A3QlUd9X9C-zQIBvE0pA1zCxPtF7A3H3Pl_m8TlPQAlnvlH2WmD4kKz3WodL8w"
5  ],
6  "notification": {
7    "title": "FCM Send",
8    "body": "Hello from FCM Send!"
9  }
10}

Output

The output of this actor is list of objects (for each message sent) containing the following fields:

FieldRequiredTypeDescription
messageIdfalsestringUnique FCM message id
successtruebooleantrue if message sent
errorfalsestringError message

Example of the output:

1[
2   {
3      "messageId": "/projects/your-project-id/messages/0:7f2a1b345cde678f9120abcd34567890",
4      "success": true
5   },
6   {
7      "success": false,
8      "error": "The registration token is not a valid FCM registration token"
9   }
10]

How to customize the notification

The notification can be fully customized, see https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource:-message for more details.

Pricing

Pricing model

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage.