Bots can create and manage roles in Towns spaces. Roles control what users can do - from reading messages to banning members. You can also create token-gated roles that require users to hold specific NFTs or tokens.
Role management requires your bot to have admin permissions in the space. All role operations are onchain transactions that require gas.
Creating Roles
CreateRoleParams
Token-Gated Roles
Create roles that require users to hold specific tokens using the Rules API:
You can apply the role to a channel by calling bot.addRoleToChannel(channelId, roleId). This will gate the channel to only users who hold the required tokens.
Available Rule Types
Combining Rules
Managing Roles
Available Permissions
See Roles & Entitlements for the full list of available permissions.