From 2f946c233ee67e149b79c2878efeddbbb0dc1846 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Wed, 3 Dec 2025 15:08:58 +0700 Subject: notif --- backend/notif_test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 backend/notif_test.py (limited to 'backend/notif_test.py') diff --git a/backend/notif_test.py b/backend/notif_test.py new file mode 100644 index 0000000..e0d82c0 --- /dev/null +++ b/backend/notif_test.py @@ -0,0 +1,21 @@ +from dotenv import load_dotenv +from os import getenv +import onesignal +from onesignal.api import default_api +from onesignal.model.notification import Notification + +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', '6a2b4b58-a1d2-403b-afa0-b4a987ca6139'], contents={'en': 'hello world'}, headings={'en': 'Laundry Finished!'}, priority=10) +print(api_instance.create_notification(notification)) -- cgit v1.2.3