title: How do I give my Firebase Cloud Messaging notification a tag property?
body: <p>I am trying to give my Firebase Cloud Messaging notification a tag property on Android as described <a href="https://stackoverflow.com/questions/43220703/fcm-gcm-grouping-notifications-by-tag-on-ios">here</a> and <a href="https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support" rel="nofollow noreferrer">here</a> so I can replace notifications that have been received if necessary.</p>
  
  <p>I am using React Native, <a href="https://invertase.io/oss/react-native-firebase/" rel="nofollow noreferrer">React Native Firebase</a> and the ConnectyCube API. ConnectyCube works with Firebase to handle user management and <a href="https://developers.connectycube.com/js/push-notifications?id=send-push-notifications" rel="nofollow noreferrer">push notifications</a> - I have all of this working. </p>
  
  <p>What I can't figure out is how to format my payload object to include optional properties such as <code>tag</code> as the documentation is fairly cryptic. I am successfully sending a <code>message</code> which is included in the <code>message</code> property, and in the ConnectyCube docs you will see that the iOS optional property of <code>badge</code> is just another property in the <code>payload</code> object, but in the case of <code>tag</code> for android, the below code is not working:</p>
  
  <pre class="lang-js prettyprint-override"><code>export const sendNotification = async (calleeId, callLength, tagUUID) =&gt; {
  
    const callersUserName = await getUserNameFromStorage();
  
    const payload = JSON.stringify({
      message: callersUserName + '-' + callLength,
      tag: tagUUID,
    });
  
    const pushParameters = {
      notification_type: 'push',
      user: { ids: [calleeId] }, // recipients.
      environment: 'production', // environment, can be 'production'.
      message: ConnectyCube.pushnotifications.base64Encode(payload)
    };
  
    ConnectyCube.pushnotifications.events.create(pushParameters, function (error, result) {
    });
  
    setTimeout(() =&gt; {
      const payload2 = JSON.stringify({
        message: 'replacement-notification',
        tag: tagUUID,
      });
  
      const pushParameters2 = {
        notification_type: 'push',
        user: { ids: [calleeId] }, // recipients.
        environment: 'production', // environment, can be 'production'.
        message: ConnectyCube.pushnotifications.base64Encode(payload2)
      };
  
      ConnectyCube.pushnotifications.events.create(pushParameters2, function (error, result) {
      });
    }, 3000)
  }
  </code></pre>
  
  <p>When push notifications have the same tag, each notification will be replaced with the newer one which I am trying to mimic with <code>setTimeout</code>.</p>
  
  <p>I am receiving both messages but the first is not being replaced with the second!</p>
  
  <p>Any help is much appreciated! :)</p>