Discord icon

Discord

Interact with Discord API - Full Bot Features

Overview

This node operation creates a new role in a specified Discord server (guild). It allows users to define the role's name and customize additional properties such as color, permissions, whether the role is hoisted (displayed separately), mentionable, and the reason for the action (which appears in the audit log). This operation is useful for managing server roles programmatically, for example, automating role creation for new teams or projects within a Discord community.

Use Case Examples

  1. Automatically create a new role named 'Project Manager' with a specific color and permissions when a new project is initiated.
  2. Create a role for event participants with mentionable and hoisted settings enabled to highlight their status in the server.

Properties

Name Meaning
Guild ID The ID of the Discord server (guild) where the role will be created.
Role Name The name of the role to be created.
Color The color of the role in hex format (e.g., #000000 for black).
Additional Fields Optional additional settings for the role, including embed JSON, text-to-speech flag, reason for audit log, permissions bit string, hoist (display separately), mentionable status, and other related properties.

Output

JSON

  • id - The unique identifier of the created role.
  • name - The name of the created role.
  • color - The color of the created role.
  • position - The position of the role in the role hierarchy.

Dependencies

  • Discord API
  • An API key credential for Discord bot authentication

Troubleshooting

  • Ensure the provided Guild ID is correct and the bot has permission to manage roles in that guild.
  • Verify that the role name is not empty and complies with Discord's role naming rules.
  • If the bot lacks the 'Manage Roles' permission, the creation will fail with an authorization error.
  • Invalid color format should be corrected to a valid hex color string (e.g., #FF0000).
  • If additional fields contain invalid JSON (e.g., for embed), the node will throw an error; ensure JSON is well-formed.

Links

Discussion