title: How to specify sound and click_action in firebase cloud function
body: <p>I tried with the following function (node.js v8):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>exports.sendComNotification = functions.firestore
    .document('Comunicados/{comID}')
    .onUpdate((snap, context) =&gt; {
      console.log('Com triggered');
      const newValue = snap.after.data();
      const msg = newValue.title;
      var message = {
        notification: {
          title: 'Comunicado da Diretoria!',
          body: msg,
          badge: '1',
          sound: 'default',
          click_action: 'FLUTTER_NOTIFICATION_CLICK',
        },
        topic: "Comunicados"
      };
      return admin.messaging().send(message)
        .then((response) =&gt; {
          console.log('Successfully sent message:', response);
          return
        })
        .catch((error) =&gt; {
          console.log('Error sending message:', error);
          return
        });
  
    });</code></pre>
  </div>
  </div>
  </p>
  
  <p>But that gives the following error in the fucntions log:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Error sending message: {
      Error: Invalid JSON payload received.Unknown name "badge"
      at 'message.notification': Cannot find field.
      Invalid JSON payload received.Unknown name "sound"
      at 'message.notification': Cannot find field.
      Invalid JSON payload received.Unknown name "click_action"
      at 'message.notification': Cannot find field.
      at FirebaseMessagingError.FirebaseError[as constructor](/srv/node_modules / firebase - admin / lib / utils / error.js: 42: 28)</code></pre>
  </div>
  </div>
  </p>
  
  <p>If I take out "badge", "sound" and "click_action", it works, but then there's no sound upon receival and the actions defined in onResume (flutter app) don't fire either, of course. What would be the correct way of setting the sound and click_action props? Thanks in advance.</p>