From 4c779be572c9af1713e46976c73bfcd2174746f7 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Tue, 30 Dec 2025 22:52:03 +0800 Subject: notif test --- backend/notif_test.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'backend/notif_test.py') diff --git a/backend/notif_test.py b/backend/notif_test.py index cf5391f..feabb7a 100644 --- a/backend/notif_test.py +++ b/backend/notif_test.py @@ -1,21 +1,4 @@ -from dotenv import load_dotenv -from os import getenv -import onesignal -from onesignal.api import default_api -from onesignal.model.notification import Notification +import notif -load_dotenv() - -onesignal_configuration = onesignal.Configuration( - rest_api_key=getenv("REST_API_KEY"), - organization_api_key=getenv("ORGANIZATION_API_KEY"), -) - -api_client = onesignal.ApiClient(onesignal_configuration) -api_instance = default_api.DefaultApi(api_client) - -ONESIGNAL_APP_ID = "83901cc7-d964-475a-90ec-9f854df4ba52" - -# yes that's my subscription id. probably outdated by now -notification = Notification(app_id=ONESIGNAL_APP_ID, include_subscription_ids=['86f24e73-8887-4e29-b607-31e1a8f25b93'], contents={'en': 'hello world'}, headings={'en': 'Laundry Finished!'}, priority=10) -print(api_instance.create_notification(notification)) +endpoint_to_test = "https://fcm.googleapis.com/fcm/send/c14_JXV1C_4:APA91bHzdw7uXAJdjb0mZMwFS_j3Y1NEpbXUS9n4TEwak3zLcDFZjjKpJHkPdZC-2FCWL7aeIUYL9w18ZppDX3mec-lA48b-bPnOJr5GSh6AYaq4zFtu_nM3u4aVoN_ga1pFwtCEqTm8" +notif.send_notification(endpoint_to_test, {"title": "This is a test", "body": "Hello, world!"}) -- cgit v1.2.3