Last active
September 30, 2020 15:27
-
-
Save malibayram/f800c49cdc3179170cfdc77ff5b3af62 to your computer and use it in GitHub Desktop.
her yeni eklenen duyuru için "tumDuyurular" konusuna abone olmuş kişilere bildirim gönderme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { fcm } = require('../admin'); | |
| const functions = require('firebase-functions'); | |
| const duyuruBidirimiGonder = functions.firestore.document('duyurular/{baslik}').onCreate(async (veri) => { | |
| const baslik = veri.data().baslik; | |
| const mesaj = veri.data().mesaj; | |
| const tarih = veri.data().tarih; | |
| const yayinlayan = veri.data().yayinlayan; | |
| const bildirim = { | |
| notification: { | |
| title: baslik, | |
| body: mesaj, | |
| click_action: "SENV2_NOTIFICATION_CLICK", | |
| sound: "default", | |
| }, | |
| data: { | |
| "tip": "duyuru", | |
| "tarih": `${tarih}`, | |
| "yayinlayan": `${yayinlayan}`, | |
| "routeName": "/son_bildirimler", | |
| } | |
| } | |
| return await fcm.sendToTopic("tumDuyurular", bildirim); | |
| }); | |
| module.exports = duyuruBidirimiGonder; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment