I am using Push Notifications module to send notification to registered tokens.
I am able to send a plain text notification successfully via rules.
I am looking for a way to send the notification with extra fields so that it can be identified which type of notification is this and what action to take on this.
Below is the data example I need to send the notification in:
{
"aps":{
"alert": "Enter your message",
"badge":1,
"sound":"default",
"extraField 1":"some value",
"extraField2":"identifier"
}
}
Here is the rule export:
{
"rules_push_notification" : {
"LABEL" : "Push Notification",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "push_notifications" ],
"ON" : { "node_insert" : [] },
"IF" : [
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "music" : "music", "news" : "news" } }
}
}
],
"DO" : [
{ "push_notifications_send_message_bulk" : { "message" : "[node:title]", "target_group" : "authenticated" } }
]
}
}
Notes:
- My Rules Action maps (corresponds) to the data example like so: that "Enter your message" would be replaced by the value of "
[node:title]
". - About that "extra field 1" (and "extra field 2"): When I send a Push notification, On Tap it needs some action to be taken which is decided in those extra fields, for an example if I need to show a music article I will send "music" as identifier and second field will be the node id of the content help mobile to open that particular article.
{1234 (nid)} / {music (node type)} / The title (The title of the node)
which does not looks good actually.