How do I send a notification to iOS with FCM?

Viewed 2247

I am trying to use a firebase cloud function to send notifications to devices. My current code is working android devices only. My understanding is that your payload must be special for the iOS device but I am trying to use the sendToDevice function which seems to only be able to take a payload of the notification type. Please help with my payload and how to send the notification to the desired token. My payload and send are as below.

const payload = admin.messaging.MessagingPayload = {
            notification:{
                title:"You have received a new message!",
                body: fromname + " has messaged you!",
                clickAction: 'FLUTTER_NOTIFICATION_CLICK'
            }
        };

        return admin.messaging().sendToDevice(token,payload);
1 Answers
Related