Community settings control notifications for social features like posts, comments, reactions, and member activities within communities. These settings work alongside user and channel preferences.

Get Community Settings

Retrieve the user’s current notification preferences:

let notificationManager = communityRepository.notificationManager(forCommunityId: "<community-id>")

// Get community notification settings
notificationManager.getSettingsWithCompletion { notification, error in
    guard let notification = notification else {
        print("error: \(String(describing: error))")
        return
    }
    // Notification top-level setting
    print("community notification enabled: \(notification.isEnabled)")
    // Each module setting.
    for event in notification.events {
        print("- event '\(event.eventName)' enabled: \(event.isEnabled)")
    }
}

Update Community Settings

Modify notification preferences for a specific community:
let notificationManager = communityRepository.notificationManager(forCommunityId: "<community-id>")

// Update community settings with enable status for particular modules
// In case you would like to disable/enable notification for particular modules,
// passing `AmityCommunityNotificationEvent` instance that responsible for event settings.
notificationManager.enable(for: [
    AmityCommunityNotificationEvent(eventType: .postCreated, isEnabled: false, roleFilter: nil)
]) { success, error in
    if success {
        // handler success
    } else {
        // handler error
    }
}

// update community settings with disable status
notificationManager.disable() { success, error in
    // Handle the result
}

Settings Options

  • Posts - New posts in the community
  • Comments - Comments on posts
  • Reactions - Likes and reactions on content
  • Replies - Replies to posts or comments