diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-12-30 22:52:03 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-12-30 22:52:03 +0800 |
| commit | 4c779be572c9af1713e46976c73bfcd2174746f7 (patch) | |
| tree | f033e60c7ca9ccf3fdb819f412fc774a5e3bf803 /backend/notif_test.py | |
| parent | 9ebad91a84a907c8135b0c57645cb9ae8907a7de (diff) | |
notif test
Diffstat (limited to 'backend/notif_test.py')
| -rw-r--r-- | backend/notif_test.py | 23 |
1 files changed, 3 insertions, 20 deletions
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!"}) |
