1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 from firebase_admin import credentials, messaging
7 from django.conf import settings
9 cred = credentials.Certificate(settings.FCM_PRIVATE_KEY_PATH)
10 firebase_admin.initialize_app(cred)
12 TOPIC = 'wolnelektury'
15 def send_fcm_push(title, body, image_url=None):
16 # See documentation on defining a message payload.
19 data['imageUrl'] = image_url
20 message = messaging.Message(
21 notification=messaging.Notification(
28 message_id = messaging.send(message)