Skip to content

Instantly share code, notes, and snippets.

@threetwotwo
Created April 3, 2020 06:47
Show Gist options
  • Select an option

  • Save threetwotwo/a60aeaae01022c1e880f9906e1957ff4 to your computer and use it in GitHub Desktop.

Select an option

Save threetwotwo/a60aeaae01022c1e880f9906e1957ff4 to your computer and use it in GitHub Desktop.
Send FCM function
async function sendFCM(uid: string, payload: admin.messaging.DataMessagePayload) {
const message: admin.messaging.MessagingPayload = {
notification: {
title: payload.title,
body: payload.body,
clickAction: 'FLUTTER_NOTIFICATION_CLICK',
},
data: payload,
}
console.log(message, uid);
return admin.messaging().sendToTopic(uid, message);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment