Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not showing in OneSignal Dashboard #25

Closed
1 task done
ZeelChauhanHtree opened this issue Oct 20, 2023 · 1 comment
Closed
1 task done

Not showing in OneSignal Dashboard #25

ZeelChauhanHtree opened this issue Oct 20, 2023 · 1 comment

Comments

@ZeelChauhanHtree
Copy link

How can we help?

def send_notification(title, content, send_after):
    # try:
    #     one_signal_client = set_client()
    #     response = one_signal_client.create_(notification_body)
    #     return response
    # except Exception as e:
    #     print("Failed Notification")
    #     return e
    configuration = set_client()
    with onesignal.ApiClient(configuration) as api_client:
        # Create an instance of the API class
        api_instance = default_api.DefaultApi(api_client)
        notification = Notification(
            app_id=ONE_SIGNAL_APP_ID,
            channel_for_external_user_ids='push',
            headings={"en": title},
            contents={"en": content},
            send_after=send_after,
            included_segments=["All"],
            is_chrome_web=True,
        )

        # example passing only required values which don't have defaults set
        try:
            # Create notification
            response = api_instance.create_notification(
                notification, _check_return_type=True)

            # ********************************** different way
            # import requests

            # url = "https://onesignal.com/api/v1/notifications"

            # payload = {
            #     "app_id": ONE_SIGNAL_APP_ID,
            #     "included_segments": ["Subscribed Users"],
            #     "contents": {
            #         "en": "English or Any Language Message",
            #         "es": "Spanish Message"
            #     },
            #     "name": "INTERNAL_CAMPAIGN_NAME"
            # }
            # headers = {
            #     "accept": "application/json",
            #     "Authorization": "Basic "+ONE_SIGNAL_USER_AUTH_KEY,
            #     "Content-Type": "application/json",
            # }

            # response = requests.post(url, json=payload, headers=headers)

            # print(response.text)

            # **********************************
            return response
        except onesignal.ApiException as e:
            print("Exception when calling DefaultApi->create_notification: %s\n" % e)

When hitting the create_notification not showing in OneSignal Dashboard

Code of Conduct

  • I agree to follow this project's Code of Conduct
@ZeelChauhanHtree ZeelChauhanHtree changed the title [question]: When hitting the create_notification not showing in OneSignal Dashboard Oct 20, 2023
@ZeelChauhanHtree ZeelChauhanHtree changed the title When hitting the create_notification not showing in OneSignal Dashboard Not showing in OneSignal Dashboard Oct 20, 2023
@nan-li
Copy link

nan-li commented Nov 1, 2024

Hello! Apologies that this question has gone stale.
If this question is still a current concern, please ping me

@nan-li nan-li closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants