Stay organized with collections
Save and categorize content based on your preferences.
The FCM HTTP v1 API and the
Notifications composer
support sending image links in the payload of a display
notification, for image download to the device after delivery.
This functionality supports both images and videos for Apple apps
(see Apple documentation for file size limits).
To be able to receive and handle notification images in an Apple app, you must add
a Notification Service Extension.
The notification service extension allows your app to handle the image
delivered in the FCM payload before displaying the notification to the end user.
Set up the notification service extension
To add a service extension, perform the required setup tasks for
modifying and presenting notifications
in APNs, and then add the FCM extension helper API in NotificationService.m.
Specifically, instead of completing the callback with
self.contentHandler(self.bestAttemptContent);,
complete it with FIRMessaging extensionHelper as shown:
@interfaceNotificationService()<NSURLSessionDelegate>
@property(nonatomic)void(^contentHandler)(UNNotificationContent*contentToDeliver);@property(nonatomic)UNMutableNotificationContent*bestAttemptContent;@end@implementationNotificationService-(void)didReceiveNotificationRequest:(UNNotificationRequest*)requestwithContentHandler:(void(^)(UNNotificationContent*_Nonnull))contentHandler{self.contentHandler=contentHandler;self.bestAttemptContent=[request.contentmutableCopy];// Modify the notification content here as you wishself.bestAttemptContent.title=[NSStringstringWithFormat:@"%@ [modified]",self.bestAttemptContent.title];// Call FIRMessaging extension helper API.[[FIRMessagingextensionHelper]populateNotificationContent:self.bestAttemptContentwithContentHandler:contentHandler];}...
Build the send request
In your notification send request, set the following ApnsConfig
options:
fcm_options.image containing the image URL. Apple requires that the image
URL includes a valid file extension to correctly identify the resource type.
headers({ "mutable-content": 1})
The following example send request sends a common notification title to all platforms, but it also sends an image. Here's an approximation of the
visual effect on a user's device:
Node.js
consttopicName='industry-tech';constmessage={notification:{title:'Sparky says hello!'},android:{notification:{imageUrl:'https://foo.bar.pizza-monster.png'}},apns:{payload:{aps:{'mutable-content':1}},fcm_options:{image:'https://foo.bar.pizza-monster.png'}},webpush:{headers:{image:'https://foo.bar.pizza-monster.png'}},topic:topicName,};getMessaging().send(message).then((response)=>{// Response is a message ID string.console.log('Successfully sent message:',response);}).catch((error)=>{console.log('Error sending message:',error);});
See the
HTTP v1 reference documentation
for complete detail on the keys available in platform-specific blocks in the
message body.
With mutable-content set as shown, this send request enables the service
extension on the receiving client to handle the image delivered in the payload.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[],[],null,["The FCM HTTP v1 API and the\n[Notifications composer](//console.firebase.google.com/project/_/notification)\nsupport sending image links in the payload of a display\nnotification, for image download to the device after delivery.\nThis functionality supports both images and videos for Apple apps\n(see Apple documentation for file size limits).\n| Keep in mind:\n|\n| - Images uploaded via the Notifications composer are limited to 300KB in size.\n| - Images stored or served from Cloud Storage are subject to standard [quota limits](https://firebase.google.com/pricing)\n\nTo be able to receive and handle notification images in an Apple app, you must add\na [Notification Service Extension](https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension).\nThe notification service extension allows your app to handle the image\ndelivered in the FCM payload before displaying the notification to the end user.\n\nSet up the notification service extension\n\nTo add a service extension, perform the required setup tasks for\n[modifying and presenting notifications](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ModifyingNotifications.html)\nin APNs, and then add the FCM extension helper API in `NotificationService.m`.\nSpecifically, instead of completing the callback with\n`self.contentHandler(self.bestAttemptContent);`,\ncomplete it with `FIRMessaging extensionHelper` as shown: \n\n @interface NotificationService () \u003cNSURLSessionDelegate\u003e\n @property(nonatomic) void (^contentHandler)(UNNotificationContent *contentToDeliver);\n @property(nonatomic) UNMutableNotificationContent *bestAttemptContent;\n @end\n\n @implementation NotificationService\n\n - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {\n self.contentHandler = contentHandler;\n self.bestAttemptContent = [request.content mutableCopy];\n\n // Modify the notification content here as you wish\n self.bestAttemptContent.title = [NSString stringWithFormat:@\"%@ [modified]\",\n self.bestAttemptContent.title];\n\n // Call FIRMessaging extension helper API.\n [[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent\n withContentHandler:contentHandler];\n\n }\n ...\n\nBuild the send request\n\nIn your notification send request, set the following [ApnsConfig](/docs/reference/fcm/rest/v1/projects.messages#ApnsConfig)\noptions:\n\n- `fcm_options.image` containing the image URL. Apple requires that the image URL includes a valid file extension to correctly identify the resource type.\n- `headers({ \"mutable-content\": 1})`\n\nThe following example send request sends a common notification title to all platforms, but it also sends an image. Here's an approximation of the\nvisual effect on a user's device:\n\nNode.js \n\n const topicName = 'industry-tech';\n\n const message = {\n notification: {\n title: 'Sparky says hello!'\n },\n android: {\n notification: {\n imageUrl: 'https://foo.bar.pizza-monster.png'\n }\n },\n apns: {\n payload: {\n aps: {\n 'mutable-content': 1\n }\n },\n fcm_options: {\n image: 'https://foo.bar.pizza-monster.png'\n }\n },\n webpush: {\n headers: {\n image: 'https://foo.bar.pizza-monster.png'\n }\n },\n topic: topicName,\n };\n\n getMessaging().send(message)\n .then((response) =\u003e {\n // Response is a message ID string.\n console.log('Successfully sent message:', response);\n })\n .catch((error) =\u003e {\n console.log('Error sending message:', error);\n });\n\nREST \n\n POST https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send HTTP/1.1\n\n Content-Type: application/json\n Authorization: Bearer ya29.ElqKBGN2Ri_Uz...HnS_uNreA\n {\n \"message\":{\n \"topic\":\"industry-tech\",\n \"notification\":{\n \"title\":\"Sparky says hello!\",\n },\n \"android\":{\n \"notification\":{\n \"image\":\"https://foo.bar/pizza-monster.png\"\n }\n },\n \"apns\":{\n \"payload\":{\n \"aps\":{\n \"mutable-content\":1\n }\n },\n \"fcm_options\": {\n \"image\":\"https://foo.bar/pizza-monster.png\"\n }\n },\n \"webpush\":{\n \"headers\":{\n \"image\":\"https://foo.bar/pizza-monster.png\"\n }\n }\n }\n }\n\nSee the\n[HTTP v1 reference documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages)\nfor complete detail on the keys available in platform-specific blocks in the\nmessage body.\n\nWith `mutable-content` set as shown, this send request enables the service\nextension on the receiving client to handle the image delivered in the payload."]]