Skip to main content

Blocklist

When you add a user to your blocklist, you stop receiving direct messages from that user. Key points:

  • Blocking is one-directional. If you block user A, user A cannot send you direct messages (receives error 405), but you can still send messages to user A.
  • Server API messages bypass the blocklist by default. Set verifyBlacklist to 1 in the Server API call to enforce the blocklist.
tip

All blocklist APIs are on NCEngine.userModule.

Add to blocklist

swift
NCEngine.userModule.addToBlocklist(userId: "userId") { error in
if error == nil {
// Blocked
}
}

Remove from blocklist

swift
NCEngine.userModule.removeFromBlocklist(userId: "userId") { error in
if error == nil {
// Removed
}
}

Check if a user is blocked

swift
NCEngine.userModule.checkBlocked(userId: "userId") { isBlocked, error in
if error == nil {
print("Is blocked: \(isBlocked)")
}
}

Get the blocklist

swift
NCEngine.userModule.getBlocklist { userIds, error in
if error == nil {
// userIds contains blocked user IDs
}
}