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

[question]: How to retrieve the sent data from notification object? #903

Closed
1 task done
JEricaM opened this issue Aug 11, 2023 · 3 comments
Closed
1 task done

[question]: How to retrieve the sent data from notification object? #903

JEricaM opened this issue Aug 11, 2023 · 3 comments

Comments

@JEricaM
Copy link

JEricaM commented Aug 11, 2023

How can we help?

Hi to everyone
I have integrated OneSignal into my Ionic app (Ionic + StencilJS + vanilla JavaScript) following this guide: https://documentation.onesignal.com/docs/ionic-sdk-setup.

In my app, upon clicking the notification, it is stored on the device by retrieving the relevant data from the notification object in my use case. However, I'm having trouble understanding how to retrieve the date.

This is the object retrieved upon opening the app.

{
    "action": {
        "type": 0
    },
    "notification": {
        "androidNotificationId": 1715699538,
        "groupedNotifications": [],
        "notificationId": "a7322c7e-80da-4406-8354-049c346417e8",
        "templateName": "",
        "templateId": "",
        "title": "title",
        "body": "body",
        "lockScreenVisibility": 1,
        "fromProjectNumber": "866050520933",
        "priority": 5,
        "additionalData": {
            ....
        },
        "rawPayload": "{\"google.delivered_priority\":\"normal\",\"google.sent_time\":1689242144132,\"google.ttl\":259200,\"google.original_priority\":\"normal\",\"custom\":\"{\\\"a\\\":{\\\"notification_url\\\":\\\"\\\\\\/news\\\\\\/2\\\"},\\\"i\\\":\\\"a7322c7e-80da-4406-8354-049c346417e8\\\"}\",\"pri\":\"5\",\"vis\":\"1\",\"from\":\"866050520933\",\"alert\":\"body.\",\"title\":\"title\",\"google.message_id\":\"0:1689242144148610%e0ad9d53f9fd7ecd\",\"google.c.sender.id\":\"866050520933\",\"androidNotificationId\":1715699538}"
    }
}

I assume that if you're on an Android app, you need to retrieve the date by converting the timestamp from google.sent_time. But what about iOS? Since I don't have a way to directly test the app on iOS yet, I wanted to understand what the structure would be in that case, so I know how to map the data.

It seems to me that the date cannot be retrieved from anywhere else, right? I haven't found any information in either the documentation or the OneSignal sending dashboard.

Thanks

Code of Conduct

  • I agree to follow this project's Code of Conduct
@JEricaM
Copy link
Author

JEricaM commented Sep 1, 2023

Still have the problem...

@emawby
Copy link
Contributor

emawby commented Nov 3, 2023

@JEricaM Hello I apologize for the late response are you wanting to get the data when a notification is received/clicked on as described here?

@jennantilla
Copy link
Contributor

Hello there! We have not had any further reports of this issue. Please update to our latest SDK version and if you are still having trouble please open a new issue. Here is our migration guide for details on upgrading. Thanks!

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

3 participants