Push Notifications
Ensure that your users don’t miss important content from each other.

Direct Push Notifications

With this solution, the notifications will be triggered and delivered to your users directly by Amity's servers. There's nothing that the iOS client has to do in order to display the notification to your users. Amity's servers will prepare for you a notification that can be directly displayed to the user as and when it's received.

Setup Push Notification Certificate.

In order for Amity's server to start sending push notification to the iOS client, you need to prepare the iOS PSN certificate and uploaded to Amity system via Amity Admin panel.
Please note that only a production iOS certificates can be used, even for testing purposes. At the moment, we do not support sandbox iOS certificates.
upload the PSN certificate via the admin panel UI.

Push Notification Triggers

A new push notification will be sent to a specific user when the following event happens IN a community user or a member.
  • A new post has been created in the community user is a member.
  • Post owner has been reacted by a user in the community
  • Post owner has new Comment created by a user in the community.
  • Comment or Reply owner has been reacted by a user in the community
  • Comment owner has a new Reply created by a user in the community.

Push Notification Examples

As Amity's servers are responsible for choosing the content of the push notification, you can expect your users to receive the following notifications for different kinds of events:
  • A new post has been created in the community user is a member.
Title : CommunityDisplayname
Body : userDisplayname created new post in your community.
  • Post owner has been reacted by a user in the community
Title : CommunityDisplayname
Body : userDisplayname reacted to your post
  • Post owner has new Comment created by a user in the community.
Title : CommunityDisplayname
Body : userDisplayname commented to your post
  • Comment or Reply owner has been reacted by a user in the community
Title : CommunityDisplayname
Body : userDisplayname react to your comment
  • Comment owner has a new Reply created by a user in the community.
Title : CommunityDisplayname
Body : userDisplayname replied to your comment

Push Notification context customization

as default, all the event related to the Community feature has default context base on each event trigger, to customize the context for each event, you can access to Admin panel to do so.

Client Registration

Before start using push notification, a device token need to be set through registerDeviceForPushNotification(:_)
Set up SDK notification in an iOS app
Request push notification authorization
Request push notification permission
Registering your app for push notification will require a registered AmityClient instance (necessary to know which user is associated with this device) and a push notification token.
Amity's Development Kit does not manage:
  • user-facing requests for push notifications and authorizations
  • the creation and refreshing of push notification tokens
It's up to your app to take those steps and pass the notification token to the SDK.
Register SDK push notification
We recommend that you observe the completion block outcome to ensure a successful registration.
If the device was previously registered with this or another user, the previous registration is invalidated as soon as this new request is received, which means that the device will always receive notifications of up to one user.

Client Push Notification Toggles

The SDK has three levels of notifications and in order for it to be sent, a notification has to pass throughout all three levels.
  • Network Level: (via Admin Panel) turning off notifications at this level effectively disable push notifications altogether for all of your customers.
  • User Level: (via client) A user can choose to enable/disable the notifications that it receives on the device (this is an absolute option: enable all or disable all). Please note that this setting is per user, not per device: regardless of which device sets this toggle, the new preference will take effect in all the devices where the user is logged in.
  • Community Level: (via client) A user can choose to enable/disable notifications for a specific community (where user is a member of). Again, this preference is per user, not per device.
If the Network level has been disabled, the event in the User level AND Community level will be disabled as well.

User Level Push Notification Toggle

In order to get and set the user level push notifications preference, we use the object AmityUserNotificationsManager, obtained from the current AmityClient:
Managing user push notification settings

Community Level Push Notification Toggle

For Community preferences, we use the AmityCommunityNotificationsManager , obtained via an instance of AmityCommunityRepository:
Managing community notification settings

Client Unregistration

Unlike the registration, unregistering for push does not require the AmityClient instance to be associated with any user, therefore you can unregister the device from receiving push notifications as soon as the AmityClient has been initial.
Unregister SDK push notification
Export as PDF
Copy link
Outline
Direct Push Notifications
Setup Push Notification Certificate.
Push Notification Triggers
Push Notification Examples
Push Notification context customization
Client Registration
Client Push Notification Toggles
User Level Push Notification Toggle
Community Level Push Notification Toggle
Client Unregistration