Open abhishekr77 opened 2 months ago
{ "alert": "Mango-(12)" is low in stock, click to manage"}, i have managed to get some values by using liquid Syntax. And i am passing through templates. .
But when i am trying the same in additional data like this :
i am getting response like this {""deepLink"":"{{ message.custom_data.small_icon }}"}. But i need to pass custom data in this field so i can handle at Notifications.addClickListener((event) .
I am having the same issue for React Native. No custom_data property is visible. Did anyone find a fix?
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