title: Can't add badge parameter to FCM notification json Node.js
body: <p>I'm trying to use Node.js to send FCM's to my iOS app. Everything is working fine until I specify a <code>badge</code> parameter. Then I get this error:</p>
  <pre><code>errorInfo: {
      code: 'messaging/invalid-argument',
      message: `Invalid JSON payload received. Unknown name &quot;badge&quot; at 'message.notification': Cannot find field.`
  },
    codePrefix: 'messaging'
  </code></pre>
  <p>Sample Code:</p>
  <pre><code>const admin = require(&quot;firebase-admin&quot;);
  
  const serviceAccount = require(&quot;file/path/to/service/account/json&quot;);
  
  admin.initializeApp({
      credential: admin.credential.cert(serviceAccount)
  });
  
  const registrationToken = 'notProvidingActualRegistrationTokenForSecurityReasons';
  
  
  const message = {
      notification: {
          title: 'Hello',
          body: 'Welcome from the Cyber-webs',
          badge: &quot;9&quot;,
      },
      token: registrationToken
  };
  
  
  admin.messaging().send(message)
      .then((response) =&gt; {
          console.log(&quot;Success&quot;)
          console.log(response)
      })
      .catch((error) =&gt; {
          console.log(&quot;Error Sending Message&quot;, error)
      })
  </code></pre>
  <p>The <a href="https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.notificationmessagepayload" rel="nofollow noreferrer">docs</a> say that the badge value should be a <code>string</code>, by the way. I don't understand why it's not an <code>int</code>. Also, why do we need to provide a badge value in the first place? It seems like this should be handled by the OS...</p>