1. Examples
  2. /
  3. Chat Admin Privileges
3 min readPublished Nov 21, 2022

Chat Admin Privileges

Copy link to clipboard

Add admin privileges to your chat app

Click below to play with Ably's chat admin privileges implementation and to browse through the code that powers it. You can test the demo in realtime, on multiple browser windows/devices, or with a friend.

Try it now    View on GitHub

Copy link to clipboard

Chat admin privileges

This is an easy way to give your app users different roles and capabilities. This can be a useful functionality when you’re managing live experiences with multiple participants. For example, in a chat room where one user needs admin or moderator privileges to delete spam or inappropriate content. 

Copy link to clipboard

Switch between roles

You have the ability to give users different roles in different parts of your application, and you can switch those roles at any time. In the chat example, you would give one user admin role in a specific chat room, while they stay a simple participant in all other chat rooms. The user can only delete other user’s comments in the room where he has admin privileges. 

Copy link to clipboard

Where can I use this functionality?


Other Possible Features?

Ably gives you the flexibility to create a wide range of app features using the same basic building blocks. For example, beyond  the message deletion use case we showed above, you could use the same logic for:

  • Customizing which users have access to different message interaction types, such as who can reply to a post

  • Including trusted information about the identity of a user in messages they send

Copy link to clipboard

Building chat admin privileges into your app

Ably has simple yet powerful APIs to help you effortlessly build and implement admin privileges in your realtime application.

Copy link to clipboard

Ably Channels

Channel is the unit of distribution of messages. Messages can be anything and a channel can represent a chat room, direct messaging, a virtual event etc. Users or their devices can connect to a specific channel. The Avatar Stack is not related to messages in a channel, but the digital place where an Avatar Stack can be used is the channel itself.

Copy link to clipboard

Ably JWT user claims

Ably’s support for JWTs allows a token-based authentication scheme that defines channel capabilities, as well as ‘admin privileges’ — or any other trusted information about a client that can be used to describe a user’s roles. Clients receive information about other clients on each message.

Copy link to clipboard

Getting started: Chat Admin Privileges

You'll need to do the following to get started.

  • Implement chat functionality using Ably message interactions and JWTs

  • Include custom user claims in your JWTs to represent the roles your application needs

  • Add logic into the user interface to process message interactions according to role information 

Join the Ably newsletter today

1000s of industry pioneers trust Ably for monthly insights on the realtime data economy.
Enter your email