FCM Channel Provider
Configuration
The configuration steps are explained in the fcm configuration page.
FCM Token
Parameter | Type | Description |
---|---|---|
device_token | string * | |
installation_id | string |
Example
{
"device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
"installation_id": "development"
}
Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"device_token": {
"minLength": 64,
"type": "string"
},
"installation_id": {
"enum": [
"development",
"production"
],
"type": "string"
}
},
"required": [
"device_token"
],
"type": "object"
}
Usage
1. When configured with
{
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"client_email": "firebase-adminsdk-qwhtp@platform-development.iam.gserviceaccount.com",
"client_id": "117893100789081023083",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-qwhtp%40magicbell-development.iam.gserviceaccount.com",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7/GBHM4AK4/8c\nZyvJfdzjBzfA48tV9T3N4hBCb4E66jIz+oztH9oSngEfIVO/L1dWjK1OlN0cqJ0f\nQaKq1eycSjmwfTR3HGNjQQyoGQ4BFBdyqT5rRDDZLPI2LoR0dtQXcBtiFpJF2t8e\niDmpl3d/ipuKMtBRzjYPqzP0qv3YkPmw2v5FqKK9EIaHRtOhd2R28F5FE+kF1dvB\nt7fEeVtKcQJcSwDUQ8HEshlWSx6azGd4jxf9jHRXWumXYfTA6NMA7EUTDJVus3vU\ny9MCv2KwZO/dzlQygY0BM9FHPSzZRIiHUx+DH6gYl2uWJatluHz58lj3r5mo/Ssc\nyP3TrqOnAgMBAAECggEAWAnDe0UCt9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GbnaOG8Ue3++bLP\nN6XlAyt5UajAd1CycIHgDvbW0CkWoI70Bg7QNqMYJe6DareH4vRpdB3tw6zNP7qN\n0Bd04L8+zUYN+VqNJ70d7Xn+k2rY7STlgU3vwOzHFwu4wK2A7e+aAZ8AjC+Sr0ZM\nps+wuWO8MN5yQTBZvAEIfQs=\n-----END PRIVATE KEY-----\n",
"private_key_id": "1935e74178f6ef0bbc23fb3538255f8281093bf2",
"project_id": "platform-development",
"token_uri": "https://oauth2.googleapis.com/token",
"type": "service_account",
"universe_domain": "googleapis.com"
}
2. With a channel token
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"auth_provider_x509_cert_url": {
"type": "string"
},
"auth_uri": {
"type": "string"
},
"client_email": {
"type": "string"
},
"client_id": {
"type": "string"
},
"client_x509_cert_url": {
"type": "string"
},
"private_key": {
"pattern": "^-+?\\s?BEGIN[A-Z ]+-+\\n([A-Za-z0-9+/\\r\\n]+={0,2})\\n-+\\s?END[A-Z ]+-+\\n?$",
"type": "string",
"x-ui": {
"tagName": "textarea"
}
},
"private_key_id": {
"type": "string"
},
"project_id": {
"type": "string"
},
"token_uri": {
"type": "string"
},
"type": {
"enum": [
"service_account"
],
"type": "string"
},
"universe_domain": {
"type": "string"
}
},
"required": [
"type",
"project_id",
"private_key_id",
"private_key",
"client_email",
"client_id",
"auth_uri",
"token_uri",
"auth_provider_x509_cert_url",
"client_x509_cert_url",
"universe_domain"
],
"type": "object"
}
3. With Broadcast
{
"action_url": "https://example.com",
"category": "example",
"content": "I come from broadcast",
"custom_attributes": {},
"id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
"overrides": {},
"recipients": [
{
"custom_attributes": {
"plan": "enterprise",
"preferred_pronoun": "They",
"pricing_version": "v10"
},
"email": "test@example.com",
"external_id": "83d987a-83fd034",
"first_name": "Person",
"last_name": "Doe",
"phone_numbers": [
"+1 5005550001"
]
}
],
"title": "Hello, World!",
"topic": "example"
}
The channel handler triggers a HTTP request
With payload
{
"android": {
"priority": "low"
},
"data": {
"document-id": "doc-id-1",
"nested": "{\"key\":\"value\"}",
"notification_id": "a290290a-cb64-49e9-949a-e1a64d0ea30c",
"user_id": "6f996951-815d-4d3d-a5b6-837810cc4615"
},
"notification": {
"title": "notification title 1"
}
}
Overrides
The provider overrides key in the broadcast payload can be used to change the default behavior of the channel handler.
overrides >> providers >> fcm
Override `android.ttl` key
Overrides
{
"providers": {
"fcm": {
"android": {
"ttl": "123456"
}
}
}
}
Payload
{
"android": {
"priority": "high",
"ttl": "123456s"
},
"data": {
"action_url": "http://example.com/notifications/34469351-1b79-4f27-8db8-d8a65971cb77",
"notification_id": "34469351-1b79-4f27-8db8-d8a65971cb77",
"user_id": "2b95a48d-93fa-4c56-b395-de64c3b4871f"
},
"notification": {
"title": "notification title 1"
}
}