-
Notifications
You must be signed in to change notification settings - Fork 218
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]: Custom data {custom_data} parameter is missing! #939
Comments
I am having the same issue for React Native. No custom_data property is visible. Did anyone find a fix? |
have you figured it out? i am able to solve it though. ` Map<String, dynamic>? additionalData=event.notification.additionalData;
|
in case you are wondering this is the payload }` |
What happened?
I am trying to navigate to specific page which needs ID, which i have to pass through the custom_data.
This is the rest-API Payload:
{
"app_id": "appId",
"headings": {"en": "Low Stock❗"},
"priority":"high",
"target_channel": "push",
"include_aliases":{
"external_id": [
"XXXXXXXXXXXXXX"
]
},
"big_picture": "https://media.onesignal.com/automated_push_templates/feature_announcement_template.png",
"android_channel_id": "58bf147a-35de-4914-92f1-1ab9898ff66d",
"template_id": "27429e2c-25b4-4629-81be-1a897a32e778", // works when content_available is false, you can swt template with image
"content_available": false,
"custom_data": {
"item_name": "Mango",
"small_icon":"https://media.onesignal.com/automated_push_templates/feature_announcement_template.png",
"itemId":"12"
}
}
Implementation on flutter side:
OneSignal.Debug.setLogLevel(OSLogLevel.verbose);
OneSignal.initialize("api_key");
OneSignal.Notifications.requestPermission(true);
OneSignal.Notifications.addClickListener((event) {
print(
'NOTIFICATION CLICK LISTENER CALLED WITH EVENT: ${event.notification.jsonRepresentation().replaceAll("\n", "\n")}');
});
Response:
custom data: {google.delivered_priority: normal, google.sent_time: 1724257118981, google.ttl: 259200, google.original_priority: normal, custom: {"i":"8c06af37-c521-4361-957d-fd560b1ada05","a":{""deepLink"":"{{ message.custom_data.small_icon }}"},"ti":"27429e2c-25b4-4629-81be-1a897a32e778","tn":"item low stock "}, google.product_id: 111881503, pri: 6, vis: 0, chnl: {"nm":"New Orders","id":"OS_58bf147a-35de-4914-92f1-1ab9898ff66d","dscr":"new order notifications","grp_id":"OS_cbda6537-bd6c-4f97-bf47-7cccf4c57070","grp_nm":"OrderPe"}, from: 29331827621, alert: Mango-(12) is low in stock, click to manage, bicon: https://media.onesignal.com/automated_push_templates/feature_announcement_template.png, licon: https://media.onesignal.com/automated_push_templates/feature_announcement_template.png, sicon: ic_stat_onesignal_default, title: Low Stock❗, google.message_id: 0:1724257118991720%1bdee165f9fd7ecd, google.c.sender.id: 29331827621, androidNotificationId: 1043054470}
I am not getting the custom_data parameter in the response, can anyone tell what i am doing wrong
Steps to reproduce?
What did you expect to happen?
the response supposed to have custom_data so i can handle it from flutter side.
OneSignal Flutter SDK version
5.2.3
Which platform(s) are affected?
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: