How to block and unblock users, product behavior, and multi-platform code examples.
Empower users to control their social experience by blocking or unblocking other users. Blocking is essential for user safety, privacy, and content control.
User Safety
Protect users from harassment and unwanted interactions
Content Control
Give users control over their social environment
Spam Prevention
Filter out spam and inappropriate content effectively
Only users can be blocked. Console Admins and communities cannot be blocked. Community moderators or custom roles can be blocked regardless of their roles.
// Block a user by userId do { try await userRelationship.blockUser(userId: "user-id") print("User blocked successfully")} catch let error { print("Unable to block user \(error)")}
// Unblock a user by userIddo { try await userRelationship.unblockUser(userId: "user-id") print("User unblocked successfully")} catch let error { print("Unable to unblock user \(error)")}