1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
5 from firebase_admin import credentials, messaging
6 from django.conf import settings
10 if hasattr(settings, 'FCM_PRIVATE_KEY_PATH'):
11 cred = credentials.Certificate(settings.FCM_PRIVATE_KEY_PATH)
12 firebase_admin.initialize_app(cred)
14 TOPIC = 'wolnelektury'
17 def send_fcm_push(title, body, image_url=None):
20 # See documentation on defining a message payload.
27 data['imageUrl'] = image_url
28 message = messaging.Message(
29 notification=messaging.Notification(
36 message_id = messaging.send(message)