braze-inc / braze-swift-sdk

Braze SDK for the Apple ecosystem, including: iOS, macOS, iPadOS, visionOS, tvOS
https://www.braze.com
Other
49 stars 19 forks source link

[Feature]: Ability to read `SubscriptionState` for users Push/Email states. #137

Open cheif opened 3 weeks ago

cheif commented 3 weeks ago

What problem are you facing?

Me and @stefanalund are looking into building a "Marketing settings" page in our app following the guide, where we'd let the able opt-out of push and email marketing, all backed by the braze-sdk. We've found set(pushNotificationSubscriptionState:) and the corresponding API for email, but we can't figure out how to read the users current preferences.

Are we just missing where we could read user.pushNotificationSubscriptionState/user.emailSubscriptionState through the SDK, or is this something that can be added, it seems like this is needed to be able to build a fully functional "Marketing settings".

Workarounds

Not that we know of.

Ideal Solution

The SDK added support for reading the SubscriptionState for email/push.

Other Information

No response

jerielng commented 3 weeks ago

Hi @cheif, you are correct that there are no such getter properties/methods for the push and email subscription state. The set methods are designed to simply forward that information from the SDK on device to the Braze servers.

Could you work with our support team at support@braze.com to further explore potential options here? Thank you!

cheif commented 3 weeks ago

@jerielng Thank's, I've reached out to them now.

stefanalund commented 3 weeks ago

SDK integration You can update a user’s subscription state with the Braze SDK using the setPushNotificationSubscriptionType method on Web , Android , or iOS . For example, you can use this method to create a settings page in your app where users can manually enable or disable push notifications.

Your documentation ☝️ says that the SDK can be used to create a settings screen in our app. @jerielng I would argue that it's not possible to do that without a getter function. At least not with a reasonable UX. I'm curious why you think this is a support question and not something for this repo's maintainers to address? Thanks 🙏

jerielng commented 3 weeks ago

Hey @stefanalund! The idea of managing user state across devices is not solely owned by the SDK, so sending this through the formal support process will get it in front of all relevant teams that can make a decision on whether there are alternative solutions currently available that can be explored or if this should be classified a feature request.

tssagar98 commented 4 days ago

Can i use the rest api? to get the SubscriptionState ?

jerielng commented 4 days ago

Hey @tssagar98, that is one potential option that you're welcome to try (I believe you're referring to the strategy described here).The results can vary based on your needs and use case, which is why we recommend going through the support channels mentioned above to determine if this is the solution that works best for you.

tssagar98 commented 4 days ago

Thank you for you response @jerielng , I have tried to use the REST API Call but i am not getting updated value from it I have used /users/export/ids endpoint and in response i am always getting opted_in i am also updating he SubscriptionState using self.braze?.user.set(pushNotificationSubscriptionState: option)

Thanks !

jerielng commented 4 days ago

@tssagar98 Could you write in to support@braze.com with further details of your project along with your integration code (attaching this GitHub issue as a reference) so that our support team can assist you? Thanks!