How to add action button to push notification like this:
I tried this and its not working:
=> https://firebase.googleblog.com/2018/05/web-notifications-api-support-now.html
here's my notification payload:
array
(
"title" => "FCM Message",
"body" => "This is an FCM Message",
"click_action" => "http://example.com/",
"icon" => "/logo.jpg",
"actions" => array(
0 => array(
'title' => 'Like',
'click_action' => 'http://example.com/?aaa=1',
'icon' => 'icons/heart.png',
),
1 => array(
'title' => 'Unsubscribe',
'click_action' => 'http://example.com/?aaa=2',
'icon' => 'icons/cross.png',
),
),
);
I tried with message payload also doesnt work:
$msg = array
(
"webpush" => array
(
"notification" => array
(
"title" => "Fish Photos ",
"body" => "Thanks for signing up for Fish Photos! You now will receive fun daily photos of fish!",
"icon" => "firebase-logo.png",
"image" => "guppies.jpg",
"data" => array
(
"notificationType" => "fishPhoto",
"photoId" => "123456",
),
"click_action" => "https://example.com/fish_photos",
"actions" => array(
0 => array(
'title' => 'Like',
'action' => 'like',
'icon' => 'icons/heart.png',
),
1 => array(
'title' => 'Unsubscribe',
'action' => 'unsubscribe',
'icon' => 'icons/cross.png',
),
),
),
),
);