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