FCM Notification Configuration
Send customizable push notifications to Android and iOS devices using the FCM Notification Microservice. All platform-specific handling (FCM HTTP v1, APNs configuration) is managed automatically.
API Overview
The microservice accepts a SendPayload object with the following structure:
Root-Level Fields
Field | Type | Required | Description | Default |
|---|---|---|---|---|
| string | ✅ | Notification title | - |
| string | ✅ | Notification body text | - |
| string | ❌ | Single device token | - |
| string[] | ❌ | Multiple device tokens | - |
| string | ❌ | Topic name |
|
|
| ❌ | FCM delivery priority |
|
| object | ❌ | Custom notification fields |
|
Note: You must provide one of: token, tokens, or topic.
Data Fields (Customization)
All customization fields go inside the data object. The microservice automatically handles platform-specific formatting.
Cross-Platform Fields
Field | Type | Description | Android | iOS | Example |
|---|---|---|---|---|---|
| string | Image URL (HTTPS, .jpg/.png) | ✅ | ✅ |
|
| string | App icon badge count | ✅ | ✅ |
|
| string |
| ✅ | ✅ |
|
| string | Silent notification | ✅ | ✅ |
|
| string | System category | ✅ | ✅ |
|
| string | Deep link URL on tap | ✅ | ✅ |
|
Android-Only Fields
Field | Type | Description | Example |
|---|---|---|---|
| string | Accent color (hex) |
|
| string | Large icon URL |
|
| string | Notification channel (Android 8+) |
|
| string | Vibration pattern (ms, comma-separated) |
|
| string | LED color (hex) |
|
| string | Accessibility text |
|
| string | Replacement tag |
|
| string | Numeric ID |
|
| string | Ongoing notification |
|
| string | Auto-dismiss on tap |
|
| string | Alert once only |
|
| string | Expanded text |
|
| string | Summary below content |
|
| string | Subtitle text |
|
| string | Group key |
|
| string | Is group summary |
|
| string |
|
|
| string |
|
|
| string | Timestamp (epoch ms) |
|
| string | Show timestamp |
|
| string | Count-up timer |
|
| string | Count-down timer |
|
| string | Progress value |
|
| string | Max progress |
|
| string | Indeterminate progress |
|
Custom Sound Rule
Use one shared sound filename in data.sound when you want one payload for Android and iOS.
Android: put file in
android/app/src/main/res/raw/iOS: bundle same filename in app target resources
Payload: use filename, for example
"order_updates.wav"
Android strips extension for raw lookup, so order_updates.wav maps to raw resource order_updates.
iOS-Only Fields
Field | Type | Description | iOS Version | Example |
|---|---|---|---|---|
| string | Secondary title line | 10+ |
|
| string | Notification threading/grouping | 10+ |
|
| string |
| 15+ |
|
| string | Ranking score (0.0-1.0) | 15+ |
|
| string | Critical alert volume (0.0-1.0) | 12+ |
|
| string | Notification replacement ID | 15+ |
|
| string | Focus mode filtering | 16+ |
|
Usage Examples
1. Basic Notification with Image
2. iOS Time-Sensitive Notification
3. Android Progress Notification
4. Silent Notification
5. Grouped Notifications (Android)
6. Critical Alert (iOS)
Requires Apple Critical Alerts entitlement
7. Multiple Devices (Batch Send)
8. Topic Broadcast
Priority Behavior
Priority | Android | iOS | Use Case |
|---|---|---|---|
| Immediate, wakes device | APNs priority 10 | Time-sensitive, user-visible |
| Batched, respects Doze | APNs priority 5 | Background sync, non-urgent |
Data Type Guidelines
Boolean Values
Send as strings: "true"/"false" or "1"/"0"
Numeric Values
Send as strings: "5", "0.9", "1707350400000"
URLs
Must be valid HTTPS URLs with proper file extensions for images (.jpg, .png, .gif)
Platform-Specific Notes
Android
Images downloaded asynchronously in
FirebaseMessagingServiceChannels control importance/sound (Android 8+)
DND can still suppress unless channel whitelisted
iOS
Images require Notification Service Extension with
mutable-content: 1(handled automatically)timeSensitivebypasses most Focus modescriticalrequires Apple entitlement (special approval)
Best Practices
Use
priority: "high"only for user-visible, time-sensitive notificationsAlways include
urlfor deep linking on tapTest on real devices - behavior varies by OS version
Keep images small (< 300 KB recommended)
Group related notifications with
group(Android) orthread_id(iOS)Provide
big_texton Android for expandable details
Response
The microservice returns:
Single token: FCM message ID (string)
Multiple tokens: Array of message IDs
Topic: Message ID for topic broadcast
Error Handling
Common errors:
Missing
titleorsubtitleNo targeting field (
token,tokens, ortopic)Invalid token format
Invalid Firebase project ID
Network/Firebase connectivity issues
Handle errors appropriately in your application.