OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 374 forks source link

[Bug]: Tags not appearing in OneSignal dashboard after being added. #1754

Open hamzaali98 opened 1 week ago

hamzaali98 commented 1 week ago

What happened?

After adding tags to a user via OneSignal.User.addTags(), I can fetch the tags successfully using OneSignal.User.getTags() and see them logged in my application. However, these tags do not appear on the OneSignal dashboard.

Additional Information: I have confirmed that the tags are being added successfully, and there are no visible network errors in the logs. This issue occurs even after refreshing the dashboard multiple times.

Steps to reproduce?

1. Use `OneSignal.User.addTags()` to add tags to the user.
2. Use `OneSignal.User.getTags()` to confirm that the tags are added and fetched correctly.
3. Check the OneSignal dashboard, and the tags do not appear there.

Code

useEffect(() => {
  if (patientProfile) {
    OneSignal.User.getTags()
      .then(tags => {
        console.log('Current tags for the user:', tags);
      })
      .catch(error => {
        console.error('Error fetching tags:', error);
      });

    OneSignal.User.pushSubscription.getIdAsync().then(id => {
      console.log('Push subscription ID:', id);
    });

    OneSignal.User.pushSubscription.getTokenAsync().then(token => {
      console.log('Push subscription token:', token);
    });

    console.log('Adding tags to OneSignal User');

    OneSignal.User.addTags({
      role: 'patient',
      email: String(patientProfile.user.email || ''),
      phone: String(patientProfile.user.phoneNumber || ''),
      donor: String(patientProfile.bloodDonor ? 'yes' : 'no'),
    });
  }
}, [patientProfile]);

What did you expect to happen?

The tags should appear on the OneSignal dashboard after being added.

React Native OneSignal SDK version

5.2.2

Which platform(s) are affected?

Relevant log output

- Current tags for the user: `{"donor": "yes", "email": "speetar.patient2@gmail.com", "phone": "+218123123123", "role": "patient"}`
- Push subscription ID: `ed124ccb-a2b0-4b9c-a4ba-a8c81ed89796`
- Push subscription token: `94f7ca889631e9fc124477e4f2929cdcf0d74dcbeff8aa41711d8270d6c69189`

Code of Conduct

hamzaali98 commented 1 week ago

As can be seen in the following screenshot the user is being registered but the user tags are not there.

Screenshot 2024-10-16 at 21 26 02

Screenshot 2024-10-16 at 21 27 07