diff --git a/aitrainer_backoffice/controlling/automation/fcm.py b/aitrainer_backoffice/controlling/automation/fcm.py index 0630d5e..f6f72d1 100644 --- a/aitrainer_backoffice/controlling/automation/fcm.py +++ b/aitrainer_backoffice/controlling/automation/fcm.py @@ -55,7 +55,7 @@ class FCM: #notification_image_url = image_url #if image_url == None: notification_image_url = self.logo_url - registration_token = 'cOqNt8rzo074gbIkBSpCgW:APA91bEBuNi3iVzGKb4JhxqN2j80MoJbNptLHk2qsdeKBQz5grpHtrPPXvDqn5BJVVSaj1nwGPwgN7pi6FIApog_TTP3g1yobgmgpPN6udrYgzILlVPMvdGGFDSDh6gKlczhlTL9NEp0' + #registration_token = 'cOqNt8rzo074gbIkBSpCgW:APA91bEBuNi3iVzGKb4JhxqN2j80MoJbNptLHk2qsdeKBQz5grpHtrPPXvDqn5BJVVSaj1nwGPwgN7pi6FIApog_TTP3g1yobgmgpPN6udrYgzILlVPMvdGGFDSDh6gKlczhlTL9NEp0' print(f'image: {notification_image_url}' ) @@ -95,3 +95,5 @@ class FCM: return rc + def get_message(): + pass diff --git a/aitrainer_backoffice/controlling/automation/notification.py b/aitrainer_backoffice/controlling/automation/notification.py index a6759f6..d9f5cfd 100644 --- a/aitrainer_backoffice/controlling/automation/notification.py +++ b/aitrainer_backoffice/controlling/automation/notification.py @@ -22,17 +22,18 @@ class Notification: if hook_sql == None: customers = getattr(hook, hook_function)() else: + print(f'execute {hook_function} with sql {hook_sql}') customers = getattr(hook, hook_function)(hook_sql) for customer in customers: - if customer.firebase_reg_token != None: + if customer.firebase_reg_token != None and customer.customer_id != None: print(f'-- Notify Customer {customer.customer_id}') rc= self.fcm.send_to_token(notification.message_title, notification.message_body, notification.image_url, customer.firebase_reg_token) self.insert_history(notification=notification, customer=customer, rc=rc) except Exception as ex: - print(f'Notification Hook {notification.schedule_hook} has no callback function: {ex}') + print(f'Error in execution of the notification {notification.internal_name}: {ex}') def insert_history(self, notification, customer, rc): history = NotificationHistory()